ignition/msgs/Factory.hh File Reference
#include <google/protobuf/message.h>
#include <string>
#include <map>
#include <memory>
#include <vector>
#include "ignition/msgs/config.hh"
#include "ignition/msgs/Export.hh"
Go to the source code of this file.
Classes | |
class | Factory |
A factory that generates protobuf message based on a string type. This class will also try to load all Protobuf descriptors specified in the IGN_DESCRIPTOR_PATH environment variable on program start. More... | |
Namespaces | |
ignition | |
ignition::msgs | |
Macros | |
#define | IGN_REGISTER_STATIC_MSG(_msgtype, _classname) |
Static message registration macro. More... | |
Typedefs | |
typedef std::unique_ptr< google::protobuf::Message >(* | FactoryFn) () |
Prototype for message factory generation. More... | |
Macro Definition Documentation
◆ IGN_REGISTER_STATIC_MSG
#define IGN_REGISTER_STATIC_MSG | ( | _msgtype, | |
_classname | |||
) |
Value:
\
std::unique_ptr<google::protobuf::Message> New##_classname() \
{ \
new ignition::msgs::_classname); \
} \
class IgnMsg##_classname \
{ \
public: IgnMsg##_classname() \
{ \
ignition::msgs::Factory::Register(_msgtype, New##_classname);\
} \
}; \
static IgnMsg##_classname IgnitionMessagesInitializer;
Static message registration macro.
Use this macro to register messages.
- Parameters
-
[in] _msgtype Message type name. [in] _classname Class name for message.
static void Register(const std::string &_msgType, FactoryFn _factoryfn)
Register a message.
STL class.