Go to the documentation of this file.00001 #ifndef _ROS_smach_msgs_SmachContainerInitialStatusCmd_h
00002 #define _ROS_smach_msgs_SmachContainerInitialStatusCmd_h
00003
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008
00009 namespace smach_msgs
00010 {
00011
00012 class SmachContainerInitialStatusCmd : public ros::Msg
00013 {
00014 public:
00015 const char* path;
00016 uint8_t initial_states_length;
00017 char* st_initial_states;
00018 char* * initial_states;
00019 const char* local_data;
00020
00021 virtual int serialize(unsigned char *outbuffer) const
00022 {
00023 int offset = 0;
00024 uint32_t length_path = strlen(this->path);
00025 memcpy(outbuffer + offset, &length_path, sizeof(uint32_t));
00026 offset += 4;
00027 memcpy(outbuffer + offset, this->path, length_path);
00028 offset += length_path;
00029 *(outbuffer + offset++) = initial_states_length;
00030 *(outbuffer + offset++) = 0;
00031 *(outbuffer + offset++) = 0;
00032 *(outbuffer + offset++) = 0;
00033 for( uint8_t i = 0; i < initial_states_length; i++){
00034 uint32_t length_initial_statesi = strlen(this->initial_states[i]);
00035 memcpy(outbuffer + offset, &length_initial_statesi, sizeof(uint32_t));
00036 offset += 4;
00037 memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
00038 offset += length_initial_statesi;
00039 }
00040 uint32_t length_local_data = strlen(this->local_data);
00041 memcpy(outbuffer + offset, &length_local_data, sizeof(uint32_t));
00042 offset += 4;
00043 memcpy(outbuffer + offset, this->local_data, length_local_data);
00044 offset += length_local_data;
00045 return offset;
00046 }
00047
00048 virtual int deserialize(unsigned char *inbuffer)
00049 {
00050 int offset = 0;
00051 uint32_t length_path;
00052 memcpy(&length_path, (inbuffer + offset), sizeof(uint32_t));
00053 offset += 4;
00054 for(unsigned int k= offset; k< offset+length_path; ++k){
00055 inbuffer[k-1]=inbuffer[k];
00056 }
00057 inbuffer[offset+length_path-1]=0;
00058 this->path = (char *)(inbuffer + offset-1);
00059 offset += length_path;
00060 uint8_t initial_states_lengthT = *(inbuffer + offset++);
00061 if(initial_states_lengthT > initial_states_length)
00062 this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
00063 offset += 3;
00064 initial_states_length = initial_states_lengthT;
00065 for( uint8_t i = 0; i < initial_states_length; i++){
00066 uint32_t length_st_initial_states;
00067 memcpy(&length_st_initial_states, (inbuffer + offset), sizeof(uint32_t));
00068 offset += 4;
00069 for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
00070 inbuffer[k-1]=inbuffer[k];
00071 }
00072 inbuffer[offset+length_st_initial_states-1]=0;
00073 this->st_initial_states = (char *)(inbuffer + offset-1);
00074 offset += length_st_initial_states;
00075 memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
00076 }
00077 uint32_t length_local_data;
00078 memcpy(&length_local_data, (inbuffer + offset), sizeof(uint32_t));
00079 offset += 4;
00080 for(unsigned int k= offset; k< offset+length_local_data; ++k){
00081 inbuffer[k-1]=inbuffer[k];
00082 }
00083 inbuffer[offset+length_local_data-1]=0;
00084 this->local_data = (char *)(inbuffer + offset-1);
00085 offset += length_local_data;
00086 return offset;
00087 }
00088
00089 const char * getType(){ return "smach_msgs/SmachContainerInitialStatusCmd"; };
00090 const char * getMD5(){ return "45f8cf31fc29b829db77f23001f788d6"; };
00091
00092 };
00093
00094 }
00095 #endif