18#ifndef GAZEBO_MSGS_MSGFACTORY_HH_
19#define GAZEBO_MSGS_MSGFACTORY_HH_
24#include <google/protobuf/message.h>
25#include <boost/shared_ptr.hpp>
34 typedef boost::shared_ptr<google::protobuf::Message> (*
MsgFactoryFn) ();
47 MsgFactoryFn _factoryfn);
53 public:
static boost::shared_ptr<google::protobuf::Message>
NewMsg(
54 const std::string &_msgType);
58 public:
static void GetMsgTypes(std::vector<std::string> &_types);
61 private:
static std::map<std::string, MsgFactoryFn> *msgMap;
70 #define GZ_REGISTER_STATIC_MSG(_msgtype, _classname) \
72 boost::shared_ptr<google::protobuf::Message> New##_classname() \
74 return boost::shared_ptr<gazebo::msgs::_classname>(\
75 new gazebo::msgs::_classname); \
77 class GAZEBO_VISIBLE Msg##_classname \
79 public: Msg##_classname() \
81 gazebo::msgs::MsgFactory::RegisterMsg(_msgtype, New##_classname);\
84 static Msg##_classname GzMsgInitializer;
A factory that generates protobuf message based on a string type.
Definition MsgFactory.hh:42
static void RegisterMsg(const std::string &_msgType, MsgFactoryFn _factoryfn)
Register a message.
static boost::shared_ptr< google::protobuf::Message > NewMsg(const std::string &_msgType)
Create a new instance of a message.
static void GetMsgTypes(std::vector< std::string > &_types)
Get all the message types.
boost::shared_ptr< google::protobuf::Message >(* MsgFactoryFn)()
Definition MsgFactory.hh:34
Forward declarations for the common classes.
Definition Animation.hh:27
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition system.hh:59