Branch data Line data Source code
1 : : #ifndef ZERO_MQ_SOCKET_HPP
2 : : #define ZERO_MQ_SOCKET_HPP
3 : :
4 : : #include "IMQSocket.hpp"
5 : : #include "zmq.hpp"
6 : :
7 : : namespace MQ {
8 : : class ZeroMQSocket : public IMQSocket {
9 : : private:
10 : : zmq::socket_t m_socket;
11 : :
12 : : public:
13 : 5 : ZeroMQSocket(zmq::context_t& context, zmq::socket_type type) : m_socket(context, type) {}
14 : 5 : ~ZeroMQSocket() override = default;
15 : : ZeroMQSocket(ZeroMQSocket&&) = default;
16 : :
17 : : auto connect(const std::string& endpoint) -> bool override;
18 : : auto subscribe(const std::string& topic) -> bool override;
19 : : auto bind(const std::string& endpoint) -> bool override;
20 : : auto send(const std::vector<uint8_t>& data) -> bool override;
21 : : auto receive() -> std::optional<std::vector<uint8_t>> override;
22 : : void close() override;
23 : : };
24 : : } // namespace MQ
25 : :
26 : : #endif
|