B2BITS FIX Antenna C++ 2.33.0
|
Implementation of sessions controller interface the utilizes FixAntenna engine to operate. More...
#include <B2BITS_SessionsController.h>
Public Types | |
typedef Utils::ReferenceCounterSharedPtr< Engine::Session > | SessionPtr |
Smart pointer to hold Engine's session. | |
Public Types inherited from Engine::SessionsController | |
typedef std::set< Engine::SessionId > | Sessions |
Set of sessions registered. | |
Public Member Functions | |
virtual void | connectSession (const Engine::SessionId &sessionId) |
Connects session. | |
virtual void | disconnectSession (const Engine::SessionId &sessionId) |
Disconnects session. | |
FixEngineSessionsController () | |
Sessions | getRegisteredSessions () const |
Returns list of registered sessions. | |
Engine::Application & | getSessionApplication (const Engine::SessionId &sessionId) const |
Returns session's application. | |
std::unique_ptr< SessionBackupParameters > | getSessionBackupParameters (const Engine::SessionId &sessionId) const |
Returns session's backup parameters or empty pointer. | |
SessionExtraParameters | getSessionParameters (const Engine::SessionId &sessionId) const |
Returns session's extra parameters. | |
SessionPtr | getSessionPtr (const Engine::SessionId &sessionId) const |
Returns active session's pointer. | |
void | registerSession (const Engine::SessionId &sessionId, Engine::Application &sessionApp, const SessionExtraParameters &sessionExtraParameters, const SessionBackupParameters *pSessionBackupParameters=NULL) |
Registers session. | |
void | registerSession (const SessionPtr &activeSession, Engine::Application &sessionNewApp, bool switchApplication=false, const SessionExtraParameters *pNewSessionExtraParameters=NULL, const SessionBackupParameters *pNewSessionBackupParameters=NULL) |
Registers already running session. | |
virtual void | startSession (const Engine::SessionId &sessionId) |
Starts session. | |
virtual void | stopSession (const Engine::SessionId &sessionId) |
Stops session. | |
SessionPtr | unregisterSession (const Engine::SessionId &sessionId) |
Unregisters session. | |
virtual | ~FixEngineSessionsController () |
Public Member Functions inherited from Utils::ReferenceCounter | |
virtual bool | addRef () const throw () |
Increments reference counter. | |
virtual long | getNRef () const throw () |
Returns the current value of the reference counter. | |
ReferenceCounter () throw () | |
Constructor. | |
virtual long | release () const throw () |
Decrements reference counter. | |
Additional Inherited Members | |
Protected Member Functions inherited from Utils::ReferenceCounter | |
long | decrement () const throw () |
Decrements counter and returns new counter value. | |
long | increment () const throw () |
Increments counter and returns new counter value. | |
virtual | ~ReferenceCounter () |
Destructor. | |
Implementation of sessions controller interface the utilizes FixAntenna engine to operate.
This class owns registered sessions. It means that user shouldn't warry about keeping session's pointer or doing other sessions management.
typedef Utils::ReferenceCounterSharedPtr<Engine::Session> Engine::FixEngineSessionsController::SessionPtr |
Smart pointer to hold Engine's session.
Engine::FixEngineSessionsController::FixEngineSessionsController | ( | ) |
|
virtual |
|
virtual |
Connects session.
sessionId | - id of the session to connect. |
The implementation calls session's connect() routine internally.
throws SessionsControllerException with the following error codes set: ErrorCode_NotFound - if session with the id passed is not registered. ErrorCode_BadState - if session isn't started.
Implements Engine::SessionsController.
|
virtual |
Disconnects session.
sessionId | - id of the session to disconnect. |
The implementation calls session's disconnect() routine internally.
throws SessionsControllerException with the following error codes set: ErrorCode_NotFound - if session with the id passed is not registered. ErrorCode_BadState - if session isn't started.
Implements Engine::SessionsController.
|
virtual |
Returns list of registered sessions.
Implements Engine::SessionsController.
Engine::Application & Engine::FixEngineSessionsController::getSessionApplication | ( | const Engine::SessionId & | sessionId | ) | const |
Returns session's application.
sessionId | - sessionid of the registered session. |
throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.
std::unique_ptr< SessionBackupParameters > Engine::FixEngineSessionsController::getSessionBackupParameters | ( | const Engine::SessionId & | sessionId | ) | const |
Returns session's backup parameters or empty pointer.
sessionId | - sessionid of the registered session. |
throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.
SessionExtraParameters Engine::FixEngineSessionsController::getSessionParameters | ( | const Engine::SessionId & | sessionId | ) | const |
Returns session's extra parameters.
sessionId | - sessionid of the registered session. |
throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.
SessionPtr Engine::FixEngineSessionsController::getSessionPtr | ( | const Engine::SessionId & | sessionId | ) | const |
Returns active session's pointer.
sessionId | - sessionid of the registered and active(started) session. |
throws SessionsControllerException with the following error codes set: ErrorCode_NotFound - if session with the id passed is not registered. ErrorCode_BadState - if session isn't started.
void Engine::FixEngineSessionsController::registerSession | ( | const Engine::SessionId & | sessionId, |
Engine::Application & | sessionApp, | ||
const SessionExtraParameters & | sessionExtraParameters, | ||
const SessionBackupParameters * | pSessionBackupParameters = NULL ) |
Registers session.
sessionId | - sessionid of the session to register. |
sessionApp | - user application to serve as FixAntenna engine callbacks sink. |
sessionExtraParameters | - session configuration to use when starting the session. This parameters will be used when the session is being started. |
pSessionBackupParameters | - session backup parameters to use when starting the session. This parameters will be used when the session is being started. |
throws SessionsControllerException with ErrorCode_BadArguments error code set if session with the same id is already registered.
void Engine::FixEngineSessionsController::registerSession | ( | const SessionPtr & | activeSession, |
Engine::Application & | sessionNewApp, | ||
bool | switchApplication = false, | ||
const SessionExtraParameters * | pNewSessionExtraParameters = NULL, | ||
const SessionBackupParameters * | pNewSessionBackupParameters = NULL ) |
Registers already running session.
Sessions controller takes ownership over the session on success.
activeSession | - already running session's pointer. |
sessionNewApp | - user application to serve as FixAntenna engine callbacks sink. This application will be used when the session is being started next time. |
switchApplication | - flag telling whatever to keep current session's application or replace it with sessionNewApp. |
pNewSessionExtraParameters | - pointer to the session's configuration to use when starting the session next time. If this is NULL current session configuration is used. |
pNewSessionBackupParameters | - pointer to the session's backup parameters to use when starting the session next time. If this is NULL current session backup parameters are used. |
throws SessionsControllerException with ErrorCode_BadArguments error code set if session with the same id is already registered or activeSession doesn't point to valid session.
|
virtual |
Starts session.
sessionId | - id of the session to start. |
The implementation creates(calls engine's CreateSession() routine) session internally using parameters and application passed with registerSession call.
throws SessionsControllerException with the following error codes set: ErrorCode_NotFound - if session with the id passed is not registered. ErrorCode_BadState - if session is already started.
Implements Engine::SessionsController.
|
virtual |
Stops session.
sessionId | - id of the session to stop. |
The implementation destroys (releases session's pointer and the engine destroys it as a result) session internally.
throws SessionsControllerException with the following error codes set: ErrorCode_NotFound - if session with the id passed is not registered. ErrorCode_BadState - if session isn't started.
Implements Engine::SessionsController.
SessionPtr Engine::FixEngineSessionsController::unregisterSession | ( | const Engine::SessionId & | sessionId | ) |
Unregisters session.
If session is running(started or connected) it continues to operate but session controller stops owning it.
sessionId | - sessionid of the session to unregister. |
Returns pointer to session if it is running or empty pointer otherwise.
throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.