![]() |
PhoenixZMQ
2.0.0
Library which integrates zeromq use in Phoenix
|
Socket manager for PGenericSocket. More...
#include <PGenericSocketManager.h>
Public Types | |
typedef _TBackend | Backend |
typedef _TMockBackend | Mock |
Public Member Functions | |
bool | addClientSocket (const _TSocketKey &name, const typename _TBackend::Param ¶m, const typename _TMockBackend::Param &mockParam) |
Create a client socket. More... | |
bool | addServerSocket (const _TSocketKey &name, const typename _TBackend::Param ¶m, const typename _TMockBackend::Param &mockParam) |
Create a server socket. More... | |
void | clear () |
Clear the map of socket. More... | |
PSocketMode::PSocketMode | getMode () const |
Get if the current PGenericSocketManager is a mock. More... | |
PGenericSocket< _TBackend, _TMockBackend > * | getSocket (const _TSocketKey &name) |
Get a socket by name (or key) More... | |
bool | isConnected (const _TSocketKey &name) const |
Say if the given socket is connected. More... | |
bool | isSocketExist (const _TSocketKey &name) const |
Say if the socket exist with the given name. More... | |
PGenericSocketManager (PSocketMode::PSocketMode mode=PSocketMode::NO_MOCK) | |
Default constructor of PGenericSocketManager. More... | |
template<typename U > | |
bool | recvData (const _TSocketKey &name, U &data, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK) |
Recieve data from the given socket. More... | |
bool | recvMsg (const _TSocketKey &name, typename _TBackend::Message &msg, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK) |
Recieve message from the given socket. More... | |
void | removeSocket (const _TSocketKey &name) |
Remove the given socket. More... | |
template<typename U > | |
bool | sendData (const _TSocketKey &name, const U &data, PSendFlag::PSendFlag flag=PSendFlag::BLOCK) |
Send data on the given socket. More... | |
bool | sendMsg (const _TSocketKey &name, typename _TBackend::Message &msg, PSendFlag::PSendFlag flag=PSendFlag::BLOCK) |
Send message on the given socket. More... | |
void | setMode (PSocketMode::PSocketMode mode) |
Set if the current PGenericSocketManager is a mock. More... | |
virtual | ~PGenericSocketManager () |
Destructor of PGenericSocketManager. More... | |
Private Member Functions | |
void | initialisationPGenericSocketManager (PSocketMode::PSocketMode mode) |
Initialisation function of the class PGenericSocketManager. More... | |
Private Attributes | |
std::map< _TSocketKey, PGenericSocket< _TBackend, _TMockBackend > * > | p_mapSocket |
Map of the zmq sockets to be used by the manager. More... | |
PSocketMode::PSocketMode | p_mode |
Mode of the Socket (no mock, mock, mock_record) More... | |
Socket manager for PGenericSocket.
Definition at line 17 of file PGenericSocketManager.h.
typedef _TBackend PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::Backend |
Definition at line 19 of file PGenericSocketManager.h.
typedef _TMockBackend PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::Mock |
Definition at line 20 of file PGenericSocketManager.h.
PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::PGenericSocketManager | ( | PSocketMode::PSocketMode | mode = PSocketMode::NO_MOCK | ) |
Default constructor of PGenericSocketManager.
mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 16 of file PGenericSocketManager_impl.h.
|
virtual |
Destructor of PGenericSocketManager.
Definition at line 22 of file PGenericSocketManager_impl.h.
bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addClientSocket | ( | const _TSocketKey & | name, |
const typename _TBackend::Param & | param, | ||
const typename _TMockBackend::Param & | mockParam | ||
) |
Create a client socket.
name | : name (key) to get the socket |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
mockParam | : parameters to initialise the mock |
Definition at line 49 of file PGenericSocketManager_impl.h.
References PGenericSocket< _TBackend, _TMockBackend >::createClientSocket().
Referenced by threadRecievedData(), and threadRecievedMessage().
bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addServerSocket | ( | const _TSocketKey & | name, |
const typename _TBackend::Param & | param, | ||
const typename _TMockBackend::Param & | mockParam | ||
) |
Create a server socket.
name | : name (key) to get the socket |
param | : extra customisable parameters for the creation of the socket (depends on the backend) |
mockParam | : parameters to initialise the mock |
Definition at line 69 of file PGenericSocketManager_impl.h.
References PGenericSocket< _TBackend, _TMockBackend >::createServerSocket().
Referenced by threadSendData(), and threadSendMessage().
void PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::clear |
Clear the map of socket.
Definition at line 96 of file PGenericSocketManager_impl.h.
PSocketMode::PSocketMode PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::getMode |
Get if the current PGenericSocketManager is a mock.
Definition at line 38 of file PGenericSocketManager_impl.h.
PGenericSocket< _TBackend, _TMockBackend > * PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::getSocket | ( | const _TSocketKey & | name | ) |
Get a socket by name (or key)
name | : of the socket to be used |
Definition at line 140 of file PGenericSocketManager_impl.h.
Referenced by PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvData(), and PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::sendData().
|
private |
Initialisation function of the class PGenericSocketManager.
mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 178 of file PGenericSocketManager_impl.h.
bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::isConnected | ( | const _TSocketKey & | name | ) | const |
Say if the given socket is connected.
name | : name of the socket to be checked |
Definition at line 165 of file PGenericSocketManager_impl.h.
Referenced by threadSendData(), and threadSendMessage().
bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::isSocketExist | ( | const _TSocketKey & | name | ) | const |
Say if the socket exist with the given name.
name | : of the socket to be used |
Definition at line 155 of file PGenericSocketManager_impl.h.
|
inline |
Recieve data from the given socket.
name | : name of the socket to be used |
data | : data to be recieved |
flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 57 of file PGenericSocketManager.h.
References PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::getSocket(), and PGenericSocket< _TBackend, _TMockBackend >::recvData().
Referenced by threadRecievedData().
bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvMsg | ( | const _TSocketKey & | name, |
typename _TBackend::Message & | msg, | ||
PRecvFlag::PRecvFlag | flag = PRecvFlag::BLOCK |
||
) |
Recieve message from the given socket.
name | : name of the socket to be used |
msg | : message to be recieved |
flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 126 of file PGenericSocketManager_impl.h.
References PGenericSocket< _TBackend, _TMockBackend >::recvMsg().
Referenced by threadRecievedMessage().
void PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::removeSocket | ( | const _TSocketKey & | name | ) |
Remove the given socket.
name | : name (key) of the socket to be removed |
Definition at line 86 of file PGenericSocketManager_impl.h.
|
inline |
Send data on the given socket.
name | : name of the socket to be used |
data | : data to be sent |
flag | : flag to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 39 of file PGenericSocketManager.h.
References PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::getSocket(), and PGenericSocket< _TBackend, _TMockBackend >::sendData().
Referenced by threadSendData().
bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::sendMsg | ( | const _TSocketKey & | name, |
typename _TBackend::Message & | msg, | ||
PSendFlag::PSendFlag | flag = PSendFlag::BLOCK |
||
) |
Send message on the given socket.
name | : name of the socket to be used |
msg | : message to be sent |
flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 110 of file PGenericSocketManager_impl.h.
References PGenericSocket< _TBackend, _TMockBackend >::sendMsg().
Referenced by threadSendMessage().
void PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::setMode | ( | PSocketMode::PSocketMode | mode | ) |
Set if the current PGenericSocketManager is a mock.
mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 30 of file PGenericSocketManager_impl.h.
|
private |
Map of the zmq sockets to be used by the manager.
Definition at line 79 of file PGenericSocketManager.h.
|
private |
Mode of the Socket (no mock, mock, mock_record)
Definition at line 76 of file PGenericSocketManager.h.