periodic-call.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef __SOT_PERIODICCALL_HH__
11 #define __SOT_PERIODICCALL_HH__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* SOT */
18 #include <dynamic-graph/entity.h>
20 
21 #include <sot/core/api.hh>
22 /* STD */
23 #include <list>
24 #include <map>
25 #include <string>
26 
27 /* --------------------------------------------------------------------- */
28 /* --- CLASS ----------------------------------------------------------- */
29 /* --------------------------------------------------------------------- */
30 
31 namespace dynamicgraph {
32 namespace sot {
33 
38  protected:
39  struct SignalToCall {
41  unsigned int downsamplingFactor;
42 
44  signal = NULL;
45  downsamplingFactor = 1;
46  }
47 
48  SignalToCall(dynamicgraph::SignalBase<int> *s, unsigned int df = 1) {
49  signal = s;
50  downsamplingFactor = df;
51  }
52  };
53 
54  typedef std::map<std::string, SignalToCall> SignalMapType;
55  SignalMapType signalMap;
56 
57  int innerTime;
58 
59  /* --- FUNCTIONS ------------------------------------------------------------
60  */
61  public:
62  PeriodicCall(void);
63  virtual ~PeriodicCall(void) {}
64 
65  void addDownsampledSignal(const std::string &name,
67  const unsigned int &downsamplingFactor);
68  void addDownsampledSignal(const std::string &sigpath,
69  const unsigned int &downsamplingFactor);
70 
71  void addSignal(const std::string &name, dynamicgraph::SignalBase<int> &sig);
72  void addSignal(const std::string &args);
73  void rmSignal(const std::string &name);
74 
75  void runSignals(const int &t);
76  void run(const int &t);
77 
78  void clear(void) { signalMap.clear(); }
79 
80  void display(std::ostream &os) const;
81 };
82 
83 } // namespace sot
84 } // namespace dynamicgraph
85 
86 #endif // #ifndef __SOT_PERIODICCALL_HH__
87 
88 /*
89  * Local variables:
90  * c-basic-offset: 2
91  * End:
92  */
SignalToCall(dynamicgraph::SignalBase< int > *s, unsigned int df=1)
std::map< std::string, SignalToCall > SignalMapType
Signal< dynamicgraph::Matrix, int > sig("matrix")
dynamicgraph::SignalBase< int > * signal
#define SOT_CORE_EXPORT
Definition: api.hh:20
args
Transform3f t


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26