rosparam.h
Go to the documentation of this file.
1 #ifndef __RTT_ROSPARAM_ROSPARAM_H
2 #define __RTT_ROSPARAM_ROSPARAM_H
3 
4 #include <rtt/RTT.hpp>
5 #include <rtt/Property.hpp>
6 
7 #define RTT_ROSPARAM_EIGEN_SUPPORT
8 #ifdef RTT_ROSPARAM_EIGEN_SUPPORT
9  #include <Eigen/Dense>
10  #define eigen_matrix_xd Eigen::Matrix<double,Eigen::Dynamic,1>
11  #define eigen_matrix_xf Eigen::Matrix<float,Eigen::Dynamic,1>
12 #endif
13 
14 #ifndef ADD_ROSPARAM_SERVICE_CONSTRUCTOR
15 #define ADD_ROSPARAM_SERVICE_CONSTRUCTOR(return_type_str) \
16  ,get##return_type_str("get"#return_type_str) \
17  ,set##return_type_str("set"#return_type_str) \
18  ,get##return_type_str##Relative ("get"#return_type_str"Relative") \
19  ,set##return_type_str##Relative ("set"#return_type_str"Relative") \
20  ,get##return_type_str##Absolute ("get"#return_type_str"Absolute") \
21  ,set##return_type_str##Absolute ("set"#return_type_str"Absolute") \
22  ,get##return_type_str##Private ("get"#return_type_str"Private") \
23  ,set##return_type_str##Private ("set"#return_type_str"Private") \
24  ,get##return_type_str##ComponentPrivate ("get"#return_type_str"ComponentPrivate") \
25  ,set##return_type_str##ComponentPrivate ("set"#return_type_str"ComponentPrivate") \
26  ,get##return_type_str##ComponentRelative ("get"#return_type_str"ComponentRelative") \
27  ,set##return_type_str##ComponentRelative ("set"#return_type_str"ComponentRelative") \
28  ,get##return_type_str##ComponentAbsolute ("get"#return_type_str"ComponentAbsolute") \
29  ,set##return_type_str##ComponentAbsolute ("set"#return_type_str"ComponentAbsolute") \
30  ,addRosParamProperty##return_type_str ("addRosParamProperty"#return_type_str) \
31  ,addRosParamProperty##return_type_str##Relative ("addRosParamProperty"#return_type_str"Relative") \
32  ,addRosParamProperty##return_type_str##Absolute ("addRosParamProperty"#return_type_str"Absolute") \
33  ,addRosParamProperty##return_type_str##Private ("addRosParamProperty"#return_type_str"Private") \
34  ,addRosParamProperty##return_type_str##ComponentPrivate ("addRosParamProperty"#return_type_str"ComponentPrivate") \
35  ,addRosParamProperty##return_type_str##ComponentRelative ("addRosParamProperty"#return_type_str"ComponentRelative") \
36  ,addRosParamProperty##return_type_str##ComponentAbsolute ("addRosParamProperty"#return_type_str"ComponentAbsolute")
37 #endif
38 
39 #ifndef ADD_ROSPARAM_OPERATION_CALLER
40 #define ADD_ROSPARAM_OPERATION_CALLER(return_type_str) \
41  this->addOperationCaller(get##return_type_str); \
42  this->addOperationCaller(set##return_type_str); \
43  this->addOperationCaller(get##return_type_str##Relative); \
44  this->addOperationCaller(set##return_type_str##Relative); \
45  this->addOperationCaller(get##return_type_str##Absolute); \
46  this->addOperationCaller(set##return_type_str##Absolute); \
47  this->addOperationCaller(get##return_type_str##Private); \
48  this->addOperationCaller(set##return_type_str##Private); \
49  this->addOperationCaller(get##return_type_str##ComponentPrivate); \
50  this->addOperationCaller(set##return_type_str##ComponentPrivate); \
51  this->addOperationCaller(get##return_type_str##ComponentRelative); \
52  this->addOperationCaller(set##return_type_str##ComponentRelative); \
53  this->addOperationCaller(get##return_type_str##ComponentAbsolute); \
54  this->addOperationCaller(set##return_type_str##ComponentAbsolute); \
55  this->addOperationCaller(addRosParamProperty##return_type_str); \
56  this->addOperationCaller(addRosParamProperty##return_type_str##Relative); \
57  this->addOperationCaller(addRosParamProperty##return_type_str##Absolute); \
58  this->addOperationCaller(addRosParamProperty##return_type_str##Private); \
59  this->addOperationCaller(addRosParamProperty##return_type_str##ComponentPrivate); \
60  this->addOperationCaller(addRosParamProperty##return_type_str##ComponentRelative); \
61  this->addOperationCaller(addRosParamProperty##return_type_str##ComponentAbsolute);
62 #endif
63 
64 #ifndef DECLARE_ROSPARAM_OPERATION_CALLER
65 #define DECLARE_ROSPARAM_OPERATION_CALLER(return_type_str, return_type) \
66  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str; \
67  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str; \
68  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str##Relative; \
69  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str##Relative; \
70  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str##Absolute; \
71  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str##Absolute; \
72  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str##Private; \
73  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str##Private; \
74  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str##ComponentPrivate; \
75  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str##ComponentPrivate; \
76  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str##ComponentRelative; \
77  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str##ComponentRelative; \
78  RTT::OperationCaller<bool(const std::string &, return_type &)> get##return_type_str##ComponentAbsolute; \
79  RTT::OperationCaller<void(const std::string &, const return_type &)> set##return_type_str##ComponentAbsolute; \
80  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str; \
81  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str##Relative; \
82  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str##Absolute; \
83  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str##Private; \
84  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str##ComponentPrivate; \
85  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str##ComponentRelative; \
86  RTT::OperationCaller<RTT::Property<return_type>&(const std::string &)> addRosParamProperty##return_type_str##ComponentAbsolute;
87 #endif
88 
89 namespace rtt_rosparam {
90 
91  typedef enum {
100 
102  {
103 
104  public:
105  static const int RELATIVE = rtt_rosparam::RELATIVE;
106  static const int ABSOLUTE = rtt_rosparam::ABSOLUTE;
107  static const int PRIVATE = rtt_rosparam::PRIVATE;
112 
114  RTT::ServiceRequester("rosparam",owner),
115  getAllRelative("getAllRelative"),
116  getAllAbsolute("getAllAbsolute"),
117  getAllPrivate("getAllPrivate"),
118  getAllComponentPrivate("getAllComponentPrivate"),
119  getAllComponentRelative("getAllComponentRelative"),
120  getAllComponentAbsolute("getAllComponentAbsolute"),
121  getAll("getAll"),
122  setAllRelative("setAllRelative"),
123  setAllAbsolute("setAllAbsolute"),
124  setAllPrivate("setAllPrivate"),
125  setAllComponentPrivate("setAllComponentPrivate"),
126  setAllComponentRelative("setAllComponentRelative"),
127  setAllComponentAbsolute("setAllComponentAbsolute"),
128  setAll("setAll"),
129  get("get"),
130  getParam("getParam"),
131  getRelative("getRelative"),
132  getAbsolute("getAbsolute"),
133  getPrivate("getPrivate"),
134  getComponentPrivate("getComponentPrivate"),
135  getComponentRelative("getComponentRelative"),
136  getComponentAbsolute("getComponentAbsolute"),
137  set("set"),
138  setParam("setParam"),
139  setRelative("setRelative"),
140  setAbsolute("setAbsolute"),
141  setPrivate("setPrivate"),
142  setComponentPrivate("setComponentPrivate"),
143  setComponentRelative("setComponentRelative"),
144  setComponentAbsolute("setComponentAbsolute")
145 
151  ADD_ROSPARAM_SERVICE_CONSTRUCTOR(VectorOfString)
152  ADD_ROSPARAM_SERVICE_CONSTRUCTOR(VectorOfDouble)
153  ADD_ROSPARAM_SERVICE_CONSTRUCTOR(VectorOfFloat)
156 
158  ADD_ROSPARAM_SERVICE_CONSTRUCTOR(EigenVectorXd)
159  ADD_ROSPARAM_SERVICE_CONSTRUCTOR(EigenVectorXf)
160 #endif
161 
162  {
169  this->addOperationCaller(getAll);
170 
177  this->addOperationCaller(setAll);
178 
179  this->addOperationCaller(get);
187 
188  this->addOperationCaller(set);
196 
202  ADD_ROSPARAM_OPERATION_CALLER(VectorOfString)
203  ADD_ROSPARAM_OPERATION_CALLER(VectorOfDouble)
204  ADD_ROSPARAM_OPERATION_CALLER(VectorOfFloat)
205  ADD_ROSPARAM_OPERATION_CALLER(VectorOfInt)
206  ADD_ROSPARAM_OPERATION_CALLER(VectorOfBool)
207 
208 #ifdef RTT_ROSPARAM_EIGEN_SUPPORT
209  ADD_ROSPARAM_OPERATION_CALLER(EigenVectorXd)
210  ADD_ROSPARAM_OPERATION_CALLER(EigenVectorXf)
211 #endif
212  }
213 
228 
237 
246 
247  DECLARE_ROSPARAM_OPERATION_CALLER(String, std::string)
248  DECLARE_ROSPARAM_OPERATION_CALLER(Double, double)
252  DECLARE_ROSPARAM_OPERATION_CALLER(VectorOfString, std::vector<std::string>)
253  DECLARE_ROSPARAM_OPERATION_CALLER(VectorOfDouble, std::vector<double>)
254  DECLARE_ROSPARAM_OPERATION_CALLER(VectorOfFloat, std::vector<float>)
255  DECLARE_ROSPARAM_OPERATION_CALLER(VectorOfInt, std::vector<int>)
256  DECLARE_ROSPARAM_OPERATION_CALLER(VectorOfBool, std::vector<bool>)
257 
258 #ifdef RTT_ROSPARAM_EIGEN_SUPPORT
261 #endif
262 
263  };
264 }
265 
266 #endif // ifndef __RTT_ROSPARAM_ROSPARAM_H
RTT::OperationCaller< bool(const std::string &)> getAbsolute
Definition: rosparam.h:232
RTT::OperationCaller< bool(const std::string &)> getComponentPrivate
Definition: rosparam.h:234
static const int PRIVATE
For backwards compatibility.
Definition: rosparam.h:107
RTT::OperationCaller< bool(const std::string &)> setComponentAbsolute
Definition: rosparam.h:245
RTT::OperationCaller< bool(const std::string &)> setRelative
Definition: rosparam.h:240
RTT::OperationCaller< bool(const std::string &, const std::string &)> getParam
Definition: rosparam.h:230
#define DECLARE_ROSPARAM_OPERATION_CALLER(return_type_str, return_type)
Definition: rosparam.h:65
RTT::OperationCaller< bool(void)> setAllComponentRelative
Definition: rosparam.h:225
Component resolution: "name" -> "COMPONENT_NAME/name".
Definition: rosparam.h:97
RTT::OperationCaller< bool(void)> setAllAbsolute
Definition: rosparam.h:222
RTT::OperationCaller< bool(void)> setAllComponentPrivate
Definition: rosparam.h:224
RTT::OperationCaller< bool(const std::string &)> setAbsolute
Definition: rosparam.h:241
Absolute resolution: "name" -> "/name".
Definition: rosparam.h:94
static const int COMPONENT_ABSOLUTE
For backwards compatibility.
Definition: rosparam.h:110
RTT::OperationCaller< bool(void)> setAll
Definition: rosparam.h:227
RTT::OperationCaller< bool(void)> setAllComponentAbsolute
Definition: rosparam.h:226
#define RTT_ROSPARAM_EIGEN_SUPPORT
Definition: rosparam.h:7
ServiceRequester(const std::string &name, TaskContext *owner=0)
RTT::OperationCaller< bool(const std::string &, const std::string &)> setParam
Definition: rosparam.h:239
RTT::OperationCaller< bool(const std::string &)> setComponentRelative
Definition: rosparam.h:244
RTT::OperationCaller< bool(void)> getAllComponentPrivate
Definition: rosparam.h:217
RTT::OperationCaller< bool(const std::string &)> getPrivate
Definition: rosparam.h:233
RTT::OperationCaller< bool(void)> getAllAbsolute
Definition: rosparam.h:215
RTT::OperationCaller< bool(void)> getAllComponentRelative
Definition: rosparam.h:218
RTT::OperationCaller< bool(void)> getAllComponentAbsolute
Definition: rosparam.h:219
RTT::OperationCaller< bool(void)> getAllPrivate
Definition: rosparam.h:216
RTT::OperationCaller< bool(void)> getAll
Definition: rosparam.h:220
RTT::OperationCaller< bool(const std::string &)> getComponentRelative
Definition: rosparam.h:235
RTT::OperationCaller< bool(void)> setAllPrivate
Definition: rosparam.h:223
static const int COMPONENT_PRIVATE
For backwards compatibility.
Definition: rosparam.h:108
RTT::OperationCaller< bool(const std::string &)> setComponentPrivate
Definition: rosparam.h:243
static const int COMPONENT_RELATIVE
For backwards compatibility.
Definition: rosparam.h:109
RTT::OperationCaller< bool(void)> getAllRelative
Definition: rosparam.h:214
#define eigen_matrix_xf
Definition: rosparam.h:11
RTT::OperationCaller< bool(const std::string &, const unsigned int)> set
Definition: rosparam.h:238
static const int COMPONENT
For backwards compatibility.
Definition: rosparam.h:111
Relative resolution: "name" -> "name".
Definition: rosparam.h:93
RTT::OperationCaller< bool(const std::string &)> getComponentAbsolute
Definition: rosparam.h:236
RTT::OperationCaller< bool(const std::string &)> getRelative
Definition: rosparam.h:231
ROSParam(RTT::TaskContext *owner)
For backwards compatibility, component resolution: COMPONENT_PRIVATE.
Definition: rosparam.h:113
Private resolution: "name" -> "~name".
Definition: rosparam.h:95
RTT::OperationCaller< bool(const std::string &, const unsigned int)> get
Definition: rosparam.h:229
static const int RELATIVE
Definition: rosparam.h:105
#define ADD_ROSPARAM_SERVICE_CONSTRUCTOR(return_type_str)
Definition: rosparam.h:15
static const int ABSOLUTE
For backwards compatibility.
Definition: rosparam.h:106
Component resolution: "name" -> "~COMPONENT_NAME/name".
Definition: rosparam.h:96
#define eigen_matrix_xd
Definition: rosparam.h:10
RTT::OperationCaller< bool(void)> setAllRelative
Definition: rosparam.h:221
#define ADD_ROSPARAM_OPERATION_CALLER(return_type_str)
Definition: rosparam.h:40
RTT::OperationCaller< bool(const std::string &)> setPrivate
Definition: rosparam.h:242
Component resolution: "name" -> "/COMPONENT_NAME/name".
Definition: rosparam.h:98
bool addOperationCaller(base::OperationCallerBaseInvoker &mbi)


rtt_rosparam
Author(s): Ruben Smits
autogenerated on Mon May 10 2021 02:45:11