7 #ifndef __PZMQBACKEND_H__
8 #define __PZMQBACKEND_H__
34 PZmqParam pzmq_createParamClient(
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);
35 PZmqParam pzmq_createParamServer(
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);
49 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);
50 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);
PZmqParam pzmq_createParamServer(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 param for a client socket.
PZmqParam pzmq_createParamClient(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 param for a client socket.
Backend to use ZMQ library with PAbtractSocket.
static void close(Socket &socket)
Close the given socket.
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.
PZmqParam Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
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.
static size_t msgSize(const Message &msg)
Get the size of a message.
PZmqBackend()
Default constructor of PZmqBackend.
static void msgToMock(DataStreamMsg &mockMsg, const Message &msg)
Copy current backend message data into mock message.
static void msgResize(Message &msg, size_t sizeMsg)
Resize a message.
static bool createClientSocket(Socket &socket, const std::string &address, size_t port, const PZmqParam ¶m)
Create a client socket.
static bool recv(Socket &socket, Message &msg, PRecvFlag::PRecvFlag flag)
Recieve message from the given socket.
static const DataStreamIter msgData(const Message &msg)
Get the data of a message.
static void mockToMsg(Message &msg, DataStreamMsg &mockMsg)
Copy mock message data into current backend message.
zmq::socket_t * Socket
Define the socket of the backend used by the PAbstractSocketManager.
static bool isConnected(const Socket &socket)
Close the given socket.
static bool send(Socket &socket, Message &msg, PSendFlag::PSendFlag flag)
Send message on the given socket.
zmq::message_t Message
Define the type of message used by the PAbstractSocketManager.
static bool createServerSocket(Socket &socket, const std::string &address, size_t port, const PZmqParam ¶m)
Create a server socket.
std::vector< DataStreamType > DataStreamMsg
DataStreamType * DataStreamIter
PRecvFlag
describe the recieving flag of the Socket
PSendFlag
describe the sending flag of the Socket
Set of parameters to be passed to create a socket with zmq backend.
zmq::context_t * context
Context.
ssize_t dataRate
Data rate.
int nbBufferMessage
Number of messages in the buffer.
int bufferSizeByte
Size of the message buffer in bytes.
size_t port
Connection port.
size_t threadAffinity
Mask of threads which deal with reconnection.
std::string address
Host address.