hairo
Dependencies: mbed BufferedSerial
gazebo_msgs/ContactsState.h
- Committer:
- tknara
- Date:
- 2018-12-04
- Revision:
- 4:bcdd99711326
- Parent:
- 0:9e9b7db60fd5
File content as of revision 4:bcdd99711326:
#ifndef _ROS_gazebo_msgs_ContactsState_h #define _ROS_gazebo_msgs_ContactsState_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" #include "std_msgs/Header.h" #include "gazebo_msgs/ContactState.h" namespace gazebo_msgs { class ContactsState : public ros::Msg { public: typedef std_msgs::Header _header_type; _header_type header; uint32_t states_length; typedef gazebo_msgs::ContactState _states_type; _states_type st_states; _states_type * states; ContactsState(): header(), states_length(0), states(NULL) { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; offset += this->header.serialize(outbuffer + offset); *(outbuffer + offset + 0) = (this->states_length >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->states_length >> (8 * 1)) & 0xFF; *(outbuffer + offset + 2) = (this->states_length >> (8 * 2)) & 0xFF; *(outbuffer + offset + 3) = (this->states_length >> (8 * 3)) & 0xFF; offset += sizeof(this->states_length); for( uint32_t i = 0; i < states_length; i++){ offset += this->states[i].serialize(outbuffer + offset); } return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; offset += this->header.deserialize(inbuffer + offset); uint32_t states_lengthT = ((uint32_t) (*(inbuffer + offset))); states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); offset += sizeof(this->states_length); if(states_lengthT > states_length) this->states = (gazebo_msgs::ContactState*)realloc(this->states, states_lengthT * sizeof(gazebo_msgs::ContactState)); states_length = states_lengthT; for( uint32_t i = 0; i < states_length; i++){ offset += this->st_states.deserialize(inbuffer + offset); memcpy( &(this->states[i]), &(this->st_states), sizeof(gazebo_msgs::ContactState)); } return offset; } const char * getType(){ return "gazebo_msgs/ContactsState"; }; const char * getMD5(){ return "acbcb1601a8e525bf72509f18e6f668d"; }; }; } #endif