Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
variant_topic_tools::MessageDefinition Class Reference

Message definition. More...

#include <MessageDefinition.h>

Inheritance diagram for variant_topic_tools::MessageDefinition:
Inheritance graph
[legend]

Public Member Functions

void clear ()
 Clear the message definition. More...
 
MessageDataType getMessageDataType () const
 Retrieve the message data type represented by this message definition. More...
 
bool isValid () const
 True, if this message definition is valid. More...
 
void load (const std::string &messageDataType)
 Attempt to load the message definition for the specified message data type. More...
 
 MessageDefinition ()
 Default constructor. More...
 
 MessageDefinition (const MessageType &messageType)
 Constructor (overloaded version accepting a message type) More...
 
 MessageDefinition (const MessageDataType &messageDataType)
 Constructor (overloaded version accepting a message data type) More...
 
 MessageDefinition (const MessageDefinition &src)
 Copy constructor. More...
 
void setMessageDataType (const MessageDataType &messageDataType)
 Set the message data type represented by this message definition. More...
 
void setMessageType (const MessageType &messageType)
 Set the message type represented by this message definition. More...
 
template<typename T >
void setMessageType ()
 Set the message type represented by this message definition (templated version) More...
 
void write (std::ostream &stream) const
 Write the message definition to a stream. More...
 
 ~MessageDefinition ()
 Destructor. More...
 
- Public Member Functions inherited from variant_topic_tools::MessageFieldCollection< DataType >
void appendField (const MessageField< DataType > &field)
 Append a field to the message field collection. More...
 
void appendField (const std::string &name, const DataType &value=DataType())
 Append a field to the message field collection (overloaded version taking a field name and a field value) More...
 
MessageField< DataType > & getField (int index)
 Retrieve a field of the message field collection by index (non-const version) More...
 
const MessageField< DataType > & getField (int index) const
 Retrieve a field of the message field collection by index (const version) More...
 
MessageField< DataType > & getField (const std::string &name)
 Retrieve a field of the message field collection by name (non-const version) More...
 
const MessageField< DataType > & getField (const std::string &name) const
 Retrieve a field of the message field collection by name (const version) More...
 
size_t getNumFields () const
 Retrieve the number of fields of the message field collection. More...
 
bool hasField (const std::string &name) const
 True, if the message field collection contains the field with the specified name. More...
 
bool isEmpty () const
 True, if the message field collections is empty. More...
 
void merge (const MessageFieldCollection< DataType > &collection)
 Merge this message field collection with another message field collection. More...
 
 MessageFieldCollection ()
 Default constructor. More...
 
 MessageFieldCollection (const MessageFieldCollection< DataType > &src)
 Copy constructor. More...
 
bool operator!= (const MessageFieldCollection< DataType > &collection) const
 True, if this message field collection is not equal to another message field collection. More...
 
MessageFieldCollection< DataType > & operator+= (const MessageField< DataType > &field)
 Operator for appending a field to the message field collection. More...
 
bool operator== (const MessageFieldCollection< DataType > &collection) const
 True, if this message field collection is equal to another message field collection. More...
 
MessageField< DataType > & operator[] (int index)
 Operator for retrieving the fields of the message field collection by index (non-const version) More...
 
const MessageField< DataType > & operator[] (int index) const
 Operator for retrieving the fields of the message field collection by index (const version) More...
 
MessageField< DataType > & operator[] (const std::string &name)
 Operator for retrieving the fields of the message field collection by name (non-const version) More...
 
const MessageField< DataType > & operator[] (const std::string &name) const
 Operator for retrieving the fields of the message field collection by name (const version) More...
 
virtual void write (std::ostream &stream, const std::string &indent=std::string()) const
 Write the message field collection to a stream. More...
 
virtual ~MessageFieldCollection ()
 Destructor. More...
 

Static Public Member Functions

template<typename T >
static MessageDefinition create ()
 Create a message definition. More...
 

Protected Member Functions

void fill (const MessageDataType &currentDataType, MessageFieldCollection< DataType > &currentCollection)
 Recursively fill the fields of the message definition. More...
 
- Protected Member Functions inherited from variant_topic_tools::MessageFieldCollection< DataType >
MessageField< DataType > & getField (const std::string &name, size_t pos) const
 Recursively retrieve a field of the message field collection by name. More...
 
bool hasField (const std::string &name, size_t pos) const
 True, if the message field collection or any of its fields contains the field with the specified name. More...
 

Protected Attributes

DataType messageDataType
 The message data type represented by this message definition. More...
 
- Protected Attributes inherited from variant_topic_tools::MessageFieldCollection< DataType >
boost::unordered_map< std::string, MessageFieldPtrfieldsByName
 The message fields of the collection by name. More...
 
std::vector< MessageFieldPtrfieldsInOrder
 The message fields of the collection in order. More...
 

Additional Inherited Members

- Protected Types inherited from variant_topic_tools::MessageFieldCollection< DataType >
typedef boost::shared_ptr< MessageField< DataType > > MessageFieldPtr
 Declaration of the message field pointer type. More...
 
typedef boost::weak_ptr< MessageField< DataType > > MessageFieldWPtr
 Declaration of the message field weak pointer type. More...
 

Detailed Description

Message definition.

Definition at line 41 of file MessageDefinition.h.

Constructor & Destructor Documentation

variant_topic_tools::MessageDefinition::MessageDefinition ( )

Default constructor.

Definition at line 37 of file MessageDefinition.cpp.

variant_topic_tools::MessageDefinition::MessageDefinition ( const MessageType messageType)

Constructor (overloaded version accepting a message type)

Definition at line 40 of file MessageDefinition.cpp.

variant_topic_tools::MessageDefinition::MessageDefinition ( const MessageDataType messageDataType)

Constructor (overloaded version accepting a message data type)

Definition at line 44 of file MessageDefinition.cpp.

variant_topic_tools::MessageDefinition::MessageDefinition ( const MessageDefinition src)

Copy constructor.

Definition at line 48 of file MessageDefinition.cpp.

variant_topic_tools::MessageDefinition::~MessageDefinition ( )

Destructor.

Definition at line 53 of file MessageDefinition.cpp.

Member Function Documentation

void variant_topic_tools::MessageDefinition::clear ( )
virtual

Clear the message definition.

Reimplemented from variant_topic_tools::MessageFieldCollection< DataType >.

Definition at line 178 of file MessageDefinition.cpp.

template<typename T >
static MessageDefinition variant_topic_tools::MessageDefinition::create ( )
static

Create a message definition.

void variant_topic_tools::MessageDefinition::fill ( const MessageDataType currentDataType,
MessageFieldCollection< DataType > &  currentCollection 
)
protected

Recursively fill the fields of the message definition.

Definition at line 183 of file MessageDefinition.cpp.

MessageDataType variant_topic_tools::MessageDefinition::getMessageDataType ( ) const

Retrieve the message data type represented by this message definition.

Definition at line 157 of file MessageDefinition.cpp.

bool variant_topic_tools::MessageDefinition::isValid ( ) const

True, if this message definition is valid.

Definition at line 161 of file MessageDefinition.cpp.

void variant_topic_tools::MessageDefinition::load ( const std::string &  messageDataType)

Attempt to load the message definition for the specified message data type.

Definition at line 169 of file MessageDefinition.cpp.

void variant_topic_tools::MessageDefinition::setMessageDataType ( const MessageDataType messageDataType)

Set the message data type represented by this message definition.

Definition at line 152 of file MessageDefinition.cpp.

void variant_topic_tools::MessageDefinition::setMessageType ( const MessageType messageType)

Set the message type represented by this message definition.

Definition at line 60 of file MessageDefinition.cpp.

template<typename T >
void variant_topic_tools::MessageDefinition::setMessageType ( )

Set the message type represented by this message definition (templated version)

void variant_topic_tools::MessageDefinition::write ( std::ostream &  stream) const

Write the message definition to a stream.

Definition at line 194 of file MessageDefinition.cpp.

Member Data Documentation

DataType variant_topic_tools::MessageDefinition::messageDataType
protected

The message data type represented by this message definition.

Definition at line 109 of file MessageDefinition.h.


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


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:50