Fawkes API  Fawkes Development Version
DynamicReconfigureInterface.h
1 
2 /***************************************************************************
3  * DynamicReconfigureInterface.h - Fawkes BlackBoard Interface - DynamicReconfigureInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2017 Christoph Henke
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _INTERFACES_DYNAMICRECONFIGUREINTERFACE_H_
25 #define _INTERFACES_DYNAMICRECONFIGUREINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(DynamicReconfigureInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /** Status of the last send message */
42  typedef enum {
43  Succeeded /**< Message was successful send */,
44  Failed /**< Message failed */
45  } LastMsgStatus;
46  const char * tostring_LastMsgStatus(LastMsgStatus value) const;
47 
48  private:
49  /** Internal data storage, do NOT modify! */
50  typedef struct __attribute__((packed)) {
51  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
52  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
53  char last_service[64]; /**< The last service for reconfiguration called. */
54  char last_parameter[64]; /**< The last parameter name. */
55  bool last_bool_value; /**< The last parameter value. */
56  char last_str_value[64]; /**< The last parameter value. */
57  uint32_t last_uint32_value; /**< The last parameter value. */
58  uint64_t last_uint64_value; /**< The last parameter value. */
59  float last_float_value; /**< The last parameter value. */
60  uint64_t last_msg_id; /**< The last parameter name. */
61  int32_t last_msg_status; /**< The last send message status. */
62  } DynamicReconfigureInterface_data_t;
63 
64  DynamicReconfigureInterface_data_t *data;
65 
66  interface_enum_map_t enum_map_LastMsgStatus;
67  public:
68  /* messages */
69  class SetBoolMessage : public Message
70  {
71  private:
72  /** Internal data storage, do NOT modify! */
73  typedef struct __attribute__((packed)) {
74  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
75  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
76  char service[64]; /**< Name of the ROS service for dynamic reconfiguration. */
77  char parameter[64]; /**< Name of the ROS parameter. */
78  bool value; /**< The bool value. */
79  } SetBoolMessage_data_t;
80 
81  SetBoolMessage_data_t *data;
82 
83  interface_enum_map_t enum_map_LastMsgStatus;
84  public:
85  SetBoolMessage(const char * ini_service, const char * ini_parameter, const bool ini_value);
88 
90  /* Methods */
91  char * service() const;
92  void set_service(const char * new_service);
93  size_t maxlenof_service() const;
94  char * parameter() const;
95  void set_parameter(const char * new_parameter);
96  size_t maxlenof_parameter() const;
97  bool is_value() const;
98  void set_value(const bool new_value);
99  size_t maxlenof_value() const;
100  virtual Message * clone() const;
101  };
102 
103  class SetStringMessage : public Message
104  {
105  private:
106  /** Internal data storage, do NOT modify! */
107  typedef struct __attribute__((packed)) {
108  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
109  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
110  char service[64]; /**< Name of the ROS service for dynamic reconfiguration. */
111  char parameter[64]; /**< Name of the ROS parameter. */
112  char value[64]; /**< The value to set. */
113  } SetStringMessage_data_t;
114 
115  SetStringMessage_data_t *data;
116 
117  interface_enum_map_t enum_map_LastMsgStatus;
118  public:
119  SetStringMessage(const char * ini_service, const char * ini_parameter, const char * ini_value);
122 
124  /* Methods */
125  char * service() const;
126  void set_service(const char * new_service);
127  size_t maxlenof_service() const;
128  char * parameter() const;
129  void set_parameter(const char * new_parameter);
130  size_t maxlenof_parameter() const;
131  char * value() const;
132  void set_value(const char * new_value);
133  size_t maxlenof_value() const;
134  virtual Message * clone() const;
135  };
136 
137  class SetUint32Message : public Message
138  {
139  private:
140  /** Internal data storage, do NOT modify! */
141  typedef struct __attribute__((packed)) {
142  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
143  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
144  char service[64]; /**< Name of the ROS service for dynamic reconfiguration. */
145  char parameter[64]; /**< Name of the ROS parameter. */
146  uint32_t value; /**< The value to set. */
147  } SetUint32Message_data_t;
148 
149  SetUint32Message_data_t *data;
150 
151  interface_enum_map_t enum_map_LastMsgStatus;
152  public:
153  SetUint32Message(const char * ini_service, const char * ini_parameter, const uint32_t ini_value);
156 
158  /* Methods */
159  char * service() const;
160  void set_service(const char * new_service);
161  size_t maxlenof_service() const;
162  char * parameter() const;
163  void set_parameter(const char * new_parameter);
164  size_t maxlenof_parameter() const;
165  uint32_t value() const;
166  void set_value(const uint32_t new_value);
167  size_t maxlenof_value() const;
168  virtual Message * clone() const;
169  };
170 
171  class SetUint64Message : public Message
172  {
173  private:
174  /** Internal data storage, do NOT modify! */
175  typedef struct __attribute__((packed)) {
176  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
177  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
178  char service[64]; /**< Name of the ROS service for dynamic reconfiguration. */
179  char parameter[64]; /**< Name of the ROS parameter. */
180  uint64_t value; /**< The value to set. */
181  } SetUint64Message_data_t;
182 
183  SetUint64Message_data_t *data;
184 
185  interface_enum_map_t enum_map_LastMsgStatus;
186  public:
187  SetUint64Message(const char * ini_service, const char * ini_parameter, const uint64_t ini_value);
190 
192  /* Methods */
193  char * service() const;
194  void set_service(const char * new_service);
195  size_t maxlenof_service() const;
196  char * parameter() const;
197  void set_parameter(const char * new_parameter);
198  size_t maxlenof_parameter() const;
199  uint64_t value() const;
200  void set_value(const uint64_t new_value);
201  size_t maxlenof_value() const;
202  virtual Message * clone() const;
203  };
204 
205  class SetFloatMessage : public Message
206  {
207  private:
208  /** Internal data storage, do NOT modify! */
209  typedef struct __attribute__((packed)) {
210  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
211  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
212  char service[64]; /**< Name of the ROS service for dynamic reconfiguration. */
213  char parameter[64]; /**< Name of the ROS parameter. */
214  float value; /**< The value to set. */
215  } SetFloatMessage_data_t;
216 
217  SetFloatMessage_data_t *data;
218 
219  interface_enum_map_t enum_map_LastMsgStatus;
220  public:
221  SetFloatMessage(const char * ini_service, const char * ini_parameter, const float ini_value);
222  SetFloatMessage();
224 
226  /* Methods */
227  char * service() const;
228  void set_service(const char * new_service);
229  size_t maxlenof_service() const;
230  char * parameter() const;
231  void set_parameter(const char * new_parameter);
232  size_t maxlenof_parameter() const;
233  float value() const;
234  void set_value(const float new_value);
235  size_t maxlenof_value() const;
236  virtual Message * clone() const;
237  };
238 
239  virtual bool message_valid(const Message *message) const;
240  private:
243 
244  public:
245  /* Methods */
246  char * last_service() const;
247  void set_last_service(const char * new_last_service);
248  size_t maxlenof_last_service() const;
249  char * last_parameter() const;
250  void set_last_parameter(const char * new_last_parameter);
251  size_t maxlenof_last_parameter() const;
252  bool is_last_bool_value() const;
253  void set_last_bool_value(const bool new_last_bool_value);
254  size_t maxlenof_last_bool_value() const;
255  char * last_str_value() const;
256  void set_last_str_value(const char * new_last_str_value);
257  size_t maxlenof_last_str_value() const;
258  uint32_t last_uint32_value() const;
259  void set_last_uint32_value(const uint32_t new_last_uint32_value);
260  size_t maxlenof_last_uint32_value() const;
261  uint64_t last_uint64_value() const;
262  void set_last_uint64_value(const uint64_t new_last_uint64_value);
263  size_t maxlenof_last_uint64_value() const;
264  float last_float_value() const;
265  void set_last_float_value(const float new_last_float_value);
266  size_t maxlenof_last_float_value() const;
267  uint64_t last_msg_id() const;
268  void set_last_msg_id(const uint64_t new_last_msg_id);
269  size_t maxlenof_last_msg_id() const;
271  void set_last_msg_status(const LastMsgStatus new_last_msg_status);
272  size_t maxlenof_last_msg_status() const;
273  virtual Message * create_message(const char *type) const;
274 
275  virtual void copy_values(const Interface *other);
276  virtual const char * enum_tostring(const char *enumtype, int val) const;
277 
278 };
279 
280 } // end namespace fawkes
281 
282 #endif
void set_last_uint64_value(const uint64_t new_last_uint64_value)
Set last_uint64_value value.
LastMsgStatus last_msg_status() const
Get last_msg_status value.
SetUint64Message Fawkes BlackBoard Interface Message.
size_t maxlenof_service() const
Get maximum length of service value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:41
SetStringMessage Fawkes BlackBoard Interface Message.
uint64_t last_uint64_value() const
Get last_uint64_value value.
size_t maxlenof_last_msg_status() const
Get maximum length of last_msg_status value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
SetFloatMessage Fawkes BlackBoard Interface Message.
void set_last_msg_id(const uint64_t new_last_msg_id)
Set last_msg_id value.
size_t maxlenof_last_service() const
Get maximum length of last_service value.
LastMsgStatus
Status of the last send message.
Fawkes library namespace.
char * last_service() const
Get last_service value.
SetBoolMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
size_t maxlenof_service() const
Get maximum length of service value.
size_t maxlenof_service() const
Get maximum length of service value.
size_t maxlenof_value() const
Get maximum length of value value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:78
size_t maxlenof_service() const
Get maximum length of service value.
void set_parameter(const char *new_parameter)
Set parameter value.
void set_last_bool_value(const bool new_last_bool_value)
Set last_bool_value value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_value() const
Get maximum length of value value.
size_t maxlenof_service() const
Get maximum length of service value.
void set_service(const char *new_service)
Set service value.
void set_service(const char *new_service)
Set service value.
void set_service(const char *new_service)
Set service value.
size_t maxlenof_last_bool_value() const
Get maximum length of last_bool_value value.
size_t maxlenof_value() const
Get maximum length of value value.
const char * type() const
Get type of interface.
Definition: interface.cpp:640
size_t maxlenof_last_str_value() const
Get maximum length of last_str_value value.
float last_float_value() const
Get last_float_value value.
virtual Message * create_message(const char *type) const
Create message based on type name.
char * last_parameter() const
Get last_parameter value.
void set_value(const uint64_t new_value)
Set value value.
void set_service(const char *new_service)
Set service value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
SetUint32Message Fawkes BlackBoard Interface Message.
void set_last_msg_status(const LastMsgStatus new_last_msg_status)
Set last_msg_status value.
uint64_t last_msg_id() const
Get last_msg_id value.
size_t maxlenof_last_uint32_value() const
Get maximum length of last_uint32_value value.
void set_value(const uint32_t new_value)
Set value value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
void set_last_float_value(const float new_last_float_value)
Set last_float_value value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
void set_parameter(const char *new_parameter)
Set parameter value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
char * last_str_value() const
Get last_str_value value.
void set_last_str_value(const char *new_last_str_value)
Set last_str_value value.
void set_parameter(const char *new_parameter)
Set parameter value.
void set_last_uint32_value(const uint32_t new_last_uint32_value)
Set last_uint32_value value.
virtual Message * clone() const
Clone this message.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_parameter(const char *new_parameter)
Set parameter value.
size_t maxlenof_last_msg_id() const
Get maximum length of last_msg_id value.
size_t maxlenof_last_float_value() const
Get maximum length of last_float_value value.
void set_parameter(const char *new_parameter)
Set parameter value.
size_t maxlenof_value() const
Get maximum length of value value.
void set_last_parameter(const char *new_last_parameter)
Set last_parameter value.
DynamicReconfigureInterface Fawkes BlackBoard Interface.
uint32_t last_uint32_value() const
Get last_uint32_value value.
void set_last_service(const char *new_last_service)
Set last_service value.
size_t maxlenof_last_parameter() const
Get maximum length of last_parameter value.
void set_service(const char *new_service)
Set service value.
size_t maxlenof_value() const
Get maximum length of value value.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:54
bool is_last_bool_value() const
Get last_bool_value value.
const char * tostring_LastMsgStatus(LastMsgStatus value) const
Convert LastMsgStatus constant to string.
size_t maxlenof_last_uint64_value() const
Get maximum length of last_uint64_value value.