OpenDaVINCI  4.15.3
odcore::reflection::Message Class Reference

#include <Message.h>

Inheritance diagram for odcore::reflection::Message:
Inheritance graph

Public Member Functions

 Message ()
 
 Message (const Message &obj)
 
virtual ~Message ()
 
Messageoperator= (const Message &obj)
 
virtual void accept (odcore::base::Visitor &v)
 
virtual int32_t getID () const
 
virtual const string getShortName () const
 
virtual const string getLongName () const
 
virtual const string toString () const
 
void setID (const int32_t &id)
 
void setShortName (const string &sn)
 
void setLongName (const string &ln)
 
void insertField (const std::shared_ptr< odcore::data::reflection::AbstractField > &f)
 
void addField (const std::shared_ptr< odcore::data::reflection::AbstractField > &f)
 
uint32_t getNumberOfFields () const
 
std::shared_ptr
< odcore::data::reflection::AbstractField
getFieldByIdentifier (const uint32_t &id, bool &found)
 
template<typename T >
getValueFromScalarField (const uint32_t &id, bool &found, bool &extracted)
 

Detailed Description

This class is a generic Message representation.

Constructor & Destructor Documentation

odcore::reflection::Message::Message ( )
odcore::reflection::Message::Message ( const Message obj)

Copy constructor.

Parameters
objReference to an object of this class.
odcore::reflection::Message::~Message ( )
virtual

Member Function Documentation

void odcore::reflection::Message::addField ( const std::shared_ptr< odcore::data::reflection::AbstractField > &  f)

This method adds a field to this generic message representation at the end of the list of fields.

Parameters
Fieldto be added.

Referenced by odcore::reflection::MessageFromVisitableVisitor::visit().

std::shared_ptr< odcore::data::reflection::AbstractField > odcore::reflection::Message::getFieldByIdentifier ( const uint32_t &  id,
bool &  found 
)

This method tries to find a field with the given identifier.

Parameters
IDto find.
foundFlag modified by this method indicating if the field was found.
Returns
found Be aware to always check 'found' whether the field was found.

Referenced by odcore::reflection::MessageToVisitableVisitor::visit().

int32_t odcore::reflection::Message::getID ( ) const
virtual

This method returns the message ID.

Returns
Message identifier.

Implements odcore::data::SerializableData.

Referenced by accept().

const string odcore::reflection::Message::getLongName ( ) const
virtual

This method returns the message name including namespace.

Returns
Message name including namespace.

Implements odcore::data::SerializableData.

Referenced by accept(), and toString().

uint32_t odcore::reflection::Message::getNumberOfFields ( ) const

This method returns the number of fields.

Returns
The number of fields in this message.
const string odcore::reflection::Message::getShortName ( ) const
virtual

This method returns the message name.

Returns
Message name.

Implements odcore::data::SerializableData.

Referenced by accept().

template<typename T >
T odcore::reflection::Message::getValueFromScalarField ( const uint32_t &  id,
bool &  found,
bool &  extracted 
)
inline

This method tries to extract the specified scalar type from AbstractField.

Parameters
idto find.
foundFlag modified by this method indicating if the field was found.
extractedFlag modified by this method indicating if the field was successfully extracted.
Returns
Extracted value.

References odcore::INT16_T, odcore::INT32_T, odcore::INT64_T, odcore::INT8_T, odcore::UINT16_T, odcore::UINT32_T, odcore::UINT64_T, and odcore::UINT8_T.

void odcore::reflection::Message::insertField ( const std::shared_ptr< odcore::data::reflection::AbstractField > &  f)

This method inserts a field to this generic message representation at the beginning of the list of fields.

Parameters
Fieldto be added.
Message & odcore::reflection::Message::operator= ( const Message obj)

Assignment operator.

Parameters
objReference to an object of this class.
Returns
Reference to this instance.
void odcore::reflection::Message::setID ( const int32_t &  id)
void odcore::reflection::Message::setLongName ( const string &  ln)
void odcore::reflection::Message::setShortName ( const string &  sn)
const string odcore::reflection::Message::toString ( ) const
virtual

This method returns a human readable format of the contained data.

Returns
Human readable representation.

Implements odcore::data::SerializableData.

References getLongName().