9 #ifndef RAD_TOPIC_SUB_HPP
10 #define RAD_TOPIC_SUB_HPP
12 #include <rad/topicHandler.hpp>
14 #include <azmq/message.hpp>
15 #include <azmq/socket.hpp>
17 #include <boost/asio.hpp>
30 using TopicHandler_t = std::function<void(const std::string&, const void*, size_t)>;
33 TopicSub(boost::asio::io_service& ios, std::unique_ptr<TopicHandler>&& fallback);
36 void Subscribe(
const std::string& topic_name);
40 void Connect(
const std::string& endpoint);
51 void Callback(boost::system::error_code
const& error_code, azmq::message& msg,
size_t nbytes);
53 azmq::sub_socket m_socket;
54 std::unique_ptr<TopicHandler> m_fallback_handler;
60 #endif // RAD_TOPIC_SUB_HPP
void Unsubscribe(const std::string &topic_name)
Definition: topicSub.cpp:72
TopicSub(boost::asio::io_service &ios, std::unique_ptr< TopicHandler > &&fallback)
Definition: topicSub.cpp:25
void Flush()
Definition: topicSub.cpp:117
Definition: topicSub.hpp:28
void Connect(const std::string &endpoint)
Definition: topicSub.cpp:83
void Subscribe(const std::string &topic_name)
Definition: topicSub.cpp:50
std::unordered_map< std::string, TopicHandler_t > TopicHandlerMap_t
Definition: topicSub.hpp:31
std::function< void(const std::string &, const void *, size_t)> TopicHandler_t
Definition: topicSub.hpp:30
def handler
Definition: test_dispatcher.py:11
TopicSub & operator=(const TopicSub &)=delete
~TopicSub()
Definition: topicSub.cpp:33
void Disconnect(const std::string &endpoint)
Definition: topicSub.cpp:107