Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
variant_topic_tools::MessageField< T > Class Template Reference

Forward declaration of the message field. More...

#include <Forwards.h>

Inheritance diagram for variant_topic_tools::MessageField< T >:
Inheritance graph
[legend]

Public Member Functions

void clear ()
 Clear the message field. More...
 
const std::string & getName () const
 Retrieve the name of the message field. More...
 
T & getValue ()
 Retrieve the value of the message field (non-const version) More...
 
const T & getValue () const
 Retrieve the value of the message field (const version) More...
 
bool isValid () const
 True, if this message field is valid. More...
 
 MessageField (const std::string &name=std::string(), const T &value=T())
 Default constructor. More...
 
 MessageField (const MessageField< T > &src)
 Copy constructor. More...
 
bool operator!= (const MessageField< T > &field) const
 True, if this message field is not equal to another message field. More...
 
bool operator== (const MessageField< T > &field) const
 True, if this message field is equal to another message field. More...
 
void setName (const std::string &name)
 Set the name of the message field. More...
 
void setValue (const T &value)
 Set the value of the message field. More...
 
void write (std::ostream &stream, const std::string &indent=std::string()) const
 Write the message field to a stream. More...
 
virtual ~MessageField ()
 Destructor. More...
 
- Public Member Functions inherited from variant_topic_tools::MessageFieldCollection< T >
void appendField (const MessageField< T > &field)
 Append a field to the message field collection. More...
 
void appendField (const std::string &name, const T &value=T())
 Append a field to the message field collection (overloaded version taking a field name and a field value) More...
 
MessageField< T > & getField (int index)
 Retrieve a field of the message field collection by index (non-const version) More...
 
const MessageField< T > & getField (int index) const
 Retrieve a field of the message field collection by index (const version) More...
 
MessageField< T > & getField (const std::string &name)
 Retrieve a field of the message field collection by name (non-const version) More...
 
const MessageField< T > & 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< T > &collection)
 Merge this message field collection with another message field collection. More...
 
 MessageFieldCollection ()
 Default constructor. More...
 
 MessageFieldCollection (const MessageFieldCollection< T > &src)
 Copy constructor. More...
 
bool operator!= (const MessageFieldCollection< T > &collection) const
 True, if this message field collection is not equal to another message field collection. More...
 
MessageFieldCollection< T > & operator+= (const MessageField< T > &field)
 Operator for appending a field to the message field collection. More...
 
bool operator== (const MessageFieldCollection< T > &collection) const
 True, if this message field collection is equal to another message field collection. More...
 
MessageField< T > & operator[] (int index)
 Operator for retrieving the fields of the message field collection by index (non-const version) More...
 
const MessageField< T > & operator[] (int index) const
 Operator for retrieving the fields of the message field collection by index (const version) More...
 
MessageField< T > & operator[] (const std::string &name)
 Operator for retrieving the fields of the message field collection by name (non-const version) More...
 
const MessageField< T > & operator[] (const std::string &name) const
 Operator for retrieving the fields of the message field collection by name (const version) More...
 
virtual ~MessageFieldCollection ()
 Destructor. More...
 

Static Protected Member Functions

template<typename U >
static bool isValid (const U &value, typename boost::enable_if_c< MessageFieldTypeTraits::HasIsValid< U >::value >::type *=0)
 True, if the message field is valid (overloaded version taking a field value which can be validated) More...
 
template<typename U >
static bool isValid (const U &value, typename boost::disable_if_c< MessageFieldTypeTraits::HasIsValid< U >::value >::type *=0)
 True, if the message field is valid (overloaded version taking a field value which cannot be validated) More...
 
template<typename U >
static void writeValue (std::ostream &stream, const U &value, typename boost::enable_if< boost::has_left_shift< std::ostream, const U & > >::type *=0)
 Write a message field value to a stream (overloaded version taking a stream-writable value) More...
 
template<typename U >
static void writeValue (std::ostream &stream, const U &value, typename boost::disable_if< boost::has_left_shift< std::ostream, const U & > >::type *=0)
 Write a message field value to a stream (overloaded version taking a non-stream-writable value) More...
 

Protected Attributes

std::string name
 The name of this message field. More...
 
value
 The value of this message field. More...
 
- Protected Attributes inherited from variant_topic_tools::MessageFieldCollection< T >
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< T >
typedef boost::shared_ptr< MessageField< T > > MessageFieldPtr
 Declaration of the message field pointer type. More...
 
typedef boost::weak_ptr< MessageField< T > > MessageFieldWPtr
 Declaration of the message field weak pointer type. More...
 
- Protected Member Functions inherited from variant_topic_tools::MessageFieldCollection< T >
MessageField< T > & 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...
 

Detailed Description

template<typename T>
class variant_topic_tools::MessageField< T >

Forward declaration of the message field.

Message field template.

Definition at line 68 of file Forwards.h.

Constructor & Destructor Documentation

template<typename T>
variant_topic_tools::MessageField< T >::MessageField ( const std::string &  name = std::string(),
const T &  value = T() 
)

Default constructor.

template<typename T>
variant_topic_tools::MessageField< T >::MessageField ( const MessageField< T > &  src)

Copy constructor.

template<typename T>
virtual variant_topic_tools::MessageField< T >::~MessageField ( )
virtual

Destructor.

Member Function Documentation

template<typename T>
void variant_topic_tools::MessageField< T >::clear ( )
virtual

Clear the message field.

Reimplemented from variant_topic_tools::MessageFieldCollection< T >.

template<typename T>
const std::string& variant_topic_tools::MessageField< T >::getName ( ) const

Retrieve the name of the message field.

template<typename T>
T& variant_topic_tools::MessageField< T >::getValue ( )

Retrieve the value of the message field (non-const version)

template<typename T>
const T& variant_topic_tools::MessageField< T >::getValue ( ) const

Retrieve the value of the message field (const version)

template<typename T>
bool variant_topic_tools::MessageField< T >::isValid ( ) const

True, if this message field is valid.

template<typename T>
template<typename U >
static bool variant_topic_tools::MessageField< T >::isValid ( const U &  value,
typename boost::enable_if_c< MessageFieldTypeTraits::HasIsValid< U >::value >::type *  = 0 
)
staticprotected

True, if the message field is valid (overloaded version taking a field value which can be validated)

template<typename T>
template<typename U >
static bool variant_topic_tools::MessageField< T >::isValid ( const U &  value,
typename boost::disable_if_c< MessageFieldTypeTraits::HasIsValid< U >::value >::type *  = 0 
)
staticprotected

True, if the message field is valid (overloaded version taking a field value which cannot be validated)

template<typename T>
bool variant_topic_tools::MessageField< T >::operator!= ( const MessageField< T > &  field) const

True, if this message field is not equal to another message field.

template<typename T>
bool variant_topic_tools::MessageField< T >::operator== ( const MessageField< T > &  field) const

True, if this message field is equal to another message field.

template<typename T>
void variant_topic_tools::MessageField< T >::setName ( const std::string &  name)

Set the name of the message field.

template<typename T>
void variant_topic_tools::MessageField< T >::setValue ( const T &  value)

Set the value of the message field.

template<typename T>
void variant_topic_tools::MessageField< T >::write ( std::ostream &  stream,
const std::string &  indent = std::string() 
) const
virtual

Write the message field to a stream.

Reimplemented from variant_topic_tools::MessageFieldCollection< T >.

template<typename T>
template<typename U >
static void variant_topic_tools::MessageField< T >::writeValue ( std::ostream &  stream,
const U &  value,
typename boost::enable_if< boost::has_left_shift< std::ostream, const U & > >::type *  = 0 
)
staticprotected

Write a message field value to a stream (overloaded version taking a stream-writable value)

template<typename T>
template<typename U >
static void variant_topic_tools::MessageField< T >::writeValue ( std::ostream &  stream,
const U &  value,
typename boost::disable_if< boost::has_left_shift< std::ostream, const U & > >::type *  = 0 
)
staticprotected

Write a message field value to a stream (overloaded version taking a non-stream-writable value)

Member Data Documentation

template<typename T>
std::string variant_topic_tools::MessageField< T >::name
protected

The name of this message field.

Definition at line 98 of file MessageField.h.

template<typename T>
T variant_topic_tools::MessageField< T >::value
protected

The value of this message field.

Definition at line 102 of file MessageField.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