![]() |
PhoenixZMQ
2.0.0
Library which integrates zeromq use in Phoenix
|
Abstract socket which has a mock mode to avoid heavy socket backend for unit tests. More...
#include <PGenericSocket.h>
Public Member Functions | |
void | close () |
Close the socket. More... | |
bool | createClientSocket (const typename _TBackend::Param ¶m, const typename _TMockBackend::Param &mockParam) |
Create a client socket. More... | |
bool | createServerSocket (const typename _TBackend::Param ¶m, const typename _TMockBackend::Param &mockParam) |
Create a server socket. More... | |
bool | isConnected () const |
Say if the Socket is connected. More... | |
PGenericSocket (PSocketMode::PSocketMode mode) | |
Default constructor of PGenericSocket. More... | |
template<typename U > | |
bool | recvData (U &data, PRecvFlag::PRecvFlag flag) |
Recieve message from the given socket. More... | |
bool | recvMsg (typename _TBackend::Message &msg, PRecvFlag::PRecvFlag flag) |
Recieve message from the given socket. More... | |
template<typename U > | |
bool | sendData (const U &data, PSendFlag::PSendFlag flag) |
Send message on the given socket. More... | |
bool | sendMsg (typename _TBackend::Message &msg, PSendFlag::PSendFlag flag) |
Send message on the given socket. More... | |
virtual | ~PGenericSocket () |
Destructor of PGenericSocket. More... | |
Private Member Functions | |
void | initialisationPGenericSocket (PSocketMode::PSocketMode mode) |
Initialisation function of the class PGenericSocket. More... | |
Private Attributes | |
_TMockBackend::Socket | p_mockSocket |
Socket to be used with the mock backend. More... | |
PSocketMode::PSocketMode | p_mode |
Mode of the Socket (no mock, mock, mock_record) More... | |
_TBackend::Socket | p_socket |
Socket to be used with the classical backend. More... | |
Abstract socket which has a mock mode to avoid heavy socket backend for unit tests.
Definition at line 16 of file PGenericSocket.h.
PGenericSocket< _TBackend, _TMockBackend >::PGenericSocket | ( | PSocketMode::PSocketMode | mode | ) |
Default constructor of PGenericSocket.
mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 16 of file PGenericSocket_impl.h.
|
virtual |
void PGenericSocket< _TBackend, _TMockBackend >::close |
Close the socket.
Definition at line 120 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, and PSocketMode::NO_MOCK.
bool PGenericSocket< _TBackend, _TMockBackend >::createClientSocket | ( | const typename _TBackend::Param & | param, |
const typename _TMockBackend::Param & | mockParam | ||
) |
Create a client socket.
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
mockParam | : parameters of mock backend |
Definition at line 32 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, and PSocketMode::NO_MOCK.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addClientSocket().
bool PGenericSocket< _TBackend, _TMockBackend >::createServerSocket | ( | const typename _TBackend::Param & | param, |
const typename _TMockBackend::Param & | mockParam | ||
) |
Create a server socket.
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
mockParam | : parameters of mock backend |
Definition at line 49 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, and PSocketMode::NO_MOCK.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addServerSocket().
|
private |
Initialisation function of the class PGenericSocket.
mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 150 of file PGenericSocket_impl.h.
bool PGenericSocket< _TBackend, _TMockBackend >::isConnected |
Say if the Socket is connected.
Definition at line 135 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, and PSocketMode::NO_MOCK.
|
inline |
Recieve message from the given socket.
data | : data to be recieved |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 71 of file PGenericSocket.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, PGenericSocket< _TBackend, _TMockBackend >::p_mockSocket, PGenericSocket< _TBackend, _TMockBackend >::p_mode, and PGenericSocket< _TBackend, _TMockBackend >::p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvData().
bool PGenericSocket< _TBackend, _TMockBackend >::recvMsg | ( | typename _TBackend::Message & | msg, |
PRecvFlag::PRecvFlag | flag | ||
) |
Recieve message from the given socket.
msg | : message to be recieved |
flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 93 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, and PSocketMode::NO_MOCK.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvMsg().
|
inline |
Send message on the given socket.
data | : data to be sent |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 30 of file PGenericSocket.h.
References PSocketMode::MOCK, PSocketMode::NO_MOCK, PGenericSocket< _TBackend, _TMockBackend >::p_mockSocket, PGenericSocket< _TBackend, _TMockBackend >::p_mode, and PGenericSocket< _TBackend, _TMockBackend >::p_socket.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::sendData().
bool PGenericSocket< _TBackend, _TMockBackend >::sendMsg | ( | typename _TBackend::Message & | msg, |
PSendFlag::PSendFlag | flag | ||
) |
Send message on the given socket.
msg | : message to be sent |
flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 66 of file PGenericSocket_impl.h.
References PSocketMode::MOCK, and PSocketMode::NO_MOCK.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::sendMsg().
|
private |
Socket to be used with the mock backend.
Definition at line 126 of file PGenericSocket.h.
Referenced by PGenericSocket< _TBackend, _TMockBackend >::recvData(), and PGenericSocket< _TBackend, _TMockBackend >::sendData().
|
private |
Mode of the Socket (no mock, mock, mock_record)
Definition at line 121 of file PGenericSocket.h.
Referenced by PGenericSocket< _TBackend, _TMockBackend >::recvData(), and PGenericSocket< _TBackend, _TMockBackend >::sendData().
|
private |
Socket to be used with the classical backend.
Definition at line 124 of file PGenericSocket.h.
Referenced by PGenericSocket< _TBackend, _TMockBackend >::recvData(), and PGenericSocket< _TBackend, _TMockBackend >::sendData().