17 #ifndef GZ_MSGS_CONVERT_DISCOVERYTYPE_HH_
18 #define GZ_MSGS_CONVERT_DISCOVERYTYPE_HH_
21 #include "gz/msgs/discovery.pb.h"
28 inline namespace GZ_MSGS_VERSION_NAMESPACE {
33 msgs::Discovery::Type result = msgs::Discovery::UNINITIALIZED;
35 if (_str ==
"UNINITIALIZED")
37 result = msgs::Discovery::UNINITIALIZED;
39 else if (_str ==
"ADVERTISE")
41 result = msgs::Discovery::ADVERTISE;
43 else if (_str ==
"SUBSCRIBE")
45 result = msgs::Discovery::SUBSCRIBE;
47 else if (_str ==
"UNADVERTISE")
49 result = msgs::Discovery::UNADVERTISE;
51 else if (_str ==
"HEARTBEAT")
53 result = msgs::Discovery::HEARTBEAT;
55 else if (_str ==
"BYE")
57 result = msgs::Discovery::BYE;
59 else if (_str ==
"NEW_CONNECTION")
61 result = msgs::Discovery::NEW_CONNECTION;
63 else if (_str ==
"END_CONNECTION")
65 result = msgs::Discovery::END_CONNECTION;
67 else if (_str ==
"SUBSCRIBERS_REQ")
69 result = msgs::Discovery::SUBSCRIBERS_REQ;
71 else if (_str ==
"SUBSCRIBERS_REP")
73 result = msgs::Discovery::SUBSCRIBERS_REP;
77 std::cerr <<
"Unrecognized DiscoveryType["
79 <<
"], returning msgs::Discovery::UNINITIALIZED"
91 case msgs::Discovery::UNINITIALIZED:
92 return "UNINITIALIZED";
93 case msgs::Discovery::ADVERTISE:
95 case msgs::Discovery::SUBSCRIBE:
97 case msgs::Discovery::UNADVERTISE:
99 case msgs::Discovery::HEARTBEAT:
101 case msgs::Discovery::BYE:
103 case msgs::Discovery::NEW_CONNECTION:
104 return "NEW_CONNECTION";
105 case msgs::Discovery::END_CONNECTION:
106 return "END_CONNECTION";
107 case msgs::Discovery::SUBSCRIBERS_REQ:
108 return "SUBSCRIBERS_REQ";
109 case msgs::Discovery::SUBSCRIBERS_REP:
110 return "SUBSCRIBERS_REP";