PhoenixZMQ  7.2.0
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 69 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 74 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 76 of file PZmqBackend.h.

◆ Socket

Define the socket of the backend used by the PAbstractSocketManager.

Definition at line 72 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 243 of file PZmqBackend.cpp.

244:p_context(1)
245{
246
247}
zmq::context_t p_context
Context ZMQ.
Definition PZmqBackend.h:91

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 252 of file PZmqBackend.cpp.

252 {
253 return pzmq_createParamClient(ZMQ_PULL);
254}
PZmqParam pzmq_createParamClient(int type, int nbBufferMessage=10000, int bufferSizeByte=1000000, size_t threadAffinity=0lu, ssize_t dataRate=200000l, int linger=-1)
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 270 of file PZmqBackend.cpp.

270 {
271 return socket.createClientSocket(p_context, socketParam, param);
272}
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 280 of file PZmqBackend.cpp.

280 {
281 return socket.createServerSocket(p_context, socketParam, param);
282}
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 298 of file PZmqBackend.cpp.

298 {
299 size_t dataSize(mockMsg.size());
300 msg.rebuild(dataSize);
301 memcpy((void*)msg.data(), mockMsg.data(), dataSize);
302}

◆ 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 288 of file PZmqBackend.cpp.

288 {
289 size_t dataSize(msg.size());
290 mockMsg.resize(dataSize);
291 memcpy(mockMsg.data(), (const void*)msg.data(), dataSize);
292}

◆ server()

PZmqSocketGenerator::Param PZmqSocketGenerator::server ( )
static

Create a server parameter.

Returns
corresponding PZmqSocketGenerator::Param (or PZmqParam)

Definition at line 259 of file PZmqBackend.cpp.

259 {
260 return pzmq_createParamServer(ZMQ_PUSH);
261}
PZmqParam pzmq_createParamServer(int type, int nbBufferMessage=10000, int bufferSizeByte=1000000, size_t threadAffinity=0lu, ssize_t dataRate=200000l, int linger=-1)
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 91 of file PZmqBackend.h.

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


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