Public Member Functions | Static Public Member Functions

Engine::FixEngine Class Reference

FIX Engine interface. More...

#include <B2BITS_FixEngine.h>

Collaboration diagram for Engine::FixEngine:

List of all members.

Public Member Functions

void backupLogFile (const std::string &backupFilePath)
 Backups engine's log file under the given name and opens a new one.
FastCodercreateFastCoder (std::string const &template_fn, Engine::FIXVersion protocolVersion)
 Creates FastCoder.
FastDecodercreateFastDecoder (std::string const &template_fn, Engine::FIXVersion protocolVersion)
 Creates FastDecoder.
SessioncreateFastSession (std::string const &templateFn, Application *pApp, const std::string &senderCompID, const std::string &targetCompID, FIXVersion appVer, const SessionExtraParameters *pParam=NULL, const MessageStorageType storageType=persistentMM_storageType)
 Creates FIX-over-FAST session.
ProtocolID createFixParser (std::string const &scpProtocolName, FixVersionToProtocolName const *appProtocols=NULL)
 Creates protocol using loaded protocol definition files.
Globex::MDApplicationcreateMDApplication (Globex::MDApplicationParams const &params, Globex::MDApplicationListener *appListener=NULL)
 Creates instance of the CME Globex FIX/FAST adapter.
Globex::MDApplicationcreateMDApplication (Globex::MDApplicationParams const &params, Globex::DataReaderAbstract *dataReader, Globex::MDApplicationListener *appListener=NULL)
micex_mfix::micex_mfix_applicationcreateMICEXApplication (micex_mfix::micex_mfix_application_params const &params, micex_mfix::mfix_data_reader_abstract *dataReader, micex_mfix::micex_mfix_application_listener *appListener=NULL)
micex_mfix::micex_mfix_applicationcreateMICEXApplication (micex_mfix::micex_mfix_application_params const &params, micex_mfix::micex_mfix_application_listener *appListener=NULL)
 Creates instance of the MICEX MFIX adapter.
ProtocolID createProtocol (std::string const &name, FIXVersion baseVer, std::string const &additionalXml)
 Register new custom FIX Protocol and returns its identifier.
SessioncreateSession (Application *pApp, const std::string &senderCompID, const std::string &targetCompID, ProtocolID scpID, const SessionExtraParameters *pParam=NULL, const MessageStorageType storageType=persistentMM_storageType, FIXVersion defaultAppProtocol=NA)
 Creates a new FIX Session.
SessioncreateSession (Application *pApp, const std::string &senderCompID, const std::string &targetCompID, FIXVersion appVer, const SessionExtraParameters *pParam=NULL, const MessageStorageType storageType=persistentMM_storageType, UnderlyingProtocol underlyingProtocolType=FIX_TCP)
 Creates a new FIX Session.
SessioncreateSession (Application *pApp, const std::string &senderCompID, const std::string &targetCompID, const std::string &protocolName, const SessionExtraParameters *pParam=NULL, const MessageStorageType storageType=persistentMM_storageType, FIXVersion defaultAppProtocol=NA)
 Creates a new FIX Session.
AdminApplicationgetAdminApplication ()
 Returns administrative application.
FIXVersion getBaseProtocol (ProtocolID protocolID) const
 Returns base FIX protocol version.
FixDictionary2::DictionaryT::CPtr getDictionary () const
 Returns reference to protocol dictionary.
int getListenPort ()
 Returns Engine's listen port.
const FAPropertiesgetProperties () const
 Returns settings.
ProtocolID getProtocolID (const std::string &name) const
 Returns unique protocol ID.
Engine::AsciiString getProtocolName (ProtocolID protocolID) const
 Returns unique protocol name.
Engine::SessionsManagergetSessionsManager ()
 Returns the current SessionsManager.
MessageStorageType getSessionStorageType () const
 Returns the default unregistered session's storage type.
void getStatistics (Statistics *apS)
 Returns the statistical information.
void loadProtocolFile (std::string const &fileName)
 Loads protocol definition/customization file.
void registerAdminApplication (AdminApplication *app)
 Register administrative application.
void registerEventListener (Engine::EventListener *apListener)
 Registers the given EventListener with FixEngine.
void registerSessionsManager (SessionsManager *apManager)
 Registers SessionsManager with the engine.
void setSessionStorageType (const MessageStorageType type)
 Sets the default unregistered session's storage type.
void stop (void)
 Stops the engine's worker threads.
bool unregisterEventListener (Engine::EventListener *apListener)
 Unregisters the given EventListener.

Static Public Member Functions

static void clearAdditionalFields ()
 Destroys the additional fields.
static void destroy ()
 Destroys the instance of this class.
static const EngineProperties GetEnginePropertiesDefaults ()
 Retrieves properties defaults.
static std::string getEngineVersion ()
 Returns version of the FixEngine.
static FixEngineinit (const EngineProperties &engineProperties)
 Initializes the Engine.
static FixEngineinit (const std::string &propertiesFileName="", int listenPort=-1, const std::string &engineRoot="", const std::string &additionalFields="")
 Initializes the Engine.
static void setAdditionalFields (const std::string &propertiesFileName="", const std::string &engineRoot="", const std::string &additionalFields="")
 Initializes the additional fields.
static FixEnginesingleton ()
 Returns an instance of this class.

Detailed Description

FIX Engine interface.

Definition at line 108 of file B2BITS_FixEngine.h.


Member Function Documentation

void Engine::FixEngine::backupLogFile ( const std::string &  backupFilePath )

Backups engine's log file under the given name and opens a new one.

Parameters:
backupFilePaththe current engine's log will be moved to this path.
See also:
logFileName_.
static void Engine::FixEngine::clearAdditionalFields (  ) [static]

Destroys the additional fields.

Note:
Do not use it with destroy() method.
FastCoder* Engine::FixEngine::createFastCoder ( std::string const &  template_fn,
Engine::FIXVersion  protocolVersion 
)

Creates FastCoder.

FastDecoder* Engine::FixEngine::createFastDecoder ( std::string const &  template_fn,
Engine::FIXVersion  protocolVersion 
)

Creates FastDecoder.

Session* Engine::FixEngine::createFastSession ( std::string const &  templateFn,
Application pApp,
const std::string &  senderCompID,
const std::string &  targetCompID,
FIXVersion  appVer,
const SessionExtraParameters pParam = NULL,
const MessageStorageType  storageType = persistentMM_storageType 
)

Creates FIX-over-FAST session.

ProtocolID Engine::FixEngine::createFixParser ( std::string const &  scpProtocolName,
FixVersionToProtocolName const *  appProtocols = NULL 
)

Creates protocol using loaded protocol definition files.

Parameters:
[in]scpProtocolNameProtocol name (attribute 'id' in the XML file) to create parser for
[in]appProtocolsSet of application level protocol. Required if SCP protocol is FIXT 1.1.
Globex::MDApplication* Engine::FixEngine::createMDApplication ( Globex::MDApplicationParams const &  params,
Globex::MDApplicationListener appListener = NULL 
)

Creates instance of the CME Globex FIX/FAST adapter.

Globex::MDApplication* Engine::FixEngine::createMDApplication ( Globex::MDApplicationParams const &  params,
Globex::DataReaderAbstract *  dataReader,
Globex::MDApplicationListener appListener = NULL 
)
Note:
For testing purposes only.
micex_mfix::micex_mfix_application* Engine::FixEngine::createMICEXApplication ( micex_mfix::micex_mfix_application_params const &  params,
micex_mfix::micex_mfix_application_listener appListener = NULL 
)

Creates instance of the MICEX MFIX adapter.

micex_mfix::micex_mfix_application* Engine::FixEngine::createMICEXApplication ( micex_mfix::micex_mfix_application_params const &  params,
micex_mfix::mfix_data_reader_abstract *  dataReader,
micex_mfix::micex_mfix_application_listener appListener = NULL 
)
Note:
For testing puproses only
ProtocolID Engine::FixEngine::createProtocol ( std::string const &  name,
FIXVersion  baseVer,
std::string const &  additionalXml 
)

Register new custom FIX Protocol and returns its identifier.

Parameters:
nameUnique name of the protocol
baseVerBase FIX Version
additionalXmlFIX Protocol customization file
Exceptions:
Utils::ExceptionIf protocol with given name already exists or additionalXml points to default additional.xml file.
Returns:
Unique FIX protocol identifier
Session* Engine::FixEngine::createSession ( Application pApp,
const std::string &  senderCompID,
const std::string &  targetCompID,
ProtocolID  scpID,
const SessionExtraParameters pParam = NULL,
const MessageStorageType  storageType = persistentMM_storageType,
FIXVersion  defaultAppProtocol = NA 
)

Creates a new FIX Session.

Parameters:
pAppa pointer to the Application that will process the incoming messages.
senderCompIDSenderCompID of the session.
targetCompIDTargetCompID of the session.
scpIDFIX session control protocol identifier.
pParaman option session parameters, can be NULL.
storageTypeMessage storage type
defaultAppProtocolDefault application FIX protocol version. Required if protocolID points to FIXT 1.1 protocol.
Warning:
Do not delete the Application while the session is not terminated.
Note:
two sessions with the same values of senderCompID and targetCompID can not be created.
Returns:
a pointer to the created session.
Session* Engine::FixEngine::createSession ( Application pApp,
const std::string &  senderCompID,
const std::string &  targetCompID,
FIXVersion  appVer,
const SessionExtraParameters pParam = NULL,
const MessageStorageType  storageType = persistentMM_storageType,
UnderlyingProtocol  underlyingProtocolType = FIX_TCP 
)

Creates a new FIX Session.

Parameters:
pAppa pointer to the Application that will process the incoming messages.
senderCompIDSenderCompID of the session.
targetCompIDTargetCompID of the session.
appVerApplication FIX protocol version or default application FIX protocol in case of FIXT 1.1 session.
pParaman option session parameters, can be NULL.
storageType- type of the message storage
Warning:
Do not delete the Application while the session is not terminated.
Note:
two sessions with the same values of senderCompID and targetCompID can not be created.
Returns:
a pointer to the created session.
Session* Engine::FixEngine::createSession ( Application pApp,
const std::string &  senderCompID,
const std::string &  targetCompID,
const std::string &  protocolName,
const SessionExtraParameters pParam = NULL,
const MessageStorageType  storageType = persistentMM_storageType,
FIXVersion  defaultAppProtocol = NA 
)

Creates a new FIX Session.

Parameters:
pAppa pointer to the Application that will process the incoming messages.
senderCompIDSenderCompID of the session.
targetCompIDTargetCompID of the session.
protocolNameName of the protocol ('id' attribute in the FIX Dictionary file). FIX Parser for this protocol should be created.
See also:
Engine::FixEngine::createFixParser.
Parameters:
pParaman option session parameters, can be NULL.
storageType- type of the message storage
defaultAppProtocolDefault application FIX protocol version. Required if underlyingProtocolType equals FIXT11_TCP or protocolID points to FIXT 1.1 protocol.
Warning:
Do not delete the Application while the session is not terminated.
Note:
two sessions with the same values of senderCompID and targetCompID can not be created.
Returns:
a pointer to the created session.
static void Engine::FixEngine::destroy (  ) [static]

Destroys the instance of this class.

Note:
Must be called after the using of FIX Engine to free the allocated resources.
AdminApplication* Engine::FixEngine::getAdminApplication (  )

Returns administrative application.

If there is no registered custom application, embedded is returned.

FIXVersion Engine::FixEngine::getBaseProtocol ( ProtocolID  protocolID ) const

Returns base FIX protocol version.

Exceptions:
Utils::ExceptionIf protocol with given ID is not found.
Returns:
base FIX protocol version.
FixDictionary2::DictionaryT::CPtr Engine::FixEngine::getDictionary (  ) const

Returns reference to protocol dictionary.

static const EngineProperties Engine::FixEngine::GetEnginePropertiesDefaults (  ) [static]

Retrieves properties defaults.

Returns:
FIX Engine configuration parameters
static std::string Engine::FixEngine::getEngineVersion (  ) [static]

Returns version of the FixEngine.

Returns:
version of the FixEngine
int Engine::FixEngine::getListenPort (  )

Returns Engine's listen port.

const FAProperties* Engine::FixEngine::getProperties (  ) const

Returns settings.

ProtocolID Engine::FixEngine::getProtocolID ( const std::string &  name ) const

Returns unique protocol ID.

Parameters:
[in]Uniqueprotocol name
Exceptions:
Utils::ExceptionIf protocol with given name is not found.
Returns:
unique protocol ID.
Engine::AsciiString Engine::FixEngine::getProtocolName ( ProtocolID  protocolID ) const

Returns unique protocol name.

Parameters:
[in]protocolIDUnique protocol ID
Exceptions:
Utils::ExceptionIf protocol with given ID is not found.
Returns:
unique protocol name.
Engine::SessionsManager* Engine::FixEngine::getSessionsManager (  )

Returns the current SessionsManager.

MessageStorageType Engine::FixEngine::getSessionStorageType (  ) const

Returns the default unregistered session's storage type.

Returns:
type storage type that will be used in new sessions.
void Engine::FixEngine::getStatistics ( Statistics apS )

Returns the statistical information.

Parameters:
[out]apSInstance of Statistics to store result.
static FixEngine* Engine::FixEngine::init ( const EngineProperties engineProperties ) [static]

Initializes the Engine.

Parameters:
propertiesFileNamethe FIX Engine configuration parameters.
Returns:
pointer to an instance of this class.
Note:
Must be called before any other method of this library.
static FixEngine* Engine::FixEngine::init ( const std::string &  propertiesFileName = "",
int  listenPort = -1,
const std::string &  engineRoot = "",
const std::string &  additionalFields = "" 
) [static]

Initializes the Engine.

Parameters:
propertiesFileNamethe FIX Engine configuration parameters file name. If it is equal to "", then "./engine.properties" is used.
listenPortEngine's listen port. Overrides the value from the properties file. If it is equal to -1 then the value from the proterties file is used.
engineRootThe top of the directory tree under which the engine's configuration, and log files are kept. Do NOT add a slash at the end of the directory path. Overrides the value from the properties file. If it is equal to "", then the value from the properties file is used.
additionalFieldsSpecifies additional messages fields.
Returns:
pointer to an instance of this class.
Note:
Must be called before any other method of this library.
void Engine::FixEngine::loadProtocolFile ( std::string const &  fileName )

Loads protocol definition/customization file.

Parameters:
[in]fileNamePath to the protocol file
void Engine::FixEngine::registerAdminApplication ( AdminApplication app )

Register administrative application.

Parameters:
appcustom administrative application.
Exceptions:
Utils::Exceptionif administrative application already registered.
void Engine::FixEngine::registerEventListener ( Engine::EventListener apListener )

Registers the given EventListener with FixEngine.

Parameters:
apListenerEventListener
void Engine::FixEngine::registerSessionsManager ( SessionsManager apManager )

Registers SessionsManager with the engine.

Parameters:
apManagerInstance of SessionsManager.
static void Engine::FixEngine::setAdditionalFields ( const std::string &  propertiesFileName = "",
const std::string &  engineRoot = "",
const std::string &  additionalFields = "" 
) [static]

Initializes the additional fields.

Parameters:
propertiesFileNamethe FIX Engine configuration parameters file name. If it is equal to "", then "./engine.properties" is used.
engineRootThe top of the directory tree under which the engine's configuration, and log files are kept. Do NOT add a slash at the end of the directory path. Overrides the value from the properties file. If it is equal to "", then the value from the proterties file is used.
additionalFieldsSpecifies additional messages fields.
Note:
Do not use it with init() method.
void Engine::FixEngine::setSessionStorageType ( const MessageStorageType  type )

Sets the default unregistered session's storage type.

Parameters:
typestorage type that will be used in new sessions.
static FixEngine* Engine::FixEngine::singleton (  ) [static]

Returns an instance of this class.

Returns:
pointer to an instance of this class.
See also:
init()
void Engine::FixEngine::stop ( void   )

Stops the engine's worker threads.

bool Engine::FixEngine::unregisterEventListener ( Engine::EventListener apListener )

Unregisters the given EventListener.

Parameters:
apListenerEventListener
Returns:
true if the EventListener was found, otherwise false.