Working towards recieving twists

Dependencies:   BufferedSerial

Fork of ros_lib_kinetic by Gary Servin

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BoolParameter.h Source File

BoolParameter.h

00001 #ifndef _ROS_dynamic_reconfigure_BoolParameter_h
00002 #define _ROS_dynamic_reconfigure_BoolParameter_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace dynamic_reconfigure
00010 {
00011 
00012   class BoolParameter : public ros::Msg
00013   {
00014     public:
00015       typedef const char* _name_type;
00016       _name_type name;
00017       typedef bool _value_type;
00018       _value_type value;
00019 
00020     BoolParameter():
00021       name(""),
00022       value(0)
00023     {
00024     }
00025 
00026     virtual int serialize(unsigned char *outbuffer) const
00027     {
00028       int offset = 0;
00029       uint32_t length_name = strlen(this->name);
00030       varToArr(outbuffer + offset, length_name);
00031       offset += 4;
00032       memcpy(outbuffer + offset, this->name, length_name);
00033       offset += length_name;
00034       union {
00035         bool real;
00036         uint8_t base;
00037       } u_value;
00038       u_value.real = this->value;
00039       *(outbuffer + offset + 0) = (u_value.base >> (8 * 0)) & 0xFF;
00040       offset += sizeof(this->value);
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047       uint32_t length_name;
00048       arrToVar(length_name, (inbuffer + offset));
00049       offset += 4;
00050       for(unsigned int k= offset; k< offset+length_name; ++k){
00051           inbuffer[k-1]=inbuffer[k];
00052       }
00053       inbuffer[offset+length_name-1]=0;
00054       this->name = (char *)(inbuffer + offset-1);
00055       offset += length_name;
00056       union {
00057         bool real;
00058         uint8_t base;
00059       } u_value;
00060       u_value.base = 0;
00061       u_value.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00062       this->value = u_value.real;
00063       offset += sizeof(this->value);
00064      return offset;
00065     }
00066 
00067     const char * getType(){ return "dynamic_reconfigure/BoolParameter"; };
00068     const char * getMD5(){ return "23f05028c1a699fb83e22401228c3a9e"; };
00069 
00070   };
00071 
00072 }
00073 #endif