SessionFactory.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* -*- C++ -*- */
  2. /****************************************************************************
  3. ** Copyright (c) 2001-2014
  4. **
  5. ** This file is part of the QuickFIX FIX Engine
  6. **
  7. ** This file may be distributed under the terms of the quickfixengine.org
  8. ** license as defined by quickfixengine.org and appearing in the file
  9. ** LICENSE included in the packaging of this file.
  10. **
  11. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  12. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. **
  14. ** See http://www.quickfixengine.org/LICENSE for licensing information.
  15. **
  16. ** Contact ask@quickfixengine.org if any conditions of this licensing are
  17. ** not clear to you.
  18. **
  19. ****************************************************************************/
  20. #ifndef FIX_SESSIONFACTORY_H
  21. #define FIX_SESSIONFACTORY_H
  22. #ifdef _MSC_VER
  23. #pragma warning( disable : 4503 4355 4786 4290 )
  24. #endif
  25. #include "Log.h"
  26. #include "Exceptions.h"
  27. #include "Dictionary.h"
  28. namespace FIX
  29. {
  30. class SessionID;
  31. class Session;
  32. class Application;
  33. class MessageStoreFactory;
  34. class DataDictionaryProvider;
  35. /** Responsible for creating Session objects. This factory will use
  36. * QuickFIX SessionID, Dictionary settings, MessageStoreFactory, and
  37. * optional LogFactory to create all the required sessions for an
  38. * Application.
  39. */
  40. class SessionFactory
  41. {
  42. public:
  43. SessionFactory( Application& application,
  44. MessageStoreFactory& messageStoreFactory,
  45. LogFactory* pLogFactory )
  46. : m_application( application ),
  47. m_messageStoreFactory( messageStoreFactory ),
  48. m_pLogFactory( pLogFactory ) {}
  49. ~SessionFactory();
  50. Session* create( const SessionID& sessionID,
  51. const Dictionary& settings ) throw( ConfigError );
  52. void destroy( Session* pSession );
  53. private:
  54. typedef std::map < std::string, DataDictionary* > Dictionaries;
  55. const DataDictionary * createDataDictionary(const SessionID& sessionID,
  56. const Dictionary& settings,
  57. const std::string& settingsKey) throw(ConfigError);
  58. void processFixtDataDictionaries(const SessionID& sessionID,
  59. const Dictionary& settings,
  60. DataDictionaryProvider& provider) throw(ConfigError);
  61. void processFixDataDictionary(const SessionID& sessionID,
  62. const Dictionary& settings,
  63. DataDictionaryProvider& provider) throw(ConfigError);
  64. std::string toApplVerID(const std::string& value);
  65. Application& m_application;
  66. MessageStoreFactory& m_messageStoreFactory;
  67. LogFactory* m_pLogFactory;
  68. Dictionaries m_dictionaries;
  69. };
  70. }
  71. #endif