Message field template. More...
#include <MessageField.h>
Public Member Functions | |
void | clear () |
Clear the message field. | |
const std::string & | getName () const |
Retrieve the name of the message field. | |
T & | getValue () |
Retrieve the value of the message field (non-const version) | |
const T & | getValue () const |
Retrieve the value of the message field (const version) | |
bool | isValid () const |
True, if this message field is valid. | |
MessageField (const std::string &name=std::string(), const T &value=T()) | |
Default constructor. | |
MessageField (const MessageField< T > &src) | |
Copy constructor. | |
bool | operator!= (const MessageField< T > &field) const |
True, if this message field is not equal to another message field. | |
bool | operator== (const MessageField< T > &field) const |
True, if this message field is equal to another message field. | |
void | setName (const std::string &name) |
Set the name of the message field. | |
void | setValue (const T &value) |
Set the value of the message field. | |
void | write (std::ostream &stream, const std::string &indent=std::string()) const |
Write the message field to a stream. | |
virtual | ~MessageField () |
Destructor. | |
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) | |
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) | |
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) | |
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) | |
Protected Attributes | |
std::string | name |
The name of this message field. | |
T | value |
The value of this message field. |
Message field template.
Definition at line 37 of file MessageField.h.
variant_topic_tools::MessageField< T >::MessageField | ( | const std::string & | name = std::string() , |
const T & | value = T() |
||
) |
Default constructor.
variant_topic_tools::MessageField< T >::MessageField | ( | const MessageField< T > & | src | ) |
Copy constructor.
virtual variant_topic_tools::MessageField< T >::~MessageField | ( | ) | [virtual] |
Destructor.
void variant_topic_tools::MessageField< T >::clear | ( | ) | [virtual] |
Clear the message field.
Reimplemented from variant_topic_tools::MessageFieldCollection< T >.
const std::string& variant_topic_tools::MessageField< T >::getName | ( | ) | const |
Retrieve the name of the message field.
T& variant_topic_tools::MessageField< T >::getValue | ( | ) |
Retrieve the value of the message field (non-const version)
const T& variant_topic_tools::MessageField< T >::getValue | ( | ) | const |
Retrieve the value of the message field (const version)
bool variant_topic_tools::MessageField< T >::isValid | ( | ) | const |
True, if this message field is valid.
static bool variant_topic_tools::MessageField< T >::isValid | ( | const U & | value, |
typename boost::enable_if_c< MessageFieldTypeTraits::HasIsValid< U >::value >::type * | = 0 |
||
) | [static, protected] |
True, if the message field is valid (overloaded version taking a field value which can be validated)
static bool variant_topic_tools::MessageField< T >::isValid | ( | const U & | value, |
typename boost::disable_if_c< MessageFieldTypeTraits::HasIsValid< U >::value >::type * | = 0 |
||
) | [static, protected] |
True, if the message field is valid (overloaded version taking a field value which cannot be validated)
bool variant_topic_tools::MessageField< T >::operator!= | ( | const MessageField< T > & | field | ) | const |
True, if this message field is not equal to another message field.
bool variant_topic_tools::MessageField< T >::operator== | ( | const MessageField< T > & | field | ) | const |
True, if this message field is equal to another message field.
void variant_topic_tools::MessageField< T >::setName | ( | const std::string & | name | ) |
Set the name of the message field.
void variant_topic_tools::MessageField< T >::setValue | ( | const T & | value | ) |
Set the value of the message field.
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 >.
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 |
||
) | [static, protected] |
Write a message field value to a stream (overloaded version taking a stream-writable value)
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 |
||
) | [static, protected] |
Write a message field value to a stream (overloaded version taking a non-stream-writable value)
std::string variant_topic_tools::MessageField< T >::name [protected] |
The name of this message field.
Definition at line 98 of file MessageField.h.
T variant_topic_tools::MessageField< T >::value [protected] |
The value of this message field.
Definition at line 102 of file MessageField.h.