hairo

Dependencies:   mbed BufferedSerial

Committer:
tknara
Date:
Tue Dec 04 00:14:32 2018 +0000
Revision:
4:bcdd99711326
Parent:
0:9e9b7db60fd5
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garyservin 0:9e9b7db60fd5 1 #ifndef _ROS_dynamic_reconfigure_ConfigDescription_h
garyservin 0:9e9b7db60fd5 2 #define _ROS_dynamic_reconfigure_ConfigDescription_h
garyservin 0:9e9b7db60fd5 3
garyservin 0:9e9b7db60fd5 4 #include <stdint.h>
garyservin 0:9e9b7db60fd5 5 #include <string.h>
garyservin 0:9e9b7db60fd5 6 #include <stdlib.h>
garyservin 0:9e9b7db60fd5 7 #include "ros/msg.h"
garyservin 0:9e9b7db60fd5 8 #include "dynamic_reconfigure/Group.h"
garyservin 0:9e9b7db60fd5 9 #include "dynamic_reconfigure/Config.h"
garyservin 0:9e9b7db60fd5 10
garyservin 0:9e9b7db60fd5 11 namespace dynamic_reconfigure
garyservin 0:9e9b7db60fd5 12 {
garyservin 0:9e9b7db60fd5 13
garyservin 0:9e9b7db60fd5 14 class ConfigDescription : public ros::Msg
garyservin 0:9e9b7db60fd5 15 {
garyservin 0:9e9b7db60fd5 16 public:
garyservin 0:9e9b7db60fd5 17 uint32_t groups_length;
garyservin 0:9e9b7db60fd5 18 typedef dynamic_reconfigure::Group _groups_type;
garyservin 0:9e9b7db60fd5 19 _groups_type st_groups;
garyservin 0:9e9b7db60fd5 20 _groups_type * groups;
garyservin 0:9e9b7db60fd5 21 typedef dynamic_reconfigure::Config _max_type;
garyservin 0:9e9b7db60fd5 22 _max_type max;
garyservin 0:9e9b7db60fd5 23 typedef dynamic_reconfigure::Config _min_type;
garyservin 0:9e9b7db60fd5 24 _min_type min;
garyservin 0:9e9b7db60fd5 25 typedef dynamic_reconfigure::Config _dflt_type;
garyservin 0:9e9b7db60fd5 26 _dflt_type dflt;
garyservin 0:9e9b7db60fd5 27
garyservin 0:9e9b7db60fd5 28 ConfigDescription():
garyservin 0:9e9b7db60fd5 29 groups_length(0), groups(NULL),
garyservin 0:9e9b7db60fd5 30 max(),
garyservin 0:9e9b7db60fd5 31 min(),
garyservin 0:9e9b7db60fd5 32 dflt()
garyservin 0:9e9b7db60fd5 33 {
garyservin 0:9e9b7db60fd5 34 }
garyservin 0:9e9b7db60fd5 35
garyservin 0:9e9b7db60fd5 36 virtual int serialize(unsigned char *outbuffer) const
garyservin 0:9e9b7db60fd5 37 {
garyservin 0:9e9b7db60fd5 38 int offset = 0;
garyservin 0:9e9b7db60fd5 39 *(outbuffer + offset + 0) = (this->groups_length >> (8 * 0)) & 0xFF;
garyservin 0:9e9b7db60fd5 40 *(outbuffer + offset + 1) = (this->groups_length >> (8 * 1)) & 0xFF;
garyservin 0:9e9b7db60fd5 41 *(outbuffer + offset + 2) = (this->groups_length >> (8 * 2)) & 0xFF;
garyservin 0:9e9b7db60fd5 42 *(outbuffer + offset + 3) = (this->groups_length >> (8 * 3)) & 0xFF;
garyservin 0:9e9b7db60fd5 43 offset += sizeof(this->groups_length);
garyservin 0:9e9b7db60fd5 44 for( uint32_t i = 0; i < groups_length; i++){
garyservin 0:9e9b7db60fd5 45 offset += this->groups[i].serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 46 }
garyservin 0:9e9b7db60fd5 47 offset += this->max.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 48 offset += this->min.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 49 offset += this->dflt.serialize(outbuffer + offset);
garyservin 0:9e9b7db60fd5 50 return offset;
garyservin 0:9e9b7db60fd5 51 }
garyservin 0:9e9b7db60fd5 52
garyservin 0:9e9b7db60fd5 53 virtual int deserialize(unsigned char *inbuffer)
garyservin 0:9e9b7db60fd5 54 {
garyservin 0:9e9b7db60fd5 55 int offset = 0;
garyservin 0:9e9b7db60fd5 56 uint32_t groups_lengthT = ((uint32_t) (*(inbuffer + offset)));
garyservin 0:9e9b7db60fd5 57 groups_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
garyservin 0:9e9b7db60fd5 58 groups_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
garyservin 0:9e9b7db60fd5 59 groups_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
garyservin 0:9e9b7db60fd5 60 offset += sizeof(this->groups_length);
garyservin 0:9e9b7db60fd5 61 if(groups_lengthT > groups_length)
garyservin 0:9e9b7db60fd5 62 this->groups = (dynamic_reconfigure::Group*)realloc(this->groups, groups_lengthT * sizeof(dynamic_reconfigure::Group));
garyservin 0:9e9b7db60fd5 63 groups_length = groups_lengthT;
garyservin 0:9e9b7db60fd5 64 for( uint32_t i = 0; i < groups_length; i++){
garyservin 0:9e9b7db60fd5 65 offset += this->st_groups.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 66 memcpy( &(this->groups[i]), &(this->st_groups), sizeof(dynamic_reconfigure::Group));
garyservin 0:9e9b7db60fd5 67 }
garyservin 0:9e9b7db60fd5 68 offset += this->max.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 69 offset += this->min.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 70 offset += this->dflt.deserialize(inbuffer + offset);
garyservin 0:9e9b7db60fd5 71 return offset;
garyservin 0:9e9b7db60fd5 72 }
garyservin 0:9e9b7db60fd5 73
garyservin 0:9e9b7db60fd5 74 const char * getType(){ return "dynamic_reconfigure/ConfigDescription"; };
garyservin 0:9e9b7db60fd5 75 const char * getMD5(){ return "757ce9d44ba8ddd801bb30bc456f946f"; };
garyservin 0:9e9b7db60fd5 76
garyservin 0:9e9b7db60fd5 77 };
garyservin 0:9e9b7db60fd5 78
garyservin 0:9e9b7db60fd5 79 }
garyservin 0:9e9b7db60fd5 80 #endif