Fawkes API  Fawkes Development Version
DynamicReconfigureInterface.cpp
1 
2 /***************************************************************************
3  * DynamicReconfigureInterface.cpp - 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 #include <interfaces/DynamicReconfigureInterface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <map>
29 #include <string>
30 #include <cstring>
31 #include <cstdlib>
32 
33 namespace fawkes {
34 
35 /** @class DynamicReconfigureInterface <interfaces/DynamicReconfigureInterface.h>
36  * DynamicReconfigureInterface Fawkes BlackBoard Interface.
37  *
38  Currently only the last set parameter is displayed.
39 
40  * @ingroup FawkesInterfaces
41  */
42 
43 
44 
45 /** Constructor */
46 DynamicReconfigureInterface::DynamicReconfigureInterface() : Interface()
47 {
48  data_size = sizeof(DynamicReconfigureInterface_data_t);
49  data_ptr = malloc(data_size);
50  data = (DynamicReconfigureInterface_data_t *)data_ptr;
51  data_ts = (interface_data_ts_t *)data_ptr;
52  memset(data_ptr, 0, data_size);
53  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
54  enum_map_LastMsgStatus[(int)Failed] = "Failed";
55  add_fieldinfo(IFT_STRING, "last_service", 64, data->last_service);
56  add_fieldinfo(IFT_STRING, "last_parameter", 64, data->last_parameter);
57  add_fieldinfo(IFT_BOOL, "last_bool_value", 1, &data->last_bool_value);
58  add_fieldinfo(IFT_STRING, "last_str_value", 64, data->last_str_value);
59  add_fieldinfo(IFT_UINT32, "last_uint32_value", 1, &data->last_uint32_value);
60  add_fieldinfo(IFT_UINT64, "last_uint64_value", 1, &data->last_uint64_value);
61  add_fieldinfo(IFT_FLOAT, "last_float_value", 1, &data->last_float_value);
62  add_fieldinfo(IFT_UINT64, "last_msg_id", 1, &data->last_msg_id);
63  add_fieldinfo(IFT_ENUM, "last_msg_status", 1, &data->last_msg_status, "LastMsgStatus", &enum_map_LastMsgStatus);
64  add_messageinfo("SetBoolMessage");
65  add_messageinfo("SetStringMessage");
66  add_messageinfo("SetUint32Message");
67  add_messageinfo("SetUint64Message");
68  add_messageinfo("SetFloatMessage");
69  unsigned char tmp_hash[] = {0xe2, 0xc2, 0x78, 0x4a, 0x9f, 0x90, 0x36, 0x57, 0xeb, 0x26, 0x9, 0xe0, 0xe8, 0x77, 0xcd, 0x9d};
70  set_hash(tmp_hash);
71 }
72 
73 /** Destructor */
74 DynamicReconfigureInterface::~DynamicReconfigureInterface()
75 {
76  free(data_ptr);
77 }
78 /** Convert LastMsgStatus constant to string.
79  * @param value value to convert to string
80  * @return constant value as string.
81  */
82 const char *
83 DynamicReconfigureInterface::tostring_LastMsgStatus(LastMsgStatus value) const
84 {
85  switch (value) {
86  case Succeeded: return "Succeeded";
87  case Failed: return "Failed";
88  default: return "UNKNOWN";
89  }
90 }
91 /* Methods */
92 /** Get last_service value.
93  * The last service for reconfiguration called.
94  * @return last_service value
95  */
96 char *
97 DynamicReconfigureInterface::last_service() const
98 {
99  return data->last_service;
100 }
101 
102 /** Get maximum length of last_service value.
103  * @return length of last_service value, can be length of the array or number of
104  * maximum number of characters for a string
105  */
106 size_t
107 DynamicReconfigureInterface::maxlenof_last_service() const
108 {
109  return 64;
110 }
111 
112 /** Set last_service value.
113  * The last service for reconfiguration called.
114  * @param new_last_service new last_service value
115  */
116 void
117 DynamicReconfigureInterface::set_last_service(const char * new_last_service)
118 {
119  set_field(data->last_service, new_last_service);
120 }
121 
122 /** Get last_parameter value.
123  * The last parameter name.
124  * @return last_parameter value
125  */
126 char *
127 DynamicReconfigureInterface::last_parameter() const
128 {
129  return data->last_parameter;
130 }
131 
132 /** Get maximum length of last_parameter value.
133  * @return length of last_parameter value, can be length of the array or number of
134  * maximum number of characters for a string
135  */
136 size_t
137 DynamicReconfigureInterface::maxlenof_last_parameter() const
138 {
139  return 64;
140 }
141 
142 /** Set last_parameter value.
143  * The last parameter name.
144  * @param new_last_parameter new last_parameter value
145  */
146 void
147 DynamicReconfigureInterface::set_last_parameter(const char * new_last_parameter)
148 {
149  set_field(data->last_parameter, new_last_parameter);
150 }
151 
152 /** Get last_bool_value value.
153  * The last parameter value.
154  * @return last_bool_value value
155  */
156 bool
157 DynamicReconfigureInterface::is_last_bool_value() const
158 {
159  return data->last_bool_value;
160 }
161 
162 /** Get maximum length of last_bool_value value.
163  * @return length of last_bool_value value, can be length of the array or number of
164  * maximum number of characters for a string
165  */
166 size_t
167 DynamicReconfigureInterface::maxlenof_last_bool_value() const
168 {
169  return 1;
170 }
171 
172 /** Set last_bool_value value.
173  * The last parameter value.
174  * @param new_last_bool_value new last_bool_value value
175  */
176 void
177 DynamicReconfigureInterface::set_last_bool_value(const bool new_last_bool_value)
178 {
179  set_field(data->last_bool_value, new_last_bool_value);
180 }
181 
182 /** Get last_str_value value.
183  * The last parameter value.
184  * @return last_str_value value
185  */
186 char *
187 DynamicReconfigureInterface::last_str_value() const
188 {
189  return data->last_str_value;
190 }
191 
192 /** Get maximum length of last_str_value value.
193  * @return length of last_str_value value, can be length of the array or number of
194  * maximum number of characters for a string
195  */
196 size_t
197 DynamicReconfigureInterface::maxlenof_last_str_value() const
198 {
199  return 64;
200 }
201 
202 /** Set last_str_value value.
203  * The last parameter value.
204  * @param new_last_str_value new last_str_value value
205  */
206 void
207 DynamicReconfigureInterface::set_last_str_value(const char * new_last_str_value)
208 {
209  set_field(data->last_str_value, new_last_str_value);
210 }
211 
212 /** Get last_uint32_value value.
213  * The last parameter value.
214  * @return last_uint32_value value
215  */
216 uint32_t
217 DynamicReconfigureInterface::last_uint32_value() const
218 {
219  return data->last_uint32_value;
220 }
221 
222 /** Get maximum length of last_uint32_value value.
223  * @return length of last_uint32_value value, can be length of the array or number of
224  * maximum number of characters for a string
225  */
226 size_t
227 DynamicReconfigureInterface::maxlenof_last_uint32_value() const
228 {
229  return 1;
230 }
231 
232 /** Set last_uint32_value value.
233  * The last parameter value.
234  * @param new_last_uint32_value new last_uint32_value value
235  */
236 void
237 DynamicReconfigureInterface::set_last_uint32_value(const uint32_t new_last_uint32_value)
238 {
239  set_field(data->last_uint32_value, new_last_uint32_value);
240 }
241 
242 /** Get last_uint64_value value.
243  * The last parameter value.
244  * @return last_uint64_value value
245  */
246 uint64_t
247 DynamicReconfigureInterface::last_uint64_value() const
248 {
249  return data->last_uint64_value;
250 }
251 
252 /** Get maximum length of last_uint64_value value.
253  * @return length of last_uint64_value value, can be length of the array or number of
254  * maximum number of characters for a string
255  */
256 size_t
257 DynamicReconfigureInterface::maxlenof_last_uint64_value() const
258 {
259  return 1;
260 }
261 
262 /** Set last_uint64_value value.
263  * The last parameter value.
264  * @param new_last_uint64_value new last_uint64_value value
265  */
266 void
267 DynamicReconfigureInterface::set_last_uint64_value(const uint64_t new_last_uint64_value)
268 {
269  set_field(data->last_uint64_value, new_last_uint64_value);
270 }
271 
272 /** Get last_float_value value.
273  * The last parameter value.
274  * @return last_float_value value
275  */
276 float
277 DynamicReconfigureInterface::last_float_value() const
278 {
279  return data->last_float_value;
280 }
281 
282 /** Get maximum length of last_float_value value.
283  * @return length of last_float_value value, can be length of the array or number of
284  * maximum number of characters for a string
285  */
286 size_t
287 DynamicReconfigureInterface::maxlenof_last_float_value() const
288 {
289  return 1;
290 }
291 
292 /** Set last_float_value value.
293  * The last parameter value.
294  * @param new_last_float_value new last_float_value value
295  */
296 void
297 DynamicReconfigureInterface::set_last_float_value(const float new_last_float_value)
298 {
299  set_field(data->last_float_value, new_last_float_value);
300 }
301 
302 /** Get last_msg_id value.
303  * The last parameter name.
304  * @return last_msg_id value
305  */
306 uint64_t
307 DynamicReconfigureInterface::last_msg_id() const
308 {
309  return data->last_msg_id;
310 }
311 
312 /** Get maximum length of last_msg_id value.
313  * @return length of last_msg_id value, can be length of the array or number of
314  * maximum number of characters for a string
315  */
316 size_t
317 DynamicReconfigureInterface::maxlenof_last_msg_id() const
318 {
319  return 1;
320 }
321 
322 /** Set last_msg_id value.
323  * The last parameter name.
324  * @param new_last_msg_id new last_msg_id value
325  */
326 void
327 DynamicReconfigureInterface::set_last_msg_id(const uint64_t new_last_msg_id)
328 {
329  set_field(data->last_msg_id, new_last_msg_id);
330 }
331 
332 /** Get last_msg_status value.
333  * The last send message status.
334  * @return last_msg_status value
335  */
337 DynamicReconfigureInterface::last_msg_status() const
338 {
339  return (DynamicReconfigureInterface::LastMsgStatus)data->last_msg_status;
340 }
341 
342 /** Get maximum length of last_msg_status value.
343  * @return length of last_msg_status value, can be length of the array or number of
344  * maximum number of characters for a string
345  */
346 size_t
347 DynamicReconfigureInterface::maxlenof_last_msg_status() const
348 {
349  return 1;
350 }
351 
352 /** Set last_msg_status value.
353  * The last send message status.
354  * @param new_last_msg_status new last_msg_status value
355  */
356 void
357 DynamicReconfigureInterface::set_last_msg_status(const LastMsgStatus new_last_msg_status)
358 {
359  set_field(data->last_msg_status, new_last_msg_status);
360 }
361 
362 /* =========== message create =========== */
363 Message *
364 DynamicReconfigureInterface::create_message(const char *type) const
365 {
366  if ( strncmp("SetBoolMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
367  return new SetBoolMessage();
368  } else if ( strncmp("SetStringMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
369  return new SetStringMessage();
370  } else if ( strncmp("SetUint32Message", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
371  return new SetUint32Message();
372  } else if ( strncmp("SetUint64Message", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
373  return new SetUint64Message();
374  } else if ( strncmp("SetFloatMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
375  return new SetFloatMessage();
376  } else {
377  throw UnknownTypeException("The given type '%s' does not match any known "
378  "message type for this interface type.", type);
379  }
380 }
381 
382 
383 /** Copy values from other interface.
384  * @param other other interface to copy values from
385  */
386 void
387 DynamicReconfigureInterface::copy_values(const Interface *other)
388 {
389  const DynamicReconfigureInterface *oi = dynamic_cast<const DynamicReconfigureInterface *>(other);
390  if (oi == NULL) {
391  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
392  type(), other->type());
393  }
394  memcpy(data, oi->data, sizeof(DynamicReconfigureInterface_data_t));
395 }
396 
397 const char *
398 DynamicReconfigureInterface::enum_tostring(const char *enumtype, int val) const
399 {
400  if (strcmp(enumtype, "LastMsgStatus") == 0) {
401  return tostring_LastMsgStatus((LastMsgStatus)val);
402  }
403  throw UnknownTypeException("Unknown enum type %s", enumtype);
404 }
405 
406 /* =========== messages =========== */
407 /** @class DynamicReconfigureInterface::SetBoolMessage <interfaces/DynamicReconfigureInterface.h>
408  * SetBoolMessage Fawkes BlackBoard Interface Message.
409  *
410 
411  */
412 
413 
414 /** Constructor with initial values.
415  * @param ini_service initial value for service
416  * @param ini_parameter initial value for parameter
417  * @param ini_value initial value for value
418  */
419 DynamicReconfigureInterface::SetBoolMessage::SetBoolMessage(const char * ini_service, const char * ini_parameter, const bool ini_value) : Message("SetBoolMessage")
420 {
421  data_size = sizeof(SetBoolMessage_data_t);
422  data_ptr = malloc(data_size);
423  memset(data_ptr, 0, data_size);
424  data = (SetBoolMessage_data_t *)data_ptr;
426  strncpy(data->service, ini_service, 64-1);
427  data->service[64-1] = 0;
428  strncpy(data->parameter, ini_parameter, 64-1);
429  data->parameter[64-1] = 0;
430  data->value = ini_value;
431  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
432  enum_map_LastMsgStatus[(int)Failed] = "Failed";
433  add_fieldinfo(IFT_STRING, "service", 64, data->service);
434  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
435  add_fieldinfo(IFT_BOOL, "value", 1, &data->value);
436 }
437 /** Constructor */
439 {
440  data_size = sizeof(SetBoolMessage_data_t);
441  data_ptr = malloc(data_size);
442  memset(data_ptr, 0, data_size);
443  data = (SetBoolMessage_data_t *)data_ptr;
445  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
446  enum_map_LastMsgStatus[(int)Failed] = "Failed";
447  add_fieldinfo(IFT_STRING, "service", 64, data->service);
448  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
449  add_fieldinfo(IFT_BOOL, "value", 1, &data->value);
450 }
451 
452 /** Destructor */
454 {
455  free(data_ptr);
456 }
457 
458 /** Copy constructor.
459  * @param m message to copy from
460  */
462 {
463  data_size = m->data_size;
464  data_ptr = malloc(data_size);
465  memcpy(data_ptr, m->data_ptr, data_size);
466  data = (SetBoolMessage_data_t *)data_ptr;
468 }
469 
470 /* Methods */
471 /** Get service value.
472  * Name of the ROS service for dynamic reconfiguration.
473  * @return service value
474  */
475 char *
477 {
478  return data->service;
479 }
480 
481 /** Get maximum length of service value.
482  * @return length of service value, can be length of the array or number of
483  * maximum number of characters for a string
484  */
485 size_t
487 {
488  return 64;
489 }
490 
491 /** Set service value.
492  * Name of the ROS service for dynamic reconfiguration.
493  * @param new_service new service value
494  */
495 void
497 {
498  set_field(data->service, new_service);
499 }
500 
501 /** Get parameter value.
502  * Name of the ROS parameter.
503  * @return parameter value
504  */
505 char *
507 {
508  return data->parameter;
509 }
510 
511 /** Get maximum length of parameter value.
512  * @return length of parameter value, can be length of the array or number of
513  * maximum number of characters for a string
514  */
515 size_t
517 {
518  return 64;
519 }
520 
521 /** Set parameter value.
522  * Name of the ROS parameter.
523  * @param new_parameter new parameter value
524  */
525 void
527 {
528  set_field(data->parameter, new_parameter);
529 }
530 
531 /** Get value value.
532  * The bool value.
533  * @return value value
534  */
535 bool
537 {
538  return data->value;
539 }
540 
541 /** Get maximum length of value value.
542  * @return length of value value, can be length of the array or number of
543  * maximum number of characters for a string
544  */
545 size_t
547 {
548  return 1;
549 }
550 
551 /** Set value value.
552  * The bool value.
553  * @param new_value new value value
554  */
555 void
557 {
558  set_field(data->value, new_value);
559 }
560 
561 /** Clone this message.
562  * Produces a message of the same type as this message and copies the
563  * data to the new message.
564  * @return clone of this message
565  */
566 Message *
568 {
570 }
571 /** @class DynamicReconfigureInterface::SetStringMessage <interfaces/DynamicReconfigureInterface.h>
572  * SetStringMessage Fawkes BlackBoard Interface Message.
573  *
574 
575  */
576 
577 
578 /** Constructor with initial values.
579  * @param ini_service initial value for service
580  * @param ini_parameter initial value for parameter
581  * @param ini_value initial value for value
582  */
583 DynamicReconfigureInterface::SetStringMessage::SetStringMessage(const char * ini_service, const char * ini_parameter, const char * ini_value) : Message("SetStringMessage")
584 {
585  data_size = sizeof(SetStringMessage_data_t);
586  data_ptr = malloc(data_size);
587  memset(data_ptr, 0, data_size);
588  data = (SetStringMessage_data_t *)data_ptr;
590  strncpy(data->service, ini_service, 64-1);
591  data->service[64-1] = 0;
592  strncpy(data->parameter, ini_parameter, 64-1);
593  data->parameter[64-1] = 0;
594  strncpy(data->value, ini_value, 64-1);
595  data->value[64-1] = 0;
596  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
597  enum_map_LastMsgStatus[(int)Failed] = "Failed";
598  add_fieldinfo(IFT_STRING, "service", 64, data->service);
599  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
600  add_fieldinfo(IFT_STRING, "value", 64, data->value);
601 }
602 /** Constructor */
604 {
605  data_size = sizeof(SetStringMessage_data_t);
606  data_ptr = malloc(data_size);
607  memset(data_ptr, 0, data_size);
608  data = (SetStringMessage_data_t *)data_ptr;
610  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
611  enum_map_LastMsgStatus[(int)Failed] = "Failed";
612  add_fieldinfo(IFT_STRING, "service", 64, data->service);
613  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
614  add_fieldinfo(IFT_STRING, "value", 64, data->value);
615 }
616 
617 /** Destructor */
619 {
620  free(data_ptr);
621 }
622 
623 /** Copy constructor.
624  * @param m message to copy from
625  */
627 {
628  data_size = m->data_size;
629  data_ptr = malloc(data_size);
630  memcpy(data_ptr, m->data_ptr, data_size);
631  data = (SetStringMessage_data_t *)data_ptr;
633 }
634 
635 /* Methods */
636 /** Get service value.
637  * Name of the ROS service for dynamic reconfiguration.
638  * @return service value
639  */
640 char *
642 {
643  return data->service;
644 }
645 
646 /** Get maximum length of service value.
647  * @return length of service value, can be length of the array or number of
648  * maximum number of characters for a string
649  */
650 size_t
652 {
653  return 64;
654 }
655 
656 /** Set service value.
657  * Name of the ROS service for dynamic reconfiguration.
658  * @param new_service new service value
659  */
660 void
662 {
663  set_field(data->service, new_service);
664 }
665 
666 /** Get parameter value.
667  * Name of the ROS parameter.
668  * @return parameter value
669  */
670 char *
672 {
673  return data->parameter;
674 }
675 
676 /** Get maximum length of parameter value.
677  * @return length of parameter value, can be length of the array or number of
678  * maximum number of characters for a string
679  */
680 size_t
682 {
683  return 64;
684 }
685 
686 /** Set parameter value.
687  * Name of the ROS parameter.
688  * @param new_parameter new parameter value
689  */
690 void
692 {
693  set_field(data->parameter, new_parameter);
694 }
695 
696 /** Get value value.
697  * The value to set.
698  * @return value value
699  */
700 char *
702 {
703  return data->value;
704 }
705 
706 /** Get maximum length of value value.
707  * @return length of value value, can be length of the array or number of
708  * maximum number of characters for a string
709  */
710 size_t
712 {
713  return 64;
714 }
715 
716 /** Set value value.
717  * The value to set.
718  * @param new_value new value value
719  */
720 void
722 {
723  set_field(data->value, new_value);
724 }
725 
726 /** Clone this message.
727  * Produces a message of the same type as this message and copies the
728  * data to the new message.
729  * @return clone of this message
730  */
731 Message *
733 {
735 }
736 /** @class DynamicReconfigureInterface::SetUint32Message <interfaces/DynamicReconfigureInterface.h>
737  * SetUint32Message Fawkes BlackBoard Interface Message.
738  *
739 
740  */
741 
742 
743 /** Constructor with initial values.
744  * @param ini_service initial value for service
745  * @param ini_parameter initial value for parameter
746  * @param ini_value initial value for value
747  */
748 DynamicReconfigureInterface::SetUint32Message::SetUint32Message(const char * ini_service, const char * ini_parameter, const uint32_t ini_value) : Message("SetUint32Message")
749 {
750  data_size = sizeof(SetUint32Message_data_t);
751  data_ptr = malloc(data_size);
752  memset(data_ptr, 0, data_size);
753  data = (SetUint32Message_data_t *)data_ptr;
755  strncpy(data->service, ini_service, 64-1);
756  data->service[64-1] = 0;
757  strncpy(data->parameter, ini_parameter, 64-1);
758  data->parameter[64-1] = 0;
759  data->value = ini_value;
760  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
761  enum_map_LastMsgStatus[(int)Failed] = "Failed";
762  add_fieldinfo(IFT_STRING, "service", 64, data->service);
763  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
764  add_fieldinfo(IFT_UINT32, "value", 1, &data->value);
765 }
766 /** Constructor */
768 {
769  data_size = sizeof(SetUint32Message_data_t);
770  data_ptr = malloc(data_size);
771  memset(data_ptr, 0, data_size);
772  data = (SetUint32Message_data_t *)data_ptr;
774  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
775  enum_map_LastMsgStatus[(int)Failed] = "Failed";
776  add_fieldinfo(IFT_STRING, "service", 64, data->service);
777  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
778  add_fieldinfo(IFT_UINT32, "value", 1, &data->value);
779 }
780 
781 /** Destructor */
783 {
784  free(data_ptr);
785 }
786 
787 /** Copy constructor.
788  * @param m message to copy from
789  */
791 {
792  data_size = m->data_size;
793  data_ptr = malloc(data_size);
794  memcpy(data_ptr, m->data_ptr, data_size);
795  data = (SetUint32Message_data_t *)data_ptr;
797 }
798 
799 /* Methods */
800 /** Get service value.
801  * Name of the ROS service for dynamic reconfiguration.
802  * @return service value
803  */
804 char *
806 {
807  return data->service;
808 }
809 
810 /** Get maximum length of service value.
811  * @return length of service value, can be length of the array or number of
812  * maximum number of characters for a string
813  */
814 size_t
816 {
817  return 64;
818 }
819 
820 /** Set service value.
821  * Name of the ROS service for dynamic reconfiguration.
822  * @param new_service new service value
823  */
824 void
826 {
827  set_field(data->service, new_service);
828 }
829 
830 /** Get parameter value.
831  * Name of the ROS parameter.
832  * @return parameter value
833  */
834 char *
836 {
837  return data->parameter;
838 }
839 
840 /** Get maximum length of parameter value.
841  * @return length of parameter value, can be length of the array or number of
842  * maximum number of characters for a string
843  */
844 size_t
846 {
847  return 64;
848 }
849 
850 /** Set parameter value.
851  * Name of the ROS parameter.
852  * @param new_parameter new parameter value
853  */
854 void
856 {
857  set_field(data->parameter, new_parameter);
858 }
859 
860 /** Get value value.
861  * The value to set.
862  * @return value value
863  */
864 uint32_t
866 {
867  return data->value;
868 }
869 
870 /** Get maximum length of value value.
871  * @return length of value value, can be length of the array or number of
872  * maximum number of characters for a string
873  */
874 size_t
876 {
877  return 1;
878 }
879 
880 /** Set value value.
881  * The value to set.
882  * @param new_value new value value
883  */
884 void
886 {
887  set_field(data->value, new_value);
888 }
889 
890 /** Clone this message.
891  * Produces a message of the same type as this message and copies the
892  * data to the new message.
893  * @return clone of this message
894  */
895 Message *
897 {
899 }
900 /** @class DynamicReconfigureInterface::SetUint64Message <interfaces/DynamicReconfigureInterface.h>
901  * SetUint64Message Fawkes BlackBoard Interface Message.
902  *
903 
904  */
905 
906 
907 /** Constructor with initial values.
908  * @param ini_service initial value for service
909  * @param ini_parameter initial value for parameter
910  * @param ini_value initial value for value
911  */
912 DynamicReconfigureInterface::SetUint64Message::SetUint64Message(const char * ini_service, const char * ini_parameter, const uint64_t ini_value) : Message("SetUint64Message")
913 {
914  data_size = sizeof(SetUint64Message_data_t);
915  data_ptr = malloc(data_size);
916  memset(data_ptr, 0, data_size);
917  data = (SetUint64Message_data_t *)data_ptr;
919  strncpy(data->service, ini_service, 64-1);
920  data->service[64-1] = 0;
921  strncpy(data->parameter, ini_parameter, 64-1);
922  data->parameter[64-1] = 0;
923  data->value = ini_value;
924  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
925  enum_map_LastMsgStatus[(int)Failed] = "Failed";
926  add_fieldinfo(IFT_STRING, "service", 64, data->service);
927  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
928  add_fieldinfo(IFT_UINT64, "value", 1, &data->value);
929 }
930 /** Constructor */
932 {
933  data_size = sizeof(SetUint64Message_data_t);
934  data_ptr = malloc(data_size);
935  memset(data_ptr, 0, data_size);
936  data = (SetUint64Message_data_t *)data_ptr;
938  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
939  enum_map_LastMsgStatus[(int)Failed] = "Failed";
940  add_fieldinfo(IFT_STRING, "service", 64, data->service);
941  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
942  add_fieldinfo(IFT_UINT64, "value", 1, &data->value);
943 }
944 
945 /** Destructor */
947 {
948  free(data_ptr);
949 }
950 
951 /** Copy constructor.
952  * @param m message to copy from
953  */
955 {
956  data_size = m->data_size;
957  data_ptr = malloc(data_size);
958  memcpy(data_ptr, m->data_ptr, data_size);
959  data = (SetUint64Message_data_t *)data_ptr;
961 }
962 
963 /* Methods */
964 /** Get service value.
965  * Name of the ROS service for dynamic reconfiguration.
966  * @return service value
967  */
968 char *
970 {
971  return data->service;
972 }
973 
974 /** Get maximum length of service value.
975  * @return length of service value, can be length of the array or number of
976  * maximum number of characters for a string
977  */
978 size_t
980 {
981  return 64;
982 }
983 
984 /** Set service value.
985  * Name of the ROS service for dynamic reconfiguration.
986  * @param new_service new service value
987  */
988 void
990 {
991  set_field(data->service, new_service);
992 }
993 
994 /** Get parameter value.
995  * Name of the ROS parameter.
996  * @return parameter value
997  */
998 char *
1000 {
1001  return data->parameter;
1002 }
1003 
1004 /** Get maximum length of parameter value.
1005  * @return length of parameter value, can be length of the array or number of
1006  * maximum number of characters for a string
1007  */
1008 size_t
1010 {
1011  return 64;
1012 }
1013 
1014 /** Set parameter value.
1015  * Name of the ROS parameter.
1016  * @param new_parameter new parameter value
1017  */
1018 void
1020 {
1021  set_field(data->parameter, new_parameter);
1022 }
1023 
1024 /** Get value value.
1025  * The value to set.
1026  * @return value value
1027  */
1028 uint64_t
1030 {
1031  return data->value;
1032 }
1033 
1034 /** Get maximum length of value value.
1035  * @return length of value value, can be length of the array or number of
1036  * maximum number of characters for a string
1037  */
1038 size_t
1040 {
1041  return 1;
1042 }
1043 
1044 /** Set value value.
1045  * The value to set.
1046  * @param new_value new value value
1047  */
1048 void
1050 {
1051  set_field(data->value, new_value);
1052 }
1053 
1054 /** Clone this message.
1055  * Produces a message of the same type as this message and copies the
1056  * data to the new message.
1057  * @return clone of this message
1058  */
1059 Message *
1061 {
1063 }
1064 /** @class DynamicReconfigureInterface::SetFloatMessage <interfaces/DynamicReconfigureInterface.h>
1065  * SetFloatMessage Fawkes BlackBoard Interface Message.
1066  *
1067 
1068  */
1069 
1070 
1071 /** Constructor with initial values.
1072  * @param ini_service initial value for service
1073  * @param ini_parameter initial value for parameter
1074  * @param ini_value initial value for value
1075  */
1076 DynamicReconfigureInterface::SetFloatMessage::SetFloatMessage(const char * ini_service, const char * ini_parameter, const float ini_value) : Message("SetFloatMessage")
1077 {
1078  data_size = sizeof(SetFloatMessage_data_t);
1079  data_ptr = malloc(data_size);
1080  memset(data_ptr, 0, data_size);
1081  data = (SetFloatMessage_data_t *)data_ptr;
1083  strncpy(data->service, ini_service, 64-1);
1084  data->service[64-1] = 0;
1085  strncpy(data->parameter, ini_parameter, 64-1);
1086  data->parameter[64-1] = 0;
1087  data->value = ini_value;
1088  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
1089  enum_map_LastMsgStatus[(int)Failed] = "Failed";
1090  add_fieldinfo(IFT_STRING, "service", 64, data->service);
1091  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
1092  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
1093 }
1094 /** Constructor */
1096 {
1097  data_size = sizeof(SetFloatMessage_data_t);
1098  data_ptr = malloc(data_size);
1099  memset(data_ptr, 0, data_size);
1100  data = (SetFloatMessage_data_t *)data_ptr;
1102  enum_map_LastMsgStatus[(int)Succeeded] = "Succeeded";
1103  enum_map_LastMsgStatus[(int)Failed] = "Failed";
1104  add_fieldinfo(IFT_STRING, "service", 64, data->service);
1105  add_fieldinfo(IFT_STRING, "parameter", 64, data->parameter);
1106  add_fieldinfo(IFT_FLOAT, "value", 1, &data->value);
1107 }
1108 
1109 /** Destructor */
1111 {
1112  free(data_ptr);
1113 }
1114 
1115 /** Copy constructor.
1116  * @param m message to copy from
1117  */
1119 {
1120  data_size = m->data_size;
1121  data_ptr = malloc(data_size);
1122  memcpy(data_ptr, m->data_ptr, data_size);
1123  data = (SetFloatMessage_data_t *)data_ptr;
1125 }
1126 
1127 /* Methods */
1128 /** Get service value.
1129  * Name of the ROS service for dynamic reconfiguration.
1130  * @return service value
1131  */
1132 char *
1134 {
1135  return data->service;
1136 }
1137 
1138 /** Get maximum length of service value.
1139  * @return length of service value, can be length of the array or number of
1140  * maximum number of characters for a string
1141  */
1142 size_t
1144 {
1145  return 64;
1146 }
1147 
1148 /** Set service value.
1149  * Name of the ROS service for dynamic reconfiguration.
1150  * @param new_service new service value
1151  */
1152 void
1154 {
1155  set_field(data->service, new_service);
1156 }
1157 
1158 /** Get parameter value.
1159  * Name of the ROS parameter.
1160  * @return parameter value
1161  */
1162 char *
1164 {
1165  return data->parameter;
1166 }
1167 
1168 /** Get maximum length of parameter value.
1169  * @return length of parameter value, can be length of the array or number of
1170  * maximum number of characters for a string
1171  */
1172 size_t
1174 {
1175  return 64;
1176 }
1177 
1178 /** Set parameter value.
1179  * Name of the ROS parameter.
1180  * @param new_parameter new parameter value
1181  */
1182 void
1184 {
1185  set_field(data->parameter, new_parameter);
1186 }
1187 
1188 /** Get value value.
1189  * The value to set.
1190  * @return value value
1191  */
1192 float
1194 {
1195  return data->value;
1196 }
1197 
1198 /** Get maximum length of value value.
1199  * @return length of value value, can be length of the array or number of
1200  * maximum number of characters for a string
1201  */
1202 size_t
1204 {
1205  return 1;
1206 }
1207 
1208 /** Set value value.
1209  * The value to set.
1210  * @param new_value new value value
1211  */
1212 void
1214 {
1215  set_field(data->value, new_value);
1216 }
1217 
1218 /** Clone this message.
1219  * Produces a message of the same type as this message and copies the
1220  * data to the new message.
1221  * @return clone of this message
1222  */
1223 Message *
1225 {
1227 }
1228 /** Check if message is valid and can be enqueued.
1229  * @param message Message to check
1230  * @return true if the message is valid, false otherwise.
1231  */
1232 bool
1234 {
1235  const SetBoolMessage *m0 = dynamic_cast<const SetBoolMessage *>(message);
1236  if ( m0 != NULL ) {
1237  return true;
1238  }
1239  const SetStringMessage *m1 = dynamic_cast<const SetStringMessage *>(message);
1240  if ( m1 != NULL ) {
1241  return true;
1242  }
1243  const SetUint32Message *m2 = dynamic_cast<const SetUint32Message *>(message);
1244  if ( m2 != NULL ) {
1245  return true;
1246  }
1247  const SetUint64Message *m3 = dynamic_cast<const SetUint64Message *>(message);
1248  if ( m3 != NULL ) {
1249  return true;
1250  }
1251  const SetFloatMessage *m4 = dynamic_cast<const SetFloatMessage *>(message);
1252  if ( m4 != NULL ) {
1253  return true;
1254  }
1255  return false;
1256 }
1257 
1258 /// @cond INTERNALS
1259 EXPORT_INTERFACE(DynamicReconfigureInterface)
1260 /// @endcond
1261 
1262 
1263 } // end namespace fawkes
SetBoolMessage Fawkes BlackBoard Interface Message.
void set_service(const char *new_service)
Set service value.
size_t maxlenof_value() const
Get maximum length of value value.
void set_parameter(const char *new_parameter)
Set parameter value.
size_t maxlenof_service() const
Get maximum length of service value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
virtual Message * clone() const
Clone this message.
SetFloatMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_value() const
Get maximum length of value value.
void set_service(const char *new_service)
Set service value.
void set_parameter(const char *new_parameter)
Set parameter value.
size_t maxlenof_service() const
Get maximum length of service value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
SetStringMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_value() const
Get maximum length of value value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
void set_service(const char *new_service)
Set service value.
void set_parameter(const char *new_parameter)
Set parameter value.
size_t maxlenof_service() const
Get maximum length of service value.
SetUint32Message Fawkes BlackBoard Interface Message.
size_t maxlenof_value() const
Get maximum length of value value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
void set_service(const char *new_service)
Set service value.
void set_value(const uint32_t new_value)
Set value value.
size_t maxlenof_service() const
Get maximum length of service value.
void set_parameter(const char *new_parameter)
Set parameter value.
SetUint64Message Fawkes BlackBoard Interface Message.
void set_value(const uint64_t new_value)
Set value value.
void set_service(const char *new_service)
Set service value.
size_t maxlenof_service() const
Get maximum length of service value.
size_t maxlenof_parameter() const
Get maximum length of parameter value.
size_t maxlenof_value() const
Get maximum length of value value.
void set_parameter(const char *new_parameter)
Set parameter value.
DynamicReconfigureInterface Fawkes BlackBoard Interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
LastMsgStatus
Status of the last send message.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:244
void set_field(FieldT &field, DataT &data)
Set a field, set data_changed to true and update data_changed accordingly.
Definition: interface.h:304
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
Definition: message.cpp:435
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:146
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:156
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:147
Fawkes library namespace.
@ IFT_UINT32
32 bit unsigned integer field
Definition: types.h:43
@ IFT_FLOAT
float field
Definition: types.h:46
@ IFT_UINT64
64 bit unsigned integer field
Definition: types.h:45
@ IFT_STRING
string field
Definition: types.h:48
@ IFT_BOOL
boolean field
Definition: types.h:37
Timestamp data, must be present and first entries for each interface data structs!...
Definition: message.h:152