ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

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       std_msgs::Header header;
00017       const char* path;
00018       uint8_t initial_states_length;
00019       char* st_initial_states;
00020       char* * initial_states;
00021       uint8_t active_states_length;
00022       char* st_active_states;
00023       char* * active_states;
00024       const char* local_data;
00025       const char* info;
00026 
00027     SmachContainerStatus():
00028       header(),
00029       path(""),
00030       initial_states_length(0), initial_states(NULL),
00031       active_states_length(0), active_states(NULL),
00032       local_data(""),
00033       info("")
00034     {
00035     }
00036 
00037     virtual int serialize(unsigned char *outbuffer) const
00038     {
00039       int offset = 0;
00040       offset += this->header.serialize(outbuffer + offset);
00041       uint32_t length_path = strlen(this->path);
00042       memcpy(outbuffer + offset, &length_path, sizeof(uint32_t));
00043       offset += 4;
00044       memcpy(outbuffer + offset, this->path, length_path);
00045       offset += length_path;
00046       *(outbuffer + offset++) = initial_states_length;
00047       *(outbuffer + offset++) = 0;
00048       *(outbuffer + offset++) = 0;
00049       *(outbuffer + offset++) = 0;
00050       for( uint8_t i = 0; i < initial_states_length; i++){
00051       uint32_t length_initial_statesi = strlen(this->initial_states[i]);
00052       memcpy(outbuffer + offset, &length_initial_statesi, sizeof(uint32_t));
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
00055       offset += length_initial_statesi;
00056       }
00057       *(outbuffer + offset++) = active_states_length;
00058       *(outbuffer + offset++) = 0;
00059       *(outbuffer + offset++) = 0;
00060       *(outbuffer + offset++) = 0;
00061       for( uint8_t i = 0; i < active_states_length; i++){
00062       uint32_t length_active_statesi = strlen(this->active_states[i]);
00063       memcpy(outbuffer + offset, &length_active_statesi, sizeof(uint32_t));
00064       offset += 4;
00065       memcpy(outbuffer + offset, this->active_states[i], length_active_statesi);
00066       offset += length_active_statesi;
00067       }
00068       uint32_t length_local_data = strlen(this->local_data);
00069       memcpy(outbuffer + offset, &length_local_data, sizeof(uint32_t));
00070       offset += 4;
00071       memcpy(outbuffer + offset, this->local_data, length_local_data);
00072       offset += length_local_data;
00073       uint32_t length_info = strlen(this->info);
00074       memcpy(outbuffer + offset, &length_info, sizeof(uint32_t));
00075       offset += 4;
00076       memcpy(outbuffer + offset, this->info, length_info);
00077       offset += length_info;
00078       return offset;
00079     }
00080 
00081     virtual int deserialize(unsigned char *inbuffer)
00082     {
00083       int offset = 0;
00084       offset += this->header.deserialize(inbuffer + offset);
00085       uint32_t length_path;
00086       memcpy(&length_path, (inbuffer + offset), sizeof(uint32_t));
00087       offset += 4;
00088       for(unsigned int k= offset; k< offset+length_path; ++k){
00089           inbuffer[k-1]=inbuffer[k];
00090       }
00091       inbuffer[offset+length_path-1]=0;
00092       this->path = (char *)(inbuffer + offset-1);
00093       offset += length_path;
00094       uint8_t initial_states_lengthT = *(inbuffer + offset++);
00095       if(initial_states_lengthT > initial_states_length)
00096         this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
00097       offset += 3;
00098       initial_states_length = initial_states_lengthT;
00099       for( uint8_t i = 0; i < initial_states_length; i++){
00100       uint32_t length_st_initial_states;
00101       memcpy(&length_st_initial_states, (inbuffer + offset), sizeof(uint32_t));
00102       offset += 4;
00103       for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
00104           inbuffer[k-1]=inbuffer[k];
00105       }
00106       inbuffer[offset+length_st_initial_states-1]=0;
00107       this->st_initial_states = (char *)(inbuffer + offset-1);
00108       offset += length_st_initial_states;
00109         memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
00110       }
00111       uint8_t active_states_lengthT = *(inbuffer + offset++);
00112       if(active_states_lengthT > active_states_length)
00113         this->active_states = (char**)realloc(this->active_states, active_states_lengthT * sizeof(char*));
00114       offset += 3;
00115       active_states_length = active_states_lengthT;
00116       for( uint8_t i = 0; i < active_states_length; i++){
00117       uint32_t length_st_active_states;
00118       memcpy(&length_st_active_states, (inbuffer + offset), sizeof(uint32_t));
00119       offset += 4;
00120       for(unsigned int k= offset; k< offset+length_st_active_states; ++k){
00121           inbuffer[k-1]=inbuffer[k];
00122       }
00123       inbuffer[offset+length_st_active_states-1]=0;
00124       this->st_active_states = (char *)(inbuffer + offset-1);
00125       offset += length_st_active_states;
00126         memcpy( &(this->active_states[i]), &(this->st_active_states), sizeof(char*));
00127       }
00128       uint32_t length_local_data;
00129       memcpy(&length_local_data, (inbuffer + offset), sizeof(uint32_t));
00130       offset += 4;
00131       for(unsigned int k= offset; k< offset+length_local_data; ++k){
00132           inbuffer[k-1]=inbuffer[k];
00133       }
00134       inbuffer[offset+length_local_data-1]=0;
00135       this->local_data = (char *)(inbuffer + offset-1);
00136       offset += length_local_data;
00137       uint32_t length_info;
00138       memcpy(&length_info, (inbuffer + offset), sizeof(uint32_t));
00139       offset += 4;
00140       for(unsigned int k= offset; k< offset+length_info; ++k){
00141           inbuffer[k-1]=inbuffer[k];
00142       }
00143       inbuffer[offset+length_info-1]=0;
00144       this->info = (char *)(inbuffer + offset-1);
00145       offset += length_info;
00146      return offset;
00147     }
00148 
00149     const char * getType(){ return "smach_msgs/SmachContainerStatus"; };
00150     const char * getMD5(){ return "5ba2bb79ac19e3842d562a191f2a675b"; };
00151 
00152   };
00153 
00154 }
00155 #endif