MsgFactory Class Reference

A factory that generates protobuf message based on a string type. More...

#include <msgs/msgs.hh>

Static Public Member Functions

static void GetMsgTypes (std::vector< std::string > &_types)
 Get all the message types. More...
 
static boost::shared_ptr< google::protobuf::Message > NewMsg (const std::string &_msgType)
 Create a new instance of a message. More...
 
static void RegisterMsg (const std::string &_msgType, MsgFactoryFn _factoryfn)
 Register a message. More...
 

Detailed Description

A factory that generates protobuf message based on a string type.

Member Function Documentation

§ GetMsgTypes()

static void GetMsgTypes ( std::vector< std::string > &  _types)
static

Get all the message types.

Parameters
[out]_typesVector of strings of the message types.

§ NewMsg()

static boost::shared_ptr<google::protobuf::Message> NewMsg ( const std::string &  _msgType)
static

Create a new instance of a message.

Parameters
[in]_msgTypeType of message to create.
Returns
Pointer to a google protobuf message. Null if the message type could not be handled.

§ RegisterMsg()

static void RegisterMsg ( const std::string &  _msgType,
MsgFactoryFn  _factoryfn 
)
static

Register a message.

Parameters
[in]_msgTypeType of message to register.
[in]_factoryfnFunction that generates the message.

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