Line |
Branch |
Exec |
Source |
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 |
|
|
|
34 |
|
|
/*! |
35 |
|
|
\class PeriodicCall |
36 |
|
|
*/ |
37 |
|
|
class SOT_CORE_EXPORT PeriodicCall { |
38 |
|
|
protected: |
39 |
|
|
struct SignalToCall { |
40 |
|
|
dynamicgraph::SignalBase<int> *signal; |
41 |
|
|
unsigned int downsamplingFactor; |
42 |
|
|
|
43 |
|
✗ |
SignalToCall() { |
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 |
|
8 |
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 |
|
|
*/ |
93 |
|
|
|