![]() |
PhoenixZMQ
2.0.0
Library which integrates zeromq use in Phoenix
|
Backend to use ZMQ library with PAbtractSocket. More...
#include <PZmqBackend.h>
Public Types | |
typedef zmq::message_t | Message |
Define the type of message used by the PAbstractSocketManager. More... | |
typedef PZmqParam | Param |
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager. More... | |
typedef zmq::socket_t * | Socket |
Define the socket of the backend used by the PAbstractSocketManager. More... | |
Public Member Functions | |
PZmqBackend () | |
Default constructor of PZmqBackend. More... | |
Static Public Member Functions | |
static Param | client (const std::string &address, size_t port, zmq::context_t *context=NULL, int type=ZMQ_PULL, int nbBufferMessage=10000, int bufferSizeByte=1000000, size_t threadAffinity=0lu, ssize_t dataRate=200000l) |
Create a client parameter. More... | |
static void | close (Socket &socket) |
Close the given socket. More... | |
static bool | createClientSocket (Socket &socket, const Param ¶m) |
Create a client socket. More... | |
static bool | createClientSocket (Socket &socket, const std::string &address, size_t port, const PZmqParam ¶m) |
Create a client socket. More... | |
static bool | createServerSocket (Socket &socket, const Param ¶m) |
Create a server socket. More... | |
static bool | createServerSocket (Socket &socket, const std::string &address, size_t port, const PZmqParam ¶m) |
Create a server socket. More... | |
static bool | isConnected (const Socket &socket) |
Close the given socket. More... | |
static void | mockToMsg (Message &msg, DataStreamMsg &mockMsg) |
Copy mock message data into current backend message. More... | |
static const DataStreamIter | msgData (const Message &msg) |
Get the data of a message. More... | |
static DataStreamIter | msgData (Message &msg) |
Get the data of a message. More... | |
static void | msgResize (Message &msg, size_t sizeMsg) |
Resize a message. More... | |
static size_t | msgSize (const Message &msg) |
Get the size of a message. More... | |
static void | msgToMock (DataStreamMsg &mockMsg, const Message &msg) |
Copy current backend message data into mock message. More... | |
static bool | recv (Socket &socket, Message &msg, PRecvFlag::PRecvFlag flag) |
Recieve message from the given socket. More... | |
static bool | send (Socket &socket, Message &msg, PSendFlag::PSendFlag flag) |
Send message on the given socket. More... | |
static Param | server (const std::string &address, size_t port, zmq::context_t *context=NULL, int type=ZMQ_PUSH, int nbBufferMessage=10000, int bufferSizeByte=1000000, size_t threadAffinity=0lu, ssize_t dataRate=200000l) |
Create a server parameter. More... | |
Backend to use ZMQ library with PAbtractSocket.
Definition at line 38 of file PZmqBackend.h.
typedef zmq::message_t PZmqBackend::Message |
Define the type of message used by the PAbstractSocketManager.
Definition at line 43 of file PZmqBackend.h.
typedef PZmqParam PZmqBackend::Param |
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager.
Definition at line 45 of file PZmqBackend.h.
typedef zmq::socket_t* PZmqBackend::Socket |
Define the socket of the backend used by the PAbstractSocketManager.
Definition at line 41 of file PZmqBackend.h.
PZmqBackend::PZmqBackend | ( | ) |
|
static |
Create a client parameter.
address | : address to be connected to |
port | : port to be used |
context | : zmq context where to create socket |
type | : type of the connection (ZMQ_PULL, ZMQ_PUSH, etc) |
nbBufferMessage | : number of messages to be buffered |
bufferSizeByte | : size of the zmq buffer in bytes |
threadAffinity | : bit mask which determines which threads from the 0MQ I/O thread pool associated with the socket's context shall handle newly created connections (1 : means first, 2 : means second, 3 : means first and second, etc) |
dataRate | : expected data rate (in kilobytes per second) |
Definition at line 77 of file PZmqBackend.cpp.
References pzmq_createParamClient().
|
static |
Close the given socket.
[out] | socket | : socket to be closed |
Definition at line 227 of file PZmqBackend.cpp.
References pzmq_closeServerSocket().
Create a client socket.
[out] | socket | : socket to be created |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 127 of file PZmqBackend.cpp.
References PZmqParam::address, PZmqParam::bufferSizeByte, PZmqParam::context, PZmqParam::dataRate, PZmqParam::nbBufferMessage, PZmqParam::port, pzmq_createClientSocket(), PZmqParam::threadAffinity, and PZmqParam::type.
|
static |
Create a client socket.
[out] | socket | : socket to be created |
address | : address of the server, the client has to connect to | |
port | : port to be used for the connection | |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 103 of file PZmqBackend.cpp.
References PZmqParam::bufferSizeByte, PZmqParam::context, PZmqParam::dataRate, PZmqParam::nbBufferMessage, pzmq_createClientSocket(), PZmqParam::threadAffinity, and PZmqParam::type.
Create a server socket.
[out] | socket | : socket to be created |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 138 of file PZmqBackend.cpp.
References PZmqParam::bufferSizeByte, PZmqParam::context, PZmqParam::dataRate, PZmqParam::nbBufferMessage, PZmqParam::port, pzmq_createServerSocket(), PZmqParam::threadAffinity, and PZmqParam::type.
|
static |
Create a server socket.
[out] | socket | : socket to be created |
address | : address of the server, the client has to connect to | |
port | : port to be used for the connection | |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
Definition at line 116 of file PZmqBackend.cpp.
References PZmqParam::bufferSizeByte, PZmqParam::context, PZmqParam::dataRate, PZmqParam::nbBufferMessage, pzmq_createServerSocket(), PZmqParam::threadAffinity, and PZmqParam::type.
|
static |
Close the given socket.
socket | : socket to be checked |
Definition at line 235 of file PZmqBackend.cpp.
|
static |
Copy mock message data into current backend message.
[out] | msg | : message of the current backend to be converted |
mockMsg | : mock message |
Definition at line 261 of file PZmqBackend.cpp.
References msgData(), and msgResize().
|
static |
Get the data of a message.
msg | : message to be used |
Definition at line 212 of file PZmqBackend.cpp.
Referenced by mockToMsg(), and msgToMock().
|
static |
Get the data of a message.
msg | : message to be used |
Definition at line 220 of file PZmqBackend.cpp.
|
static |
Resize a message.
[out] | msg | : message to be resized |
sizeMsg | : new size of the message |
Definition at line 196 of file PZmqBackend.cpp.
Referenced by mockToMsg().
|
static |
Get the size of a message.
msg | : message to be used |
Definition at line 204 of file PZmqBackend.cpp.
Referenced by msgToMock().
|
static |
Copy current backend message data into mock message.
[out] | mockMsg | : mock message |
msg | : message of the current backend to be converted |
Definition at line 251 of file PZmqBackend.cpp.
References msgData(), and msgSize().
|
static |
Recieve message from the given socket.
socket | : socket to be used |
msg | : message to be recieved |
flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 183 of file PZmqBackend.cpp.
References convertToRecvFlag().
|
static |
Send message on the given socket.
socket | : socket to be used |
msg | : message to be sent |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 159 of file PZmqBackend.cpp.
References convertToSendFlag().
|
static |
Create a server parameter.
address | : address to be connected to |
port | : port to be used |
context | : zmq context where to create socket |
type | : type of the connection (ZMQ_PULL, ZMQ_PUSH, etc) |
nbBufferMessage | : number of messages to be buffered |
bufferSizeByte | : size of the zmq buffer in bytes |
threadAffinity | : bit mask which determines which threads from the 0MQ I/O thread pool associated with the socket's context shall handle newly created connections (1 : means first, 2 : means second, 3 : means first and second, etc) |
dataRate | : expected data rate (in kilobytes per second) |
Definition at line 92 of file PZmqBackend.cpp.
References pzmq_createParamServer().