Log.h
Go to the documentation of this file.
00001 #ifndef _ROS_rosgraph_msgs_Log_h
00002 #define _ROS_rosgraph_msgs_Log_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 
00010 namespace rosgraph_msgs
00011 {
00012 
00013   class Log : public ros::Msg
00014   {
00015     public:
00016       std_msgs::Header header;
00017       int8_t level;
00018       const char* name;
00019       const char* msg;
00020       const char* file;
00021       const char* function;
00022       uint32_t line;
00023       uint8_t topics_length;
00024       char* st_topics;
00025       char* * topics;
00026       enum { DEBUG = 1  };
00027       enum { INFO = 2   };
00028       enum { WARN = 4   };
00029       enum { ERROR = 8  };
00030       enum { FATAL = 16  };
00031 
00032     virtual int serialize(unsigned char *outbuffer) const
00033     {
00034       int offset = 0;
00035       offset += this->header.serialize(outbuffer + offset);
00036       union {
00037         int8_t real;
00038         uint8_t base;
00039       } u_level;
00040       u_level.real = this->level;
00041       *(outbuffer + offset + 0) = (u_level.base >> (8 * 0)) & 0xFF;
00042       offset += sizeof(this->level);
00043       uint32_t length_name = strlen(this->name);
00044       memcpy(outbuffer + offset, &length_name, sizeof(uint32_t));
00045       offset += 4;
00046       memcpy(outbuffer + offset, this->name, length_name);
00047       offset += length_name;
00048       uint32_t length_msg = strlen(this->msg);
00049       memcpy(outbuffer + offset, &length_msg, sizeof(uint32_t));
00050       offset += 4;
00051       memcpy(outbuffer + offset, this->msg, length_msg);
00052       offset += length_msg;
00053       uint32_t length_file = strlen(this->file);
00054       memcpy(outbuffer + offset, &length_file, sizeof(uint32_t));
00055       offset += 4;
00056       memcpy(outbuffer + offset, this->file, length_file);
00057       offset += length_file;
00058       uint32_t length_function = strlen(this->function);
00059       memcpy(outbuffer + offset, &length_function, sizeof(uint32_t));
00060       offset += 4;
00061       memcpy(outbuffer + offset, this->function, length_function);
00062       offset += length_function;
00063       *(outbuffer + offset + 0) = (this->line >> (8 * 0)) & 0xFF;
00064       *(outbuffer + offset + 1) = (this->line >> (8 * 1)) & 0xFF;
00065       *(outbuffer + offset + 2) = (this->line >> (8 * 2)) & 0xFF;
00066       *(outbuffer + offset + 3) = (this->line >> (8 * 3)) & 0xFF;
00067       offset += sizeof(this->line);
00068       *(outbuffer + offset++) = topics_length;
00069       *(outbuffer + offset++) = 0;
00070       *(outbuffer + offset++) = 0;
00071       *(outbuffer + offset++) = 0;
00072       for( uint8_t i = 0; i < topics_length; i++){
00073       uint32_t length_topicsi = strlen(this->topics[i]);
00074       memcpy(outbuffer + offset, &length_topicsi, sizeof(uint32_t));
00075       offset += 4;
00076       memcpy(outbuffer + offset, this->topics[i], length_topicsi);
00077       offset += length_topicsi;
00078       }
00079       return offset;
00080     }
00081 
00082     virtual int deserialize(unsigned char *inbuffer)
00083     {
00084       int offset = 0;
00085       offset += this->header.deserialize(inbuffer + offset);
00086       union {
00087         int8_t real;
00088         uint8_t base;
00089       } u_level;
00090       u_level.base = 0;
00091       u_level.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00092       this->level = u_level.real;
00093       offset += sizeof(this->level);
00094       uint32_t length_name;
00095       memcpy(&length_name, (inbuffer + offset), sizeof(uint32_t));
00096       offset += 4;
00097       for(unsigned int k= offset; k< offset+length_name; ++k){
00098           inbuffer[k-1]=inbuffer[k];
00099       }
00100       inbuffer[offset+length_name-1]=0;
00101       this->name = (char *)(inbuffer + offset-1);
00102       offset += length_name;
00103       uint32_t length_msg;
00104       memcpy(&length_msg, (inbuffer + offset), sizeof(uint32_t));
00105       offset += 4;
00106       for(unsigned int k= offset; k< offset+length_msg; ++k){
00107           inbuffer[k-1]=inbuffer[k];
00108       }
00109       inbuffer[offset+length_msg-1]=0;
00110       this->msg = (char *)(inbuffer + offset-1);
00111       offset += length_msg;
00112       uint32_t length_file;
00113       memcpy(&length_file, (inbuffer + offset), sizeof(uint32_t));
00114       offset += 4;
00115       for(unsigned int k= offset; k< offset+length_file; ++k){
00116           inbuffer[k-1]=inbuffer[k];
00117       }
00118       inbuffer[offset+length_file-1]=0;
00119       this->file = (char *)(inbuffer + offset-1);
00120       offset += length_file;
00121       uint32_t length_function;
00122       memcpy(&length_function, (inbuffer + offset), sizeof(uint32_t));
00123       offset += 4;
00124       for(unsigned int k= offset; k< offset+length_function; ++k){
00125           inbuffer[k-1]=inbuffer[k];
00126       }
00127       inbuffer[offset+length_function-1]=0;
00128       this->function = (char *)(inbuffer + offset-1);
00129       offset += length_function;
00130       this->line =  ((uint32_t) (*(inbuffer + offset)));
00131       this->line |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00132       this->line |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00133       this->line |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00134       offset += sizeof(this->line);
00135       uint8_t topics_lengthT = *(inbuffer + offset++);
00136       if(topics_lengthT > topics_length)
00137         this->topics = (char**)realloc(this->topics, topics_lengthT * sizeof(char*));
00138       offset += 3;
00139       topics_length = topics_lengthT;
00140       for( uint8_t i = 0; i < topics_length; i++){
00141       uint32_t length_st_topics;
00142       memcpy(&length_st_topics, (inbuffer + offset), sizeof(uint32_t));
00143       offset += 4;
00144       for(unsigned int k= offset; k< offset+length_st_topics; ++k){
00145           inbuffer[k-1]=inbuffer[k];
00146       }
00147       inbuffer[offset+length_st_topics-1]=0;
00148       this->st_topics = (char *)(inbuffer + offset-1);
00149       offset += length_st_topics;
00150         memcpy( &(this->topics[i]), &(this->st_topics), sizeof(char*));
00151       }
00152      return offset;
00153     }
00154 
00155     const char * getType(){ return "rosgraph_msgs/Log"; };
00156     const char * getMD5(){ return "acffd30cd6b6de30f120938c17c593fb"; };
00157 
00158   };
00159 
00160 }
00161 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:49