![]() |
PhoenixZMQ
2.0.0
Library which integrates zeromq use in Phoenix
|
Backend to use Mock library with PAbtractSocket. More...
#include <PMockBackend.h>
Public Types | |
typedef DataStreamMsg | Message |
Define the type of message used by the PAbstractSocketManager. More... | |
typedef PMockParam | Param |
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketManager. More... | |
typedef PMockSocket | Socket |
Define the socket of the backend used by the PAbstractSocketManager. More... | |
Public Member Functions | |
PMockBackend () | |
Default constructor of PMockBackend. More... | |
Static Public Member Functions | |
static Param | client (const std::string &address, size_t port, bool isMockRecord, const std::string &mockDirectory) |
Create param for a client socket. More... | |
static void | close (Socket &socket) |
Close the given socket. More... | |
static bool | createClientSocket (Socket &socket, const PMockParam ¶m) |
Create a client socket. More... | |
static bool | createServerSocket (Socket &socket, const PMockParam ¶m) |
Create a client socket. More... | |
static bool | isConnected (const Socket &socket) |
Say if the given socket is connected. 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, const Message &msg, PSendFlag::PSendFlag flag) |
Send message on the given socket. More... | |
static Param | server (const std::string &address, size_t port, bool isMockRecord, const std::string &mockDirectory) |
Create param for a server socket. More... | |
Backend to use Mock library with PAbtractSocket.
Definition at line 38 of file PMockBackend.h.
typedef DataStreamMsg PMockBackend::Message |
Define the type of message used by the PAbstractSocketManager.
Definition at line 43 of file PMockBackend.h.
typedef PMockParam PMockBackend::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 PMockBackend.h.
typedef PMockSocket PMockBackend::Socket |
Define the socket of the backend used by the PAbstractSocketManager.
Definition at line 41 of file PMockBackend.h.
PMockBackend::PMockBackend | ( | ) |
|
static |
Create param for a client socket.
address | : address of the server to be connected to |
port | : port to be used |
isMockRecord | : true if the mock is in record mode |
mockDirectory | : directory where to find/save mocks |
Definition at line 48 of file PMockBackend.cpp.
References PMockParam::address, PMockParam::isMockRecord, PMockParam::mockDirectory, and PMockParam::port.
Referenced by server().
|
static |
Close the given socket.
[out] | socket | : socket to be closed |
Definition at line 188 of file PMockBackend.cpp.
References data_save(), PMockSocket::fileNameMessage, PMockParam::isMockRecord, PMockSocket::param, and PMockSocket::vecMessage.
|
static |
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 73 of file PMockBackend.cpp.
References PMockParam::address, data_load(), PMockSocket::eventIndex, PMockSocket::fileNameMessage, PMockParam::isMockRecord, PMockParam::mockDirectory, PMockSocket::param, PMockParam::port, and PMockSocket::vecMessage.
Referenced by createServerSocket().
|
static |
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 97 of file PMockBackend.cpp.
References createClientSocket().
|
static |
Say if the given socket is connected.
socket | : socket to be checked |
Definition at line 198 of file PMockBackend.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 216 of file PMockBackend.cpp.
References msgData(), and msgResize().
|
static |
Get the data of a message.
msg | : message to be used |
Definition at line 173 of file PMockBackend.cpp.
Referenced by mockToMsg(), and msgToMock().
|
static |
Get the data of a message.
msg | : message to be used |
Definition at line 181 of file PMockBackend.cpp.
|
static |
Resize a message.
[out] | msg | : message to be resized |
sizeMsg | : new size of the message |
Definition at line 157 of file PMockBackend.cpp.
Referenced by mockToMsg().
|
static |
Get the size of a message.
msg | : message to be used |
Definition at line 165 of file PMockBackend.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 206 of file PMockBackend.cpp.
References msgData(), and msgSize().
|
static |
Recieve message from the given socket.
socket | : socket to be used |
msg | : message to be recieved |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 135 of file PMockBackend.cpp.
References PMockSocket::eventIndex, PMockParam::isMockRecord, PMockSocket::param, and PMockSocket::vecMessage.
|
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 107 of file PMockBackend.cpp.
References checkValue(), PMockSocket::eventIndex, PMockParam::isMockRecord, PMockSocket::param, and PMockSocket::vecMessage.
|
static |
Create param for a server socket.
address | : address of the server to be connected to |
port | : port to be used |
isMockRecord | : true if the mock is in record mode |
mockDirectory | : directory where to find/save mocks |
Definition at line 64 of file PMockBackend.cpp.
References client().