PhoenixZMQ  8.1.3
Library which integrates zeromq use
Loading...
Searching...
No Matches
PZmqSocketGenerator Class Reference

Backend to use Mock library with PAbstractSocket. More...

#include <PZmqBackend.h>

Public Types

typedef zmq::message_t Message
 Define the type of message used by the PAbstractSocketManager.
 
typedef PZmqParam Param
 Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager.
 
typedef PZmqSocket Socket
 Define the socket of the backend used by the PAbstractSocketManager.
 

Public Member Functions

bool createClientSocket (Socket &socket, const PSocketParam &socketParam, const PZmqParam &param)
 Create a client socket.
 
bool createServerSocket (Socket &socket, const PSocketParam &socketParam, const PZmqParam &param)
 Create a server socket.
 
 PZmqSocketGenerator ()
 Default constructor of PZmqSocketGenerator setting the number of threads for zmq I/O to 1.
 

Static Public Member Functions

static Param client ()
 Create a client parameter.
 
static void mockToMsg (Message &msg, DataStreamMsg &mockMsg)
 Copy mock message data into current backend message.
 
static void msgToMock (DataStreamMsg &mockMsg, const Message &msg)
 Copy current backend message data into mock message.
 
static Param server ()
 Create a server parameter.
 

Private Attributes

zmq::context_t p_context
 Context ZMQ.
 

Detailed Description

Backend to use Mock library with PAbstractSocket.

Definition at line 71 of file PZmqBackend.h.

Member Typedef Documentation

◆ Message

typedef zmq::message_t PZmqSocketGenerator::Message

Define the type of message used by the PAbstractSocketManager.

Definition at line 76 of file PZmqBackend.h.

◆ Param

Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager.

Definition at line 78 of file PZmqBackend.h.

◆ Socket

Define the socket of the backend used by the PAbstractSocketManager.

Definition at line 74 of file PZmqBackend.h.

Constructor & Destructor Documentation

◆ PZmqSocketGenerator()

PZmqSocketGenerator::PZmqSocketGenerator ( )

Default constructor of PZmqSocketGenerator setting the number of threads for zmq I/O to 1.

Definition at line 249 of file PZmqBackend.cpp.

250:p_context(1)
251{
252
253}
zmq::context_t p_context
Context ZMQ.
Definition PZmqBackend.h:93

References p_context.

Member Function Documentation

◆ client()

PZmqSocketGenerator::Param PZmqSocketGenerator::client ( )
static

Create a client parameter.

Returns
corresponding PZmqSocketGenerator::Param (or PZmqParam)

Definition at line 258 of file PZmqBackend.cpp.

258 {
259 return pzmq_createParamClient(ZMQ_PUSH);
260}
PZmqParam pzmq_createParamClient(int type, int nbBufferMessage=10000, int bufferSizeByte=1000000, size_t threadAffinity=0lu, ssize_t dataRate=200000l, int linger=-1, int immediate=0)
Create param for a client socket.

References pzmq_createParamClient().

+ Here is the call graph for this function:

◆ createClientSocket()

bool PZmqSocketGenerator::createClientSocket ( PZmqSocketGenerator::Socket & socket,
const PSocketParam & socketParam,
const PZmqParam & param )

Create a client socket.

Parameters
[out]socket: socket to be created
socketParam: parameters of the server (hostname, port), 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)
Returns
true if the socket has been created, false otherwise

Definition at line 276 of file PZmqBackend.cpp.

276 {
277 return socket.createClientSocket(p_context, socketParam, param);
278}
bool createClientSocket(zmq::context_t &context, const PSocketParam &socketParam, const Param &extraParam)
Create a client socket.

References PZmqSocket::createClientSocket(), and p_context.

+ Here is the call graph for this function:

◆ createServerSocket()

bool PZmqSocketGenerator::createServerSocket ( PZmqSocketGenerator::Socket & socket,
const PSocketParam & socketParam,
const PZmqParam & param )

Create a server socket.

Parameters
[out]socket: socket to be created
socketParam: parameters of the server (hostname, port), the client has to connect to
param: extra customisable parameters for the creation of the socket (depends on the backend)
Returns
true if the socket has been created, false otherwise

Definition at line 286 of file PZmqBackend.cpp.

286 {
287 return socket.createServerSocket(p_context, socketParam, param);
288}
bool createServerSocket(zmq::context_t &context, const PSocketParam &socketParam, const Param &extraParam)
Create a server socket.

References PZmqSocket::createServerSocket(), and p_context.

+ Here is the call graph for this function:

◆ mockToMsg()

void PZmqSocketGenerator::mockToMsg ( PZmqSocketGenerator::Message & msg,
DataStreamMsg & mockMsg )
static

Copy mock message data into current backend message.

Parameters
[out]msg: message of the current backend to be converted
mockMsg: mock message

Definition at line 304 of file PZmqBackend.cpp.

304 {
305 size_t dataSize(mockMsg.size());
306 msg.rebuild(dataSize);
307 memcpy((void*)msg.data(), mockMsg.data(), dataSize);
308}

◆ msgToMock()

void PZmqSocketGenerator::msgToMock ( DataStreamMsg & mockMsg,
const Message & msg )
static

Copy current backend message data into mock message.

Parameters
[out]mockMsg: mock message
msg: message of the current backend to be converted

Definition at line 294 of file PZmqBackend.cpp.

294 {
295 size_t dataSize(msg.size());
296 mockMsg.resize(dataSize);
297 memcpy(mockMsg.data(), (const void*)msg.data(), dataSize);
298}

◆ server()

PZmqSocketGenerator::Param PZmqSocketGenerator::server ( )
static

Create a server parameter.

Returns
corresponding PZmqSocketGenerator::Param (or PZmqParam)

Definition at line 265 of file PZmqBackend.cpp.

265 {
266 return pzmq_createParamServer(ZMQ_PULL);
267}
PZmqParam pzmq_createParamServer(int type, int nbBufferMessage=10000, int bufferSizeByte=1000000, size_t threadAffinity=0lu, ssize_t dataRate=200000l, int linger=-1, int immediate=0)
Create param for a client socket.

References pzmq_createParamServer().

+ Here is the call graph for this function:

Member Data Documentation

◆ p_context

zmq::context_t PZmqSocketGenerator::p_context
private

Context ZMQ.

Definition at line 93 of file PZmqBackend.h.

Referenced by createClientSocket(), createServerSocket(), and PZmqSocketGenerator().


The documentation for this class was generated from the following files: