sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
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>
19 #include <dynamic-graph/signal-base.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 {
40  dynamicgraph::SignalBase<int> *signal;
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;
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,
66  dynamicgraph::SignalBase<int> &sig,
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  */
#define SOT_CORE_EXPORT
Definition: api.hh:20
Definition: periodic-call.hh:37
void addSignal(const std::string &name, dynamicgraph::SignalBase< int > &sig)
int innerTime
Definition: periodic-call.hh:57
std::map< std::string, SignalToCall > SignalMapType
Definition: periodic-call.hh:54
void display(std::ostream &os) const
void rmSignal(const std::string &name)
void addSignal(const std::string &args)
void addDownsampledSignal(const std::string &name, dynamicgraph::SignalBase< int > &sig, const unsigned int &downsamplingFactor)
void addDownsampledSignal(const std::string &sigpath, const unsigned int &downsamplingFactor)
virtual ~PeriodicCall(void)
Definition: periodic-call.hh:63
void runSignals(const int &t)
void clear(void)
Definition: periodic-call.hh:78
SignalMapType signalMap
Definition: periodic-call.hh:55
Definition: abstract-sot-external-interface.hh:17
Definition: periodic-call.hh:39
SignalToCall()
Definition: periodic-call.hh:43
SignalToCall(dynamicgraph::SignalBase< int > *s, unsigned int df=1)
Definition: periodic-call.hh:48
dynamicgraph::SignalBase< int > * signal
Definition: periodic-call.hh:40
unsigned int downsamplingFactor
Definition: periodic-call.hh:41