1 #ifndef _ROS_SERVICE_RequestParam_h
2 #define _ROS_SERVICE_RequestParam_h
8 namespace rosserial_msgs
23 virtual int serialize(
unsigned char *outbuffer)
const
26 uint32_t length_name = strlen(this->
name);
27 memcpy(outbuffer + offset, &length_name,
sizeof(uint32_t));
29 memcpy(outbuffer + offset, this->
name, length_name);
30 offset += length_name;
38 memcpy(&length_name, (inbuffer + offset),
sizeof(uint32_t));
40 for(
unsigned int k= offset; k< offset+length_name; ++k){
41 inbuffer[k-1]=inbuffer[k];
43 inbuffer[offset+length_name-1]=0;
44 this->
name = (
char *)(inbuffer + offset-1);
45 offset += length_name;
50 const char *
getMD5(){
return "c1f3d28f1b044c871e6eff2e9fc3c667"; };
74 virtual int serialize(
unsigned char *outbuffer)
const
78 *(outbuffer + offset++) = 0;
79 *(outbuffer + offset++) = 0;
80 *(outbuffer + offset++) = 0;
86 u_intsi.real = this->
ints[i];
87 *(outbuffer + offset + 0) = (u_intsi.base >> (8 * 0)) & 0xFF;
88 *(outbuffer + offset + 1) = (u_intsi.base >> (8 * 1)) & 0xFF;
89 *(outbuffer + offset + 2) = (u_intsi.base >> (8 * 2)) & 0xFF;
90 *(outbuffer + offset + 3) = (u_intsi.base >> (8 * 3)) & 0xFF;
91 offset +=
sizeof(this->
ints[i]);
94 *(outbuffer + offset++) = 0;
95 *(outbuffer + offset++) = 0;
96 *(outbuffer + offset++) = 0;
102 u_floatsi.real = this->
floats[i];
103 *(outbuffer + offset + 0) = (u_floatsi.base >> (8 * 0)) & 0xFF;
104 *(outbuffer + offset + 1) = (u_floatsi.base >> (8 * 1)) & 0xFF;
105 *(outbuffer + offset + 2) = (u_floatsi.base >> (8 * 2)) & 0xFF;
106 *(outbuffer + offset + 3) = (u_floatsi.base >> (8 * 3)) & 0xFF;
107 offset +=
sizeof(this->
floats[i]);
110 *(outbuffer + offset++) = 0;
111 *(outbuffer + offset++) = 0;
112 *(outbuffer + offset++) = 0;
114 uint32_t length_stringsi = strlen(this->
strings[i]);
115 memcpy(outbuffer + offset, &length_stringsi,
sizeof(uint32_t));
117 memcpy(outbuffer + offset, this->
strings[i], length_stringsi);
118 offset += length_stringsi;
126 uint8_t ints_lengthT = *(inbuffer + offset++);
128 this->
ints = (int32_t*)realloc(this->
ints, ints_lengthT *
sizeof(int32_t));
137 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
138 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
139 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
140 u_st_ints.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
141 this->
st_ints = u_st_ints.real;
142 offset +=
sizeof(this->
st_ints);
143 memcpy( &(this->
ints[i]), &(this->
st_ints),
sizeof(int32_t));
145 uint8_t floats_lengthT = *(inbuffer + offset++);
147 this->
floats = (
float*)realloc(this->
floats, floats_lengthT *
sizeof(
float));
155 u_st_floats.base = 0;
156 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0);
157 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
158 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
159 u_st_floats.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
164 uint8_t strings_lengthT = *(inbuffer + offset++);
166 this->
strings = (
char**)realloc(this->
strings, strings_lengthT *
sizeof(
char*));
170 uint32_t length_st_strings;
171 memcpy(&length_st_strings, (inbuffer + offset),
sizeof(uint32_t));
173 for(
unsigned int k= offset; k< offset+length_st_strings; ++k){
174 inbuffer[k-1]=inbuffer[k];
176 inbuffer[offset+length_st_strings-1]=0;
177 this->
st_strings = (
char *)(inbuffer + offset-1);
178 offset += length_st_strings;
185 const char *
getMD5(){
return "9f0e98bda65981986ddf53afa7a40e49"; };
virtual int serialize(unsigned char *outbuffer) const
Definition: RequestParam.h:74
float st_floats
Definition: RequestParam.h:61
RequestParamResponse()
Definition: RequestParam.h:67
RequestParamResponse Response
Definition: RequestParam.h:192
Definition: RequestParam.h:189
uint8_t strings_length
Definition: RequestParam.h:63
virtual int serialize(unsigned char *outbuffer) const
Definition: RequestParam.h:23
char ** strings
Definition: RequestParam.h:65
virtual int deserialize(unsigned char *inbuffer)
Definition: RequestParam.h:123
const char * getType()
Definition: RequestParam.h:184
RequestParamRequest()
Definition: RequestParam.h:18
int32_t * ints
Definition: RequestParam.h:59
virtual int deserialize(unsigned char *inbuffer)
Definition: RequestParam.h:34
const char * getMD5()
Definition: RequestParam.h:50
float * floats
Definition: RequestParam.h:62
static const char REQUESTPARAM[]
Definition: RequestParam.h:11
int32_t st_ints
Definition: RequestParam.h:58
char * st_strings
Definition: RequestParam.h:64
Definition: RequestParam.h:13
RequestParamRequest Request
Definition: RequestParam.h:191
const char * name
Definition: RequestParam.h:16
uint8_t floats_length
Definition: RequestParam.h:60
uint8_t ints_length
Definition: RequestParam.h:57
Definition: RequestParam.h:54
const char * getType()
Definition: RequestParam.h:49
const char * getMD5()
Definition: RequestParam.h:185