#include <ZeroMQ.hpp>
Public Member Functions | |
ZeroMQ (const zmq::socket_type &type, const std::string &addr, bool isBind) | |
ZeroMQ (const std::shared_ptr< zmq::context_t > &ctx, const zmq::socket_type &type, const std::string &addr, bool isBind) | |
ZeroMQ (const ZeroMQ &)=delete | |
Copy constructor. | |
ZeroMQ (ZeroMQ &&)=delete | |
Move constructor. | |
ZeroMQ & | operator= (ZeroMQ)=delete |
Copy assignment operator. | |
ZeroMQ & | operator= (ZeroMQ &&)=delete |
Move assignment operator. | |
bool | start () |
void | stop () |
std::vector< zmq::message_t > | recvMessages () |
size_t | sendMessages (std::vector< zmq::message_t > &msg) |
const std::unique_ptr< zmq::socket_t > & | getSocket () const |
const std::shared_ptr< zmq::context_t > & | getContext () const |
const std::string & | getAddress () const |
~ZeroMQ () | |
Private Member Functions | |
void | init (const std::shared_ptr< zmq::context_t > &ctx, const zmq::socket_type &type, const std::string_view &addr, bool isBind) |
Private Attributes | |
std::shared_ptr< zmq::context_t > | _contextPtr |
std::unique_ptr< zmq::socket_t > | _socketPtr |
bool | _isActive {false} |
bool | _isBinded {false} |
std::string | _socketAddr |
A class that provides a wrapper for ZeroMQ functionality.
This class encapsulates the ZeroMQ library and provides methods to initialize, start, stop, send, and receive messages using ZeroMQ sockets. It supports both binding and connecting to sockets and provides a convenient interface for working with multipart messages.
Definition at line 13 of file ZeroMQ.hpp.
ZeroMQ::ZeroMQ | ( | const zmq::socket_type & | type, |
const std::string & | addr, | ||
bool | isBind ) |
Construct a new ZeroMQ class
[in] | type | Type of the socket |
[in] | addr | Full socket address |
[in] | isBind | True if should be binded, false if should be connected |
Definition at line 32 of file ZeroMQ.cpp.
ZeroMQ::ZeroMQ | ( | const std::shared_ptr< zmq::context_t > & | ctx, |
const zmq::socket_type & | type, | ||
const std::string & | addr, | ||
bool | isBind ) |
Construct a new ZeroMQ class
[in] | ctx | ZeroMQ context |
[in] | type | Type of the socket |
[in] | addr | Full socket address |
[in] | isBind | True if should be binded, false if should be connected |
Definition at line 37 of file ZeroMQ.cpp.
|
delete |
Copy constructor.
|
delete |
Move constructor.
ZeroMQ::~ZeroMQ | ( | ) |
Destroy the ZeroMQ class
Definition at line 111 of file ZeroMQ.cpp.
|
inlinenodiscard |
Get the address of the socket
Definition at line 102 of file ZeroMQ.hpp.
|
inlinenodiscard |
Get the reference of context
Definition at line 96 of file ZeroMQ.hpp.
|
inlinenodiscard |
Get the reference of socket
Definition at line 90 of file ZeroMQ.hpp.
|
private |
Definition at line 14 of file ZeroMQ.cpp.
std::vector< zmq::message_t > ZeroMQ::recvMessages | ( | ) |
Receives multipart message
Definition at line 81 of file ZeroMQ.cpp.
size_t ZeroMQ::sendMessages | ( | std::vector< zmq::message_t > & | msg | ) |
Sends multipart message
[in] | msg | Messages to send |
Definition at line 96 of file ZeroMQ.cpp.
bool ZeroMQ::start | ( | ) |
Starts the connection
Definition at line 43 of file ZeroMQ.cpp.
void ZeroMQ::stop | ( | ) |
Stops the connection
Definition at line 63 of file ZeroMQ.cpp.
|
private |
Definition at line 16 of file ZeroMQ.hpp.
|
private |
Definition at line 21 of file ZeroMQ.hpp.
|
private |
Definition at line 23 of file ZeroMQ.hpp.
|
private |
Definition at line 25 of file ZeroMQ.hpp.
|
private |
Definition at line 18 of file ZeroMQ.hpp.