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