00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROSCPP_MESSAGE_H
00029 #define ROSCPP_MESSAGE_H
00030
00031 #include "ros/macros.h"
00032 #include "ros/assert.h"
00033 #include <string>
00034 #include <string.h>
00035 #include <boost/shared_ptr.hpp>
00036 #include <boost/array.hpp>
00037 #include <stdint.h>
00038
00039 #define ROSCPP_MESSAGE_HAS_DEFINITION
00040
00041 namespace ros
00042 {
00043
00044 typedef std::map<std::string, std::string> M_string;
00045
00049 class Message
00050 {
00051 public:
00052 typedef boost::shared_ptr<Message> Ptr;
00053 typedef boost::shared_ptr<Message const> ConstPtr;
00054 Message()
00055 {
00056 }
00057 virtual ~Message()
00058 {
00059 }
00060 virtual const std::string __getDataType() const = 0;
00061 virtual const std::string __getMD5Sum() const = 0;
00062 virtual const std::string __getMessageDefinition() const = 0;
00063 inline static std::string __s_getDataType() { ROS_BREAK(); return std::string(""); }
00064 inline static std::string __s_getMD5Sum() { ROS_BREAK(); return std::string(""); }
00065 inline static std::string __s_getMessageDefinition() { ROS_BREAK(); return std::string(""); }
00066 virtual uint32_t serializationLength() const = 0;
00067 virtual uint8_t *serialize(uint8_t *write_ptr, uint32_t seq) const = 0;
00068 virtual uint8_t *deserialize(uint8_t *read_ptr) = 0;
00069 uint32_t __serialized_length;
00070
00071 boost::shared_ptr<M_string> __connection_header;
00072 };
00073
00074 typedef boost::shared_ptr<Message> MessagePtr;
00075 typedef boost::shared_ptr<Message const> MessageConstPtr;
00076
00077 #define SROS_SERIALIZE_PRIMITIVE(ptr, data) { memcpy(ptr, &data, sizeof(data)); ptr += sizeof(data); }
00078 #define SROS_SERIALIZE_BUFFER(ptr, data, data_size) { if (data_size > 0) { memcpy(ptr, data, data_size); ptr += data_size; } }
00079 #define SROS_DESERIALIZE_PRIMITIVE(ptr, data) { memcpy(&data, ptr, sizeof(data)); ptr += sizeof(data); }
00080 #define SROS_DESERIALIZE_BUFFER(ptr, data, data_size) { if (data_size > 0) { memcpy(data, ptr, data_size); ptr += data_size; } }
00081
00082 }
00083
00084 #endif
00085