modify for Hydro version
Fork of rosserial_mbed_lib by
Diff: dianostic_msgs/DiagnosticArray.h
- Revision:
- 1:ff0ec969dad1
- Parent:
- 0:77afd7560544
- Child:
- 3:1cf99502f396
diff -r 77afd7560544 -r ff0ec969dad1 dianostic_msgs/DiagnosticArray.h --- a/dianostic_msgs/DiagnosticArray.h Fri Aug 19 09:06:30 2011 +0000 +++ b/dianostic_msgs/DiagnosticArray.h Sun Oct 16 07:19:36 2011 +0000 @@ -1,5 +1,5 @@ -#ifndef ros_DiagnosticArray_h -#define ros_DiagnosticArray_h +#ifndef ros_diagnostic_msgs_DiagnosticArray_h +#define ros_diagnostic_msgs_DiagnosticArray_h #include <stdint.h> #include <string.h> @@ -8,50 +8,48 @@ #include "std_msgs/Header.h" #include "diagnostic_msgs/DiagnosticStatus.h" -namespace diagnostic_msgs -{ +namespace diagnostic_msgs { - class DiagnosticArray : public ros::Msg - { - public: - std_msgs::Header header; - unsigned char status_length; - diagnostic_msgs::DiagnosticStatus st_status; - diagnostic_msgs::DiagnosticStatus * status; +class DiagnosticArray : public ros::Msg { +public: + std_msgs::Header header; + unsigned char status_length; + diagnostic_msgs::DiagnosticStatus st_status; + diagnostic_msgs::DiagnosticStatus * status; - virtual int serialize(unsigned char *outbuffer) - { - int offset = 0; - offset += this->header.serialize(outbuffer + offset); - *(outbuffer + offset++) = status_length; - *(outbuffer + offset++) = 0; - *(outbuffer + offset++) = 0; - *(outbuffer + offset++) = 0; - for( unsigned char i = 0; i < status_length; i++){ - offset += this->status[i].serialize(outbuffer + offset); - } - return offset; + virtual int serialize(unsigned char *outbuffer) { + int offset = 0; + offset += this->header.serialize(outbuffer + offset); + *(outbuffer + offset++) = status_length; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + *(outbuffer + offset++) = 0; + for ( unsigned char i = 0; i < status_length; i++) { + offset += this->status[i].serialize(outbuffer + offset); + } + return offset; } - virtual int deserialize(unsigned char *inbuffer) - { - int offset = 0; - offset += this->header.deserialize(inbuffer + offset); - unsigned char status_lengthT = *(inbuffer + offset++); - if(status_lengthT > status_length) - this->status = (diagnostic_msgs::DiagnosticStatus*)realloc(this->status, status_lengthT * sizeof(diagnostic_msgs::DiagnosticStatus)); - offset += 3; - status_length = status_lengthT; - for( unsigned char i = 0; i < status_length; i++){ - offset += this->st_status.deserialize(inbuffer + offset); - memcpy( &(this->status[i]), &(this->st_status), sizeof(diagnostic_msgs::DiagnosticStatus)); - } - return offset; + virtual int deserialize(unsigned char *inbuffer) { + int offset = 0; + offset += this->header.deserialize(inbuffer + offset); + unsigned char status_lengthT = *(inbuffer + offset++); + if (status_lengthT > status_length) + this->status = (diagnostic_msgs::DiagnosticStatus*)realloc(this->status, status_lengthT * sizeof(diagnostic_msgs::DiagnosticStatus)); + offset += 3; + status_length = status_lengthT; + for ( unsigned char i = 0; i < status_length; i++) { + offset += this->st_status.deserialize(inbuffer + offset); + memcpy( &(this->status[i]), &(this->st_status), sizeof(diagnostic_msgs::DiagnosticStatus)); + } + return offset; } - virtual const char * getType(){ return "diagnostic_msgs/DiagnosticArray"; }; + virtual const char * getType() { + return "diagnostic_msgs/DiagnosticArray"; + }; - }; +}; } #endif \ No newline at end of file