Public Member Functions | Protected Attributes
variant_topic_tools::Message Class Reference

Generic message type. More...

#include <Message.h>

List of all members.

Public Member Functions

void deserialize (MessageVariant &variant) const
 Attempt to deserialize this message into a variant.
std::vector< uint8_t > & getData ()
 Retrieve the message data (non-const version)
const std::vector< uint8_t > & getData () const
 Retrieve the message data (const version)
const MessageHeadergetHeader () const
 Retrieve the message header.
size_t getSize () const
 Retrieve the message size.
const MessageTypegetType () const
 Retrieve the message type.
 Message ()
 Default constructor.
template<typename T >
 Message (const T &message, const MessageHeader &header=MessageHeader())
 Constructor (templated version taking a message.
 Message (const Message &src)
 Copy constructor.
template<typename T >
void morph ()
 Morph the message.
template<typename Stream >
void read (Stream &stream)
 Read serialized message contents from stream.
void serialize (const MessageVariant &variant)
 Attempt to serialize this message from a variant.
void setData (const std::vector< uint8_t > &data)
 Set the message data.
void setHeader (const MessageHeader &header)
 Set the message header.
void setSize (size_t size)
 Set the message size.
void setType (const MessageType &type)
 Set the message type.
template<typename T >
boost::shared_ptr< T > toMessage () const
 Attempt to convert the message to a strong-typed message.
boost::shared_ptr
< variant_msgs::Variant > 
toVariantMessage () const
 Attempt to convert the message to a variant message.
template<typename Stream >
void write (Stream &stream) const
 Write serialized message contents to stream.
 ~Message ()
 Destructor.

Protected Attributes

std::vector< uint8_t > data
 The data of this message.
MessageHeader header
 The header of this message.
MessageType type
 The type of this message.

Detailed Description

Generic message type.

This generic message type can be used to subscribe to any topic. It is heavily inspired by the ShapeShifter message type provided in the topic_tools package.

Definition at line 43 of file Message.h.


Constructor & Destructor Documentation

Default constructor.

Definition at line 31 of file Message.cpp.

template<typename T >
variant_topic_tools::Message::Message ( const T &  message,
const MessageHeader header = MessageHeader() 
)

Constructor (templated version taking a message.

Copy constructor.

Definition at line 34 of file Message.cpp.

Destructor.

Definition at line 40 of file Message.cpp.


Member Function Documentation

Attempt to deserialize this message into a variant.

Definition at line 109 of file Message.cpp.

std::vector< uint8_t > & variant_topic_tools::Message::getData ( )

Retrieve the message data (non-const version)

Definition at line 75 of file Message.cpp.

const std::vector< uint8_t > & variant_topic_tools::Message::getData ( ) const

Retrieve the message data (const version)

Definition at line 79 of file Message.cpp.

Retrieve the message header.

Definition at line 55 of file Message.cpp.

Retrieve the message size.

Definition at line 87 of file Message.cpp.

Retrieve the message type.

Definition at line 67 of file Message.cpp.

template<typename T >
void variant_topic_tools::Message::morph ( )

Morph the message.

template<typename Stream >
void variant_topic_tools::Message::read ( Stream &  stream)

Read serialized message contents from stream.

Attempt to serialize this message from a variant.

Definition at line 95 of file Message.cpp.

void variant_topic_tools::Message::setData ( const std::vector< uint8_t > &  data)

Set the message data.

Definition at line 71 of file Message.cpp.

Set the message header.

Note:
This will modify the message type from the fields of the specified header.

Definition at line 47 of file Message.cpp.

Set the message size.

Definition at line 83 of file Message.cpp.

Set the message type.

Note:
This will modify the message header from the members of the specified type.

Definition at line 59 of file Message.cpp.

template<typename T >
boost::shared_ptr<T> variant_topic_tools::Message::toMessage ( ) const

Attempt to convert the message to a strong-typed message.

boost::shared_ptr< variant_msgs::Variant > variant_topic_tools::Message::toVariantMessage ( ) const

Attempt to convert the message to a variant message.

Definition at line 126 of file Message.cpp.

template<typename Stream >
void variant_topic_tools::Message::write ( Stream &  stream) const

Write serialized message contents to stream.


Member Data Documentation

std::vector<uint8_t> variant_topic_tools::Message::data [protected]

The data of this message.

Definition at line 143 of file Message.h.

The header of this message.

Definition at line 135 of file Message.h.

The type of this message.

Definition at line 139 of file Message.h.


The documentation for this class was generated from the following files:


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Fri Aug 5 2016 06:06:27