Gazebo Msgs

API Reference

9.5.1

A factory that generates protobuf message based on a string type. This class will also try to load all Protobuf descriptors specified in the GZ_DESCRIPTOR_PATH environment variable on program start. More...

#include <gz/msgs.hh>

Static Public Member Functions

static void LoadDescriptors (const std::string &_paths)
 Load a collection of descriptor .desc files. More...
 
template<typename T >
static std::unique_ptr< T > New (const std::string &_msgType)
 Create a new instance of a message. More...
 
static std::unique_ptr< google::protobuf::Message > New (const std::string &_msgType)
 Create a new instance of a message. More...
 
template<typename T >
static std::unique_ptr< T > New (const std::string &_msgType, const std::string &_args)
 Create a new instance of a message. More...
 
static std::unique_ptr< google::protobuf::Message > New (const std::string &_msgType, const std::string &_args)
 Create a new instance of a message. More...
 
static void Register (const std::string &_msgType, FactoryFn _factoryfn)
 Register a message. More...
 
static void Types (std::vector< std::string > &_types)
 Get all the message types. More...
 

Detailed Description

A factory that generates protobuf message based on a string type. This class will also try to load all Protobuf descriptors specified in the GZ_DESCRIPTOR_PATH environment variable on program start.

Member Function Documentation

◆ LoadDescriptors()

static void LoadDescriptors ( const std::string _paths)
static

Load a collection of descriptor .desc files.

Parameters
[in]_pathsA set of directories containing .desc decriptor files. Each directory should be separated by ":".

◆ New() [1/4]

static std::unique_ptr<T> New ( const std::string _msgType)
inlinestatic

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.

References std::endl(), and string::replace().

Referenced by Factory::New().

◆ New() [2/4]

static std::unique_ptr<google::protobuf::Message> New ( 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.

◆ New() [3/4]

static std::unique_ptr<T> New ( const std::string _msgType,
const std::string _args 
)
inlinestatic

Create a new instance of a message.

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

References std::endl(), Factory::New(), and string::replace().

◆ New() [4/4]

static std::unique_ptr<google::protobuf::Message> New ( const std::string _msgType,
const std::string _args 
)
static

Create a new instance of a message.

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

◆ Register()

static void Register ( const std::string _msgType,
FactoryFn  _factoryfn 
)
static

Register a message.

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

◆ Types()

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

Get all the message types.

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

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