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 SmachContainerStatus.h Source File

SmachContainerStatus.h

00001 #ifndef _ROS_smach_msgs_SmachContainerStatus_h
00002 #define _ROS_smach_msgs_SmachContainerStatus_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 
00010 namespace smach_msgs
00011 {
00012 
00013   class SmachContainerStatus : public ros::Msg
00014   {
00015     public:
00016       typedef std_msgs::Header _header_type;
00017       _header_type header;
00018       typedef const char* _path_type;
00019       _path_type path;
00020       uint32_t initial_states_length;
00021       typedef char* _initial_states_type;
00022       _initial_states_type st_initial_states;
00023       _initial_states_type * initial_states;
00024       uint32_t active_states_length;
00025       typedef char* _active_states_type;
00026       _active_states_type st_active_states;
00027       _active_states_type * active_states;
00028       typedef const char* _local_data_type;
00029       _local_data_type local_data;
00030       typedef const char* _info_type;
00031       _info_type info;
00032 
00033     SmachContainerStatus():
00034       header(),
00035       path(""),
00036       initial_states_length(0), initial_states(NULL),
00037       active_states_length(0), active_states(NULL),
00038       local_data(""),
00039       info("")
00040     {
00041     }
00042 
00043     virtual int serialize(unsigned char *outbuffer) const
00044     {
00045       int offset = 0;
00046       offset += this->header.serialize(outbuffer + offset);
00047       uint32_t length_path = strlen(this->path);
00048       varToArr(outbuffer + offset, length_path);
00049       offset += 4;
00050       memcpy(outbuffer + offset, this->path, length_path);
00051       offset += length_path;
00052       *(outbuffer + offset + 0) = (this->initial_states_length >> (8 * 0)) & 0xFF;
00053       *(outbuffer + offset + 1) = (this->initial_states_length >> (8 * 1)) & 0xFF;
00054       *(outbuffer + offset + 2) = (this->initial_states_length >> (8 * 2)) & 0xFF;
00055       *(outbuffer + offset + 3) = (this->initial_states_length >> (8 * 3)) & 0xFF;
00056       offset += sizeof(this->initial_states_length);
00057       for( uint32_t i = 0; i < initial_states_length; i++){
00058       uint32_t length_initial_statesi = strlen(this->initial_states[i]);
00059       varToArr(outbuffer + offset, length_initial_statesi);
00060       offset += 4;
00061       memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
00062       offset += length_initial_statesi;
00063       }
00064       *(outbuffer + offset + 0) = (this->active_states_length >> (8 * 0)) & 0xFF;
00065       *(outbuffer + offset + 1) = (this->active_states_length >> (8 * 1)) & 0xFF;
00066       *(outbuffer + offset + 2) = (this->active_states_length >> (8 * 2)) & 0xFF;
00067       *(outbuffer + offset + 3) = (this->active_states_length >> (8 * 3)) & 0xFF;
00068       offset += sizeof(this->active_states_length);
00069       for( uint32_t i = 0; i < active_states_length; i++){
00070       uint32_t length_active_statesi = strlen(this->active_states[i]);
00071       varToArr(outbuffer + offset, length_active_statesi);
00072       offset += 4;
00073       memcpy(outbuffer + offset, this->active_states[i], length_active_statesi);
00074       offset += length_active_statesi;
00075       }
00076       uint32_t length_local_data = strlen(this->local_data);
00077       varToArr(outbuffer + offset, length_local_data);
00078       offset += 4;
00079       memcpy(outbuffer + offset, this->local_data, length_local_data);
00080       offset += length_local_data;
00081       uint32_t length_info = strlen(this->info);
00082       varToArr(outbuffer + offset, length_info);
00083       offset += 4;
00084       memcpy(outbuffer + offset, this->info, length_info);
00085       offset += length_info;
00086       return offset;
00087     }
00088 
00089     virtual int deserialize(unsigned char *inbuffer)
00090     {
00091       int offset = 0;
00092       offset += this->header.deserialize(inbuffer + offset);
00093       uint32_t length_path;
00094       arrToVar(length_path, (inbuffer + offset));
00095       offset += 4;
00096       for(unsigned int k= offset; k< offset+length_path; ++k){
00097           inbuffer[k-1]=inbuffer[k];
00098       }
00099       inbuffer[offset+length_path-1]=0;
00100       this->path = (char *)(inbuffer + offset-1);
00101       offset += length_path;
00102       uint32_t initial_states_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00103       initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00104       initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00105       initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00106       offset += sizeof(this->initial_states_length);
00107       if(initial_states_lengthT > initial_states_length)
00108         this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
00109       initial_states_length = initial_states_lengthT;
00110       for( uint32_t i = 0; i < initial_states_length; i++){
00111       uint32_t length_st_initial_states;
00112       arrToVar(length_st_initial_states, (inbuffer + offset));
00113       offset += 4;
00114       for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
00115           inbuffer[k-1]=inbuffer[k];
00116       }
00117       inbuffer[offset+length_st_initial_states-1]=0;
00118       this->st_initial_states = (char *)(inbuffer + offset-1);
00119       offset += length_st_initial_states;
00120         memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
00121       }
00122       uint32_t active_states_lengthT = ((uint32_t) (*(inbuffer + offset))); 
00123       active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 
00124       active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 
00125       active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 
00126       offset += sizeof(this->active_states_length);
00127       if(active_states_lengthT > active_states_length)
00128         this->active_states = (char**)realloc(this->active_states, active_states_lengthT * sizeof(char*));
00129       active_states_length = active_states_lengthT;
00130       for( uint32_t i = 0; i < active_states_length; i++){
00131       uint32_t length_st_active_states;
00132       arrToVar(length_st_active_states, (inbuffer + offset));
00133       offset += 4;
00134       for(unsigned int k= offset; k< offset+length_st_active_states; ++k){
00135           inbuffer[k-1]=inbuffer[k];
00136       }
00137       inbuffer[offset+length_st_active_states-1]=0;
00138       this->st_active_states = (char *)(inbuffer + offset-1);
00139       offset += length_st_active_states;
00140         memcpy( &(this->active_states[i]), &(this->st_active_states), sizeof(char*));
00141       }
00142       uint32_t length_local_data;
00143       arrToVar(length_local_data, (inbuffer + offset));
00144       offset += 4;
00145       for(unsigned int k= offset; k< offset+length_local_data; ++k){
00146           inbuffer[k-1]=inbuffer[k];
00147       }
00148       inbuffer[offset+length_local_data-1]=0;
00149       this->local_data = (char *)(inbuffer + offset-1);
00150       offset += length_local_data;
00151       uint32_t length_info;
00152       arrToVar(length_info, (inbuffer + offset));
00153       offset += 4;
00154       for(unsigned int k= offset; k< offset+length_info; ++k){
00155           inbuffer[k-1]=inbuffer[k];
00156       }
00157       inbuffer[offset+length_info-1]=0;
00158       this->info = (char *)(inbuffer + offset-1);
00159       offset += length_info;
00160      return offset;
00161     }
00162 
00163     const char * getType(){ return "smach_msgs/SmachContainerStatus"; };
00164     const char * getMD5(){ return "5ba2bb79ac19e3842d562a191f2a675b"; };
00165 
00166   };
00167 
00168 }
00169 #endif