B2BITS FIX Antenna C++ 2.32.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Engine::FixEngineSessionsController Class Reference

Implementation of sessions controller interface the utilizes FixAntenna engine to operate. More...

#include <B2BITS_SessionsController.h>

+ Inheritance diagram for Engine::FixEngineSessionsController:
+ Collaboration diagram for Engine::FixEngineSessionsController:

Public Types

typedef Utils::ReferenceCounterSharedPtr< Engine::SessionSessionPtr
 Smart pointer to hold Engine's session.
 
- Public Types inherited from Engine::SessionsController
typedef std::set< Engine::SessionIdSessions
 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::ApplicationgetSessionApplication (const Engine::SessionId &sessionId) const
 Returns session's application.
 
std::unique_ptr< SessionBackupParametersgetSessionBackupParameters (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.
 

Detailed Description

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.

Member Typedef Documentation

◆ SessionPtr

Smart pointer to hold Engine's session.

Constructor & Destructor Documentation

◆ FixEngineSessionsController()

Engine::FixEngineSessionsController::FixEngineSessionsController ( )

◆ ~FixEngineSessionsController()

virtual Engine::FixEngineSessionsController::~FixEngineSessionsController ( )
virtual

Member Function Documentation

◆ connectSession()

virtual void Engine::FixEngineSessionsController::connectSession ( const Engine::SessionId & sessionId)
virtual

Connects session.

Parameters
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.

◆ disconnectSession()

virtual void Engine::FixEngineSessionsController::disconnectSession ( const Engine::SessionId & sessionId)
virtual

Disconnects session.

Parameters
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.

◆ getRegisteredSessions()

Sessions Engine::FixEngineSessionsController::getRegisteredSessions ( ) const
virtual

Returns list of registered sessions.

Implements Engine::SessionsController.

◆ getSessionApplication()

Engine::Application & Engine::FixEngineSessionsController::getSessionApplication ( const Engine::SessionId & sessionId) const

Returns session's application.

Parameters
sessionId- sessionid of the registered session.

throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.

◆ getSessionBackupParameters()

std::unique_ptr< SessionBackupParameters > Engine::FixEngineSessionsController::getSessionBackupParameters ( const Engine::SessionId & sessionId) const

Returns session's backup parameters or empty pointer.

Parameters
sessionId- sessionid of the registered session.

throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.

◆ getSessionParameters()

SessionExtraParameters Engine::FixEngineSessionsController::getSessionParameters ( const Engine::SessionId & sessionId) const

Returns session's extra parameters.

Parameters
sessionId- sessionid of the registered session.

throws SessionsControllerException with ErrorCode_NotFound error code set if session with the id passed is not registered.

◆ getSessionPtr()

SessionPtr Engine::FixEngineSessionsController::getSessionPtr ( const Engine::SessionId & sessionId) const

Returns active session's pointer.

Parameters
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.

◆ registerSession() [1/2]

void Engine::FixEngineSessionsController::registerSession ( const Engine::SessionId & sessionId,
Engine::Application & sessionApp,
const SessionExtraParameters & sessionExtraParameters,
const SessionBackupParameters * pSessionBackupParameters = NULL )

Registers session.

Parameters
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.

◆ registerSession() [2/2]

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.

Parameters
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.

◆ startSession()

virtual void Engine::FixEngineSessionsController::startSession ( const Engine::SessionId & sessionId)
virtual

Starts session.

Parameters
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.

◆ stopSession()

virtual void Engine::FixEngineSessionsController::stopSession ( const Engine::SessionId & sessionId)
virtual

Stops session.

Parameters
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.

◆ unregisterSession()

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.

Parameters
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.