1 #ifndef _ROS_SERVICE_RequestParam_h 2 #define _ROS_SERVICE_RequestParam_h 18 virtual int serialize(
unsigned char *outbuffer)
const 21 uint32_t length_name = strlen(this->name);
22 memcpy(outbuffer + offset, &length_name,
sizeof(uint32_t));
24 memcpy(outbuffer + offset, this->name, length_name);
25 offset += length_name;
33 memcpy(&length_name, (inbuffer + offset),
sizeof(uint32_t));
35 for(
unsigned int k= offset; k< offset+length_name; ++k){
36 inbuffer[k-1]=inbuffer[k];
38 inbuffer[offset+length_name-1]=0;
39 this->name = (
char *)(inbuffer + offset-1);
40 offset += length_name;
45 const char *
getMD5(){
return "c1f3d28f1b044c871e6eff2e9fc3c667"; };
62 virtual int serialize(
unsigned char *outbuffer)
const 65 *(outbuffer + offset++) = ints_length;
66 *(outbuffer + offset++) = 0;
67 *(outbuffer + offset++) = 0;
68 *(outbuffer + offset++) = 0;
69 for( uint8_t i = 0; i < ints_length; i++){
74 u_intsi.real = this->ints[i];
75 *(outbuffer + offset + 0) = (u_intsi.base >> (8 * 0)) & 0xFF;
76 *(outbuffer + offset + 1) = (u_intsi.base >> (8 * 1)) & 0xFF;
77 *(outbuffer + offset + 2) = (u_intsi.base >> (8 * 2)) & 0xFF;
78 *(outbuffer + offset + 3) = (u_intsi.base >> (8 * 3)) & 0xFF;
79 offset +=
sizeof(this->ints[i]);
81 *(outbuffer + offset++) = floats_length;
82 *(outbuffer + offset++) = 0;
83 *(outbuffer + offset++) = 0;
84 *(outbuffer + offset++) = 0;
85 for( uint8_t i = 0; i < floats_length; i++){
90 u_floatsi.real = this->floats[i];
91 *(outbuffer + offset + 0) = (u_floatsi.base >> (8 * 0)) & 0xFF;
92 *(outbuffer + offset + 1) = (u_floatsi.base >> (8 * 1)) & 0xFF;
93 *(outbuffer + offset + 2) = (u_floatsi.base >> (8 * 2)) & 0xFF;
94 *(outbuffer + offset + 3) = (u_floatsi.base >> (8 * 3)) & 0xFF;
95 offset +=
sizeof(this->floats[i]);
97 *(outbuffer + offset++) = strings_length;
98 *(outbuffer + offset++) = 0;
99 *(outbuffer + offset++) = 0;
100 *(outbuffer + offset++) = 0;
101 for( uint8_t i = 0; i < strings_length; i++){
102 uint32_t length_stringsi = strlen(this->strings[i]);
103 memcpy(outbuffer + offset, &length_stringsi,
sizeof(uint32_t));
105 memcpy(outbuffer + offset, this->strings[i], length_stringsi);
106 offset += length_stringsi;
114 uint8_t ints_lengthT = *(inbuffer + offset++);
115 if(ints_lengthT > ints_length)
116 this->ints = (int32_t*)realloc(this->ints, ints_lengthT *
sizeof(int32_t));
118 ints_length = ints_lengthT;
119 for( uint8_t i = 0; i < ints_length; i++){
125 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
126 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
127 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
128 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
129 this->st_ints = u_st_ints.real;
130 offset +=
sizeof(this->st_ints);
131 memcpy( &(this->ints[i]), &(this->st_ints),
sizeof(int32_t));
133 uint8_t floats_lengthT = *(inbuffer + offset++);
134 if(floats_lengthT > floats_length)
135 this->floats = (
float*)realloc(this->floats, floats_lengthT *
sizeof(
float));
137 floats_length = floats_lengthT;
138 for( uint8_t i = 0; i < floats_length; i++){
143 u_st_floats.base = 0;
144 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
145 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
146 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
147 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
148 this->st_floats = u_st_floats.real;
149 offset +=
sizeof(this->st_floats);
150 memcpy( &(this->floats[i]), &(this->st_floats),
sizeof(
float));
152 uint8_t strings_lengthT = *(inbuffer + offset++);
153 if(strings_lengthT > strings_length)
154 this->strings = (
char**)realloc(this->strings, strings_lengthT *
sizeof(
char*));
156 strings_length = strings_lengthT;
157 for( uint8_t i = 0; i < strings_length; i++){
158 uint32_t length_st_strings;
159 memcpy(&length_st_strings, (inbuffer + offset),
sizeof(uint32_t));
161 for(
unsigned int k= offset; k< offset+length_st_strings; ++k){
162 inbuffer[k-1]=inbuffer[k];
164 inbuffer[offset+length_st_strings-1]=0;
165 this->st_strings = (
char *)(inbuffer + offset-1);
166 offset += length_st_strings;
167 memcpy( &(this->strings[i]), &(this->st_strings),
sizeof(
char*));
173 const char *
getMD5(){
return "9f0e98bda65981986ddf53afa7a40e49"; };
virtual int serialize(unsigned char *outbuffer) const
static const char REQUESTPARAM[]
RequestParamResponse Response
virtual int deserialize(unsigned char *inbuffer)
RequestParamRequest Request
virtual int serialize(unsigned char *outbuffer) const
virtual int deserialize(unsigned char *inbuffer)