Log.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016  
00017 
00018 #ifndef _ROS_rosserial_msgs_Log_h
00019 #define _ROS_rosserial_msgs_Log_h
00020 
00021 #include <stdint.h>
00022 #include <string.h>
00023 #include <stdlib.h>
00024 #include "ros/msg.h"
00025 
00026 namespace rosserial_msgs
00027 {
00028 
00029   class Log : public ros::Msg
00030   {
00031     public:
00032       uint8_t level;
00033       const char* msg;
00034       enum { ROSDEBUG = 0 };
00035       enum { INFO = 1 };
00036       enum { WARN = 2 };
00037       enum { ERROR = 3 };
00038       enum { FATAL = 4 };
00039 
00040     Log():
00041       level(0),
00042       msg("")
00043     {
00044     }
00045 
00046     virtual int serialize(unsigned char *outbuffer) const
00047     {
00048       int offset = 0;
00049       *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF;
00050       offset += sizeof(this->level);
00051       uint32_t length_msg = strlen(this->msg);
00052       memcpy(outbuffer + offset, &length_msg, sizeof(uint32_t));
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->msg, length_msg);
00055       offset += length_msg;
00056       return offset;
00057     }
00058 
00059     virtual int deserialize(unsigned char *inbuffer)
00060     {
00061       int offset = 0;
00062       this->level =  ((uint8_t) (*(inbuffer + offset)));
00063       offset += sizeof(this->level);
00064       uint32_t length_msg;
00065       memcpy(&length_msg, (inbuffer + offset), sizeof(uint32_t));
00066       offset += 4;
00067       for(unsigned int k= offset; k< offset+length_msg; ++k){
00068           inbuffer[k-1]=inbuffer[k];
00069       }
00070       inbuffer[offset+length_msg-1]=0;
00071       this->msg = (char *)(inbuffer + offset-1);
00072       offset += length_msg;
00073      return offset;
00074     }
00075 
00076     const char * getType(){ return "rosserial_msgs/Log"; };
00077     const char * getMD5(){ return "11abd731c25933261cd6183bd12d6295"; };
00078 
00079   };
00080 
00081 }
00082 #endif


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Thu Jun 6 2019 20:43:57