gz/msgs/Factory.hh File Reference
#include <google/protobuf/message.h>
#include <string>
#include <map>
#include <memory>
#include <vector>
#include "gz/msgs/config.hh"
#include "gz/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 GZ_DESCRIPTOR_PATH environment variable on program start. More... | |
Namespaces | |
gz | |
gz::msgs | |
Macros | |
#define | GZ_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
◆ GZ_REGISTER_STATIC_MSG
#define GZ_REGISTER_STATIC_MSG | ( | _msgtype, | |
_classname | |||
) |
Value:
\
std::unique_ptr<google::protobuf::Message> New##_classname() \
{ \
return std::unique_ptr<_classname>(\
new _classname); \
} \
class GzMsg##_classname \
{ \
public: GzMsg##_classname() \
{ \
Factory::Register(_msgtype, New##_classname);\
} \
}; \
static GzMsg##_classname GzMessagesInitializer##_classname;
Static message registration macro.
Use this macro to register messages.
- Parameters
-
[in] _msgtype Message type name. [in] _classname Class name for message.