make changes on buffer serial

Dependencies:   BufferedSerial

Dependents:  

Revision:
0:04ac6be8229a
diff -r 000000000000 -r 04ac6be8229a gazebo_msgs/ContactsState.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gazebo_msgs/ContactsState.h	Fri Nov 08 14:38:09 2019 -0300
@@ -0,0 +1,70 @@
+#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