5 #include <boost/shared_ptr.hpp> 6 #include <boost/asio.hpp> 7 #include <boost/make_shared.hpp> 8 #include <boost/any.hpp> 9 #include <boost/system/error_code.hpp> 10 #include <boost/function.hpp> 11 #include <boost/enable_shared_from_this.hpp> 12 #include <boost/chrono.hpp> 13 #include <boost/asio/waitable_timer_service.hpp> 14 #include <boost/thread.hpp> 37 typedef boost::asio::basic_waitable_timer<boost::chrono::steady_clock>
steady_timer;
44 class DpyMwServer:
public boost::enable_shared_from_this<DpyMwServer>
58 boost::asio::io_service publisherIo;
64 boost::shared_ptr<DpyMwPublisher> m_publisher;
65 boost::shared_ptr<DpyMwRouter> m_router;
66 int lastPublisherID = 0;
67 std::map<int, Global_config> m_map_publishers;
77 boost::asio::io_service&
mIo;
86 void sendResponse(
int messageType, std::string content,
const std::string& id_dealer,
int msgId, boost::system::error_code &ec);
87 void sendPublication(
int messageType, std::string content, boost::system::error_code &ec);
102 explicit DpyMwServer(boost::asio::io_service& io,
int rport,
int pport);
106 void publish(
int messageType,
int frecuency);
109 void router_handler(
const std::string &
id,
const std::string &payload);
110 void publisherTimer_handler(
const boost::system::error_code& e);
111 void heartbeatTimer_handler(
const boost::system::error_code& e);
std::map< uint64_t, f_proto_message_server > map_proto_register_server
Map to keep functions with a type of message associated.
Definition: dpyMwServer.h:35
virtual void RegisterPublications()=0
boost::function< void(const std::string &, const std::string &, int)> f_proto_message_server
Lambda function to be called depending on the message received.
Definition: dpyMwServer.h:28
boost::asio::basic_waitable_timer< boost::chrono::steady_clock > steady_timer
Typedef to use a steady timer.
Definition: dpyMwClient.h:52
Router class.
Definition: dpyMwRouter.h:26
Manages router and publisher.
Definition: dpyMwServer.h:44
map_proto_register_server m_publisher_map
Definition: dpyMwServer.h:85
boost::asio::io_service & mIo
Definition: dpyMwServer.h:77
virtual void RegisterCallbacks()=0
map_proto_register_server m_register_map
Definition: dpyMwServer.h:81
std::mutex m_map_mutex
Definition: dpyMwServer.h:99
Publisher class.
Definition: dpyMwPublisher.h:27
boost::asio::basic_waitable_timer< boost::chrono::steady_clock > steady_timer
Typedef to use a steady timer.
Definition: dpyMwServer.h:37