![]() |
|
PhoenixSocket
4.0.1
Library which integrates socket unix 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 PSocketParam &socketParam, const typename _TBackend::Param ¶m, const std::string &mockPrefix, const typename _TMockBackend::Param &mockParam) |
| Create a client socket. | |
| bool | addServerSocket (const _TSocketKey &name, const PSocketParam &socketParam, const typename _TBackend::Param ¶m, const std::string &mockPrefix, const typename _TMockBackend::Param &mockParam) |
| Create a server socket. | |
| void | clear () |
| Clear the map of socket. | |
| PSocketMode::PSocketMode | getMode () const |
| Get if the current PGenericSocketManager is a mock. | |
| PGenericSocket< _TBackend, _TMockBackend > * | getSocket (const _TSocketKey &name) |
| Get a socket by name (or key) | |
| bool | isConnected (const _TSocketKey &name) const |
| Say if the given socket is connected. | |
| bool | isSocketExist (const _TSocketKey &name) const |
| Say if the socket exist with the given name. | |
| PGenericSocketManager (PSocketMode::PSocketMode mode=PSocketMode::NO_MOCK) | |
| Default constructor of PGenericSocketManager. | |
| template<typename U> | |
| PRecvStatus::PRecvStatus | recvData (const _TSocketKey &name, U &data, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK) |
| Receive data from the given socket. | |
| PRecvStatus::PRecvStatus | recvMsg (const _TSocketKey &name, typename _TBackend::Message &msg, PRecvFlag::PRecvFlag flag=PRecvFlag::BLOCK) |
| Receive message from the given socket. | |
| void | removeSocket (const _TSocketKey &name) |
| Remove the given socket. | |
| template<typename U> | |
| PSendStatus::PSendStatus | sendData (const _TSocketKey &name, const U &data, PSendFlag::PSendFlag flag=PSendFlag::BLOCK) |
| Send data on the given socket. | |
| PSendStatus::PSendStatus | sendMsg (const _TSocketKey &name, typename _TBackend::Message &msg, PSendFlag::PSendFlag flag=PSendFlag::BLOCK) |
| Send message on the given socket. | |
| void | setMode (PSocketMode::PSocketMode mode) |
| Set if the current PGenericSocketManager is a mock. | |
| virtual | ~PGenericSocketManager () |
| Destructor of PGenericSocketManager. | |
Private Member Functions | |
| void | initialisationPGenericSocketManager (PSocketMode::PSocketMode mode) |
| Initialisation function of the class PGenericSocketManager. | |
Private Attributes | |
| _TBackend | p_backend |
| Instance of the backend. | |
| std::map< _TSocketKey, PGenericSocket< _TBackend, _TMockBackend > * > | p_mapSocket |
| Map of the zmq sockets to be used by the manager. | |
| _TMockBackend | p_mockBackend |
| Instance of the mock backend. | |
| PSocketMode::PSocketMode | p_mode |
| Mode of the Socket (no mock, mock, mock_record) | |
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.
References initialisationPGenericSocketManager().
Here is the call graph for this function:
|
virtual |
Destructor of PGenericSocketManager.
Definition at line 22 of file PGenericSocketManager_impl.h.
References clear().
Here is the call graph for this function:| bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addClientSocket | ( | const _TSocketKey & | name, |
| const PSocketParam & | socketParam, | ||
| const typename _TBackend::Param & | param, | ||
| const std::string & | mockPrefix, | ||
| const typename _TMockBackend::Param & | mockParam ) |
Create a client socket.
| name | : name (key) to get the socket |
| socketParam | : parameters of the socket (host, port, send/recv timeout) |
| param | : extra customisable parameters for the creation of the socket (depends on the backend) |
| mockPrefix | : prefix to find and szve the mock |
| mockParam | : parameters to initialise the mock |
Definition at line 54 of file PGenericSocketManager_impl.h.
References PGenericSocket< _TBackend, _TMockBackend >::createClientSocket(), p_backend, p_mapSocket, p_mockBackend, and p_mode.
Here is the call graph for this function:| bool PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::addServerSocket | ( | const _TSocketKey & | name, |
| const PSocketParam & | socketParam, | ||
| const typename _TBackend::Param & | param, | ||
| const std::string & | mockPrefix, | ||
| const typename _TMockBackend::Param & | mockParam ) |
Create a server socket.
| name | : name (key) to get the socket |
| socketParam | : parameters of the socket (host, port, send/recv timeout) |
| param | : extra customisable parameters for the creation of the socket (depends on the backend) |
| mockPrefix | : prefix to find and szve the mock |
| mockParam | : parameters to initialise the mock |
Definition at line 75 of file PGenericSocketManager_impl.h.
References PGenericSocket< _TBackend, _TMockBackend >::createServerSocket(), p_backend, p_mapSocket, p_mockBackend, and p_mode.
Here is the call graph for this function:| void PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::clear | ( | ) |
Clear the map of socket.
Definition at line 101 of file PGenericSocketManager_impl.h.
References p_mapSocket.
Referenced by ~PGenericSocketManager().
Here is the caller graph for this function:| PSocketMode::PSocketMode PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::getMode | ( | ) | const |
Get if the current PGenericSocketManager is a mock.
Definition at line 41 of file PGenericSocketManager_impl.h.
References p_mode.
| 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 146 of file PGenericSocketManager_impl.h.
References p_mapSocket.
Referenced by recvData(), recvMsg(), sendData(), and sendMsg().
Here is the caller graph for this function:
|
private |
Initialisation function of the class PGenericSocketManager.
| mode | : Mode of the Socket (no mock, mock, mock_record) |
Definition at line 184 of file PGenericSocketManager_impl.h.
References p_mode.
Referenced by PGenericSocketManager().
Here is the caller graph for this function:| 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 171 of file PGenericSocketManager_impl.h.
References p_mapSocket.
| 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 161 of file PGenericSocketManager_impl.h.
References p_mapSocket.
|
inline |
Receive data from the given socket.
| name | : name of the socket to be used |
| data | : data to be received |
| flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 57 of file PGenericSocketManager.h.
References PRecvFlag::BLOCK, PRecvStatus::BROKEN_SOCKET, getSocket(), and PGenericSocket< _TBackend, _TMockBackend >::recvData().
Here is the call graph for this function:| PRecvStatus::PRecvStatus PGenericSocketManager< _TSocketKey, _TBackend, _TMockBackend >::recvMsg | ( | const _TSocketKey & | name, |
| typename _TBackend::Message & | msg, | ||
| PRecvFlag::PRecvFlag | flag = PRecvFlag::BLOCK ) |
Receive message from the given socket.
| name | : name of the socket to be used |
| msg | : message to be received |
| flag | : flags to be used to send the message (BLOCK, NON_BLOCK, etc) |
Definition at line 132 of file PGenericSocketManager_impl.h.
References PRecvStatus::BROKEN_SOCKET, getSocket(), and PGenericSocket< _TBackend, _TMockBackend >::recvMsg().
Here is the call graph for this function:| 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 91 of file PGenericSocketManager_impl.h.
References p_mapSocket.
|
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 PSendFlag::BLOCK, PSendStatus::BROKEN_SOCKET, getSocket(), and PGenericSocket< _TBackend, _TMockBackend >::sendData().
Here is the call graph for this function:| PSendStatus::PSendStatus 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 116 of file PGenericSocketManager_impl.h.
References PSendStatus::BROKEN_SOCKET, getSocket(), and PGenericSocket< _TBackend, _TMockBackend >::sendMsg().
Here is the call graph for this function:| 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.
References p_mapSocket, and p_mode.
|
private |
Instance of the backend.
Definition at line 81 of file PGenericSocketManager.h.
Referenced by addClientSocket(), and addServerSocket().
|
private |
Map of the zmq sockets to be used by the manager.
Definition at line 79 of file PGenericSocketManager.h.
Referenced by addClientSocket(), addServerSocket(), clear(), getSocket(), isConnected(), isSocketExist(), removeSocket(), and setMode().
|
private |
Instance of the mock backend.
Definition at line 83 of file PGenericSocketManager.h.
Referenced by addClientSocket(), and addServerSocket().
|
private |
Mode of the Socket (no mock, mock, mock_record)
Definition at line 76 of file PGenericSocketManager.h.
Referenced by addClientSocket(), addServerSocket(), getMode(), initialisationPGenericSocketManager(), and setMode().