7#ifndef __PMockSocketGenerator_H__
8#define __PMockSocketGenerator_H__
11#include "phoenix_generic_mock.h"
45 PGenericVecMock<DataStreamMsg>
p_mock;
bool phoenix_initializeMockSocket(PMockSocket &mock, const PSocketParam &socketParam, const std::string &prefix="", const PMockParam &extraParam=PMockParam())
Create a mock backend.
static size_t msgSize(const Message &msg)
Get the size of a message.
PMockParam Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
bool createServerSocket(Socket &socket, const PSocketParam &socketParam, const PMockParam ¶m)
Create a client socket.
bool createClientSocket(Socket &socket, const PSocketParam &socketParam, const PMockParam ¶m)
Create a client socket.
static void msgToMock(DataStreamMsg &mockMsg, const Message &msg)
Copy current backend message data into mock message.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
PMockSocket Socket
Define the socket of the backend used by the PAbstractSocketManager.
static void mockToMsg(Message &msg, DataStreamMsg &mockMsg)
Copy mock message data into current backend message.
static const DataStreamIter msgData(const Message &msg)
Get the data of a message.
static void msgResize(Message &msg, size_t sizeMsg)
Resize a message.
static Param client()
Create param for a client socket.
static Param server()
Create param for a server socket.
PMockSocketGenerator()
Default constructor of PMockBackend.
Example of a mock socket with vector of messages.
PSendStatus::PSendStatus sendData(const T &data, PSendFlag::PSendFlag flag=PSendFlag::BLOCK)
Send data with the socket.
PGenericVecMock< DataStreamMsg > p_mock
Mock handler.
PMockSocket()
Default constructor of hte PMockSocket.
Param p_extraParam
Extra parameters of the socket.
PMockParam Param
Define the type of extra parameters which can be used to create a Socket used by the PAbstractSocketM...
PSocketParam p_socketParam
Parameters of the socket.
void close()
Close the PMockSocket.
PSendStatus::PSendStatus sendMsg(const Message &msg, PSendFlag::PSendFlag flag=PSendFlag::BLOCK)
Specialisation to send a Message with the socket.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
bool createServerSocket(const PSocketParam &socketParam, const Param &extraParam)
Initialise a server socket.
bool createClientSocket(const PSocketParam &socketParam, const Param &extraParam)
Initialise a client socket.
PRecvStatus::PRecvStatus recvMsg(Message &msg, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK)
Recieved data with the socket.
bool isConnected() const
Say if the PMockSocket is connected.
PRecvStatus::PRecvStatus recvData(T &data, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK)
Recieved data with the socket.
void setIsMockRecord(bool isMockRecord)
Set the mock prefix (where to find/save it)
virtual ~PMockSocket()
Default destructor of hte PMockSocket.
void setMockPrefix(const std::string &mockPrefix)
Set the mock prefix (where to find/save it)
PRecvFlag
describe the receiving flag of the Socket
PRecvStatus
describe the result of the recv
PSendFlag
describe the sending flag of the Socket
PSendStatus
describe the result of the send
Set of parameters to be passed to create a socket with mock backend.
Parameters to create a socket.