IpbusMock  1.0.0
Library which integrates IPbus use in Phoenix
Loading...
Searching...
No Matches
PIpBusBackend Class Reference

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

#include <PIpBusBackend.h>

Public Types

typedef UaMessage Message
 Define the type of message used by the PAbstractSocketManager.
 
typedef PIpBusParam Param
 Define the type of extra parameters which can be used to create a Socket.
 
typedef PIpBusSocket Socket
 Define the socket of the backend used by the PAbstractSocketManager.
 

Public Member Functions

bool createClientSocket (Socket &socket, const PSocketParam &socketParam, const Param &param)
 Create parameters for a client socket.
 
bool createServerSocket (Socket &socket, const PSocketParam &socketParam, const Param &param)
 Create parameters for a server socket.
 
 PIpBusBackend ()
 Default constructor of PIpBusBackend.
 

Static Public Member Functions

static Param client (std::string &connectionFilePath, std::string &connectionId)
 Create parameters for a client socket.
 
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 (std::string &connectionFilePath, std::string &connectionId)
 Create parameters for a server socket.
 

Detailed Description

Backend to use Mock library with PAbtractSocket.

Definition at line 58 of file PIpBusBackend.h.

Member Typedef Documentation

◆ Message

Define the type of message used by the PAbstractSocketManager.

Definition at line 63 of file PIpBusBackend.h.

◆ Param

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

Definition at line 65 of file PIpBusBackend.h.

◆ Socket

Define the socket of the backend used by the PAbstractSocketManager.

Definition at line 61 of file PIpBusBackend.h.

Constructor & Destructor Documentation

◆ PIpBusBackend()

PIpBusBackend::PIpBusBackend ( )

Default constructor of PIpBusBackend.

Definition at line 55 of file PIpBusBackend.cpp.

56{
57
58}

Member Function Documentation

◆ client()

PIpBusBackend::Param PIpBusBackend::client ( std::string & connectionFilePath,
std::string & connectionId )
static

Create parameters for a client socket.

Parameters
connectionFilePathPath to the connection file containing IPBUS parameters.
connectionIdDevice identifier.
Returns
Corresponding Param object.

Definition at line 65 of file PIpBusBackend.cpp.

65 {
66 Param param;
67 param.connectionFilePath = connectionFilePath;
68 param.connectionId = connectionId;
69 return param;
70}
PIpBusParam Param
Define the type of extra parameters which can be used to create a Socket.

References PIpBusParam::connectionFilePath, and PIpBusParam::connectionId.

Referenced by server().

+ Here is the caller graph for this function:

◆ createClientSocket()

bool PIpBusBackend::createClientSocket ( PIpBusBackend::Socket & socket,
const PSocketParam & socketParam,
const Param & param )

Create parameters for a client socket.

Parameters
connectionFilePathPath to the connection file containing IPBUS parameters.
connectionIdDevice identifier.
Returns
Corresponding Param object.

Definition at line 86 of file PIpBusBackend.cpp.

86 {
87 return socket.createClientSocket(param);
88}
bool createClientSocket(const Param &extraParam)
Create a client socket.

References PIpBusSocket::createClientSocket().

+ Here is the call graph for this function:

◆ createServerSocket()

bool PIpBusBackend::createServerSocket ( PIpBusBackend::Socket & socket,
const PSocketParam & socketParam,
const Param & param )

Create parameters for a server socket.

Parameters
connectionFilePathPath to the connection file containing IPBUS parameters.
connectionIdDevice identifier.
Returns
Corresponding Param object.

Definition at line 95 of file PIpBusBackend.cpp.

95 {
96 return socket.createServerSocket(param);
97}
bool createServerSocket(const Param &extraParam)
Create a server socket.

References PIpBusSocket::createServerSocket().

+ Here is the call graph for this function:

◆ mockToMsg()

void PIpBusBackend::mockToMsg ( PIpBusBackend::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 126 of file PIpBusBackend.cpp.

126 {
127 DataStreamIter iter = (DataStreamIter)mockMsg.data();
128 data_message_load(iter, msg);
129}

◆ msgToMock()

void PIpBusBackend::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 109 of file PIpBusBackend.cpp.

109 {
110 size_t dataSize(data_size(msg));
111 mockMsg.resize(dataSize);
112 DataStreamIter iter = (DataStreamIter)mockMsg.data();
113 data_message_save(iter, msg);
114}

◆ server()

PIpBusBackend::Param PIpBusBackend::server ( std::string & connectionFilePath,
std::string & connectionId )
static

Create parameters for a server socket.

Parameters
connectionFilePathPath to the connection file containing IPBUS parameters.
connectionIdDevice identifier.
Returns
Corresponding Param object.

Definition at line 77 of file PIpBusBackend.cpp.

77 {
78 return PIpBusBackend::client(connectionFilePath, connectionId);
79}
static Param client(std::string &connectionFilePath, std::string &connectionId)
Create parameters for a client socket.

References client().

+ Here is the call graph for this function:

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