12 #include <mrpt/core/Clock.h> 13 #include <mrpt/system/COutputLogger.h> 19 #include <shared_mutex> 22 #if defined(MVSIM_HAS_ZMQ) && defined(MVSIM_HAS_PROTOBUF) 24 #include "AdvertiseServiceRequest.pb.h" 25 #include "AdvertiseTopicRequest.pb.h" 26 #include "GetServiceInfoRequest.pb.h" 27 #include "ListNodesRequest.pb.h" 28 #include "ListTopicsRequest.pb.h" 29 #include "RegisterNodeRequest.pb.h" 30 #include "SubscribeRequest.pb.h" 31 #include "UnregisterNodeRequest.pb.h" 60 class Server :
public mrpt::system::COutputLogger
87 #if defined(MVSIM_HAS_ZMQ) && defined(MVSIM_HAS_PROTOBUF) 88 void handle(
const mvsim_msgs::RegisterNodeRequest&
m, zmq::socket_t&
s);
89 void handle(
const mvsim_msgs::UnregisterNodeRequest&
m, zmq::socket_t&
s);
90 void handle(
const mvsim_msgs::SubscribeRequest&
m, zmq::socket_t&
s);
91 void handle(
const mvsim_msgs::ListTopicsRequest&
m, zmq::socket_t&
s);
92 void handle(
const mvsim_msgs::ListNodesRequest&
m, zmq::socket_t&
s);
93 void handle(
const mvsim_msgs::AdvertiseTopicRequest&
m, zmq::socket_t&
s);
94 void handle(
const mvsim_msgs::AdvertiseServiceRequest&
m, zmq::socket_t&
s);
95 void handle(
const mvsim_msgs::GetServiceInfoRequest&
m, zmq::socket_t&
s);
113 const std::string& topicName,
const std::string& topicTypeName,
114 const std::string& publisherEndpoint,
const std::string& nodeName);
118 const std::string& serviceName,
const std::string& inputTypeName,
119 const std::string& outputTypeName,
const std::string& publisherEndpoint,
120 const std::string& nodeName);
124 const std::string& serviceName, std::string& publisherEndpoint,
125 std::string& nodeName)
const;
128 const std::string& topicName,
const std::string& updatesEndPoint);
150 const std::string& topic_name,
151 const std::string& publisher_node_name,
152 const std::string& publisher_endpoint)
153 : topicName(topic_name),
154 publisherNodeName(publisher_node_name),
155 publisherEndpoint(publisher_endpoint)
166 const std::string& topic_name,
167 const std::string& sub_updates_endpoint)
168 : topicName(topic_name),
169 subscriberUpdatesEndpoint(sub_updates_endpoint)
180 const std::string&
name,
const std::string& topic_type_name)
181 : topicName(name), topicTypeName(topic_type_name)
196 const std::string&
name,
const std::string& in_type_name,
197 const std::string& out_type_name,
const std::string& end_point,
198 const std::string& node_name)
200 inputTypeName(in_type_name),
201 outputTypeName(out_type_name),
const std::string nodeName
void db_advertise_topic(const std::string &topicName, const std::string &topicTypeName, const std::string &publisherEndpoint, const std::string &nodeName)
std::set< std::string > subscribedTopics
const std::string topicName
std::map< node_name_t, InfoPerNode > connectedNodes_
InfoPerNode(const std::string &name)
InfoPerService(const std::string &name, const std::string &in_type_name, const std::string &out_type_name, const std::string &end_point, const std::string &node_name)
void db_advertise_service(const std::string &serviceName, const std::string &inputTypeName, const std::string &outputTypeName, const std::string &publisherEndpoint, const std::string &nodeName)
const endpoint_t subscriberUpdatesEndpoint
const mrpt::Clock::time_point timeConnected
std::string service_name_t
mrpt::system::TTimeStamp now()
std::map< service_name_t, InfoPerService > knownServices_
void internalServerThread()
void db_remove_node(const std::string &nodeName)
std::shared_mutex dbMutex
InfoPerTopic(const std::string &name, const std::string &topic_type_name)
void listenningPort(unsigned int port)
InfoPerSubscriber(const std::string &topic_name, const std::string &sub_updates_endpoint)
unsigned int listenningPort() const
std::map< node_name_t, InfoPerPublisher > publishers
const std::string publisherNodeName
std::atomic< zmq::context_t * > mainThreadZMQcontext_
GLuint const GLchar * name
std::map< topic_name_t, InfoPerTopic > knownTopics_
void requestMainThreadTermination()
bool db_get_service_info(const std::string &serviceName, std::string &publisherEndpoint, std::string &nodeName) const
std::set< std::string > advertisedTopics
unsigned int serverPortNo_
void db_add_topic_subscriber(const std::string &topicName, const std::string &updatesEndPoint)
constexpr unsigned int MVSIM_PORTNO_MAIN_REP
const endpoint_t publisherEndpoint
void db_register_node(const std::string &nodeName)
std::string topicTypeName
std::map< endpoint_t, InfoPerSubscriber > subscribers
const std::string topicName
InfoPerPublisher(const std::string &topic_name, const std::string &publisher_node_name, const std::string &publisher_endpoint)