OdbcLog.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 
3 /****************************************************************************
4 ** Copyright (c) 2001-2014
5 **
6 ** This file is part of the QuickFIX FIX Engine
7 **
8 ** This file may be distributed under the terms of the quickfixengine.org
9 ** license as defined by quickfixengine.org and appearing in the file
10 ** LICENSE included in the packaging of this file.
11 **
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 **
15 ** See http://www.quickfixengine.org/LICENSE for licensing information.
16 **
17 ** Contact ask@quickfixengine.org if any conditions of this licensing are
18 ** not clear to you.
19 **
20 ****************************************************************************/
21 
22 #ifndef HAVE_ODBC
23 #error OdbcLog.h included, but HAVE_ODBC not defined
24 #endif
25 
26 #ifdef HAVE_ODBC
27 #ifndef FIX_ODBCLOG_H
28 #define FIX_ODBCLOG_H
29 
30 #ifdef _MSC_VER
31 #pragma warning( disable : 4503 4355 4786 4290 )
32 #endif
33 
34 #include "OdbcConnection.h"
35 #include "Log.h"
36 #include "SessionSettings.h"
37 #include <fstream>
38 #include <string>
39 
40 namespace FIX
41 {
43 class OdbcLog : public Log
44 {
45 public:
46  OdbcLog( const SessionID& s, const std::string& user, const std::string& password,
47  const std::string& connectionString );
48  OdbcLog( const std::string& user, const std::string& password,
49  const std::string& connectionString );
50 
51  ~OdbcLog();
52 
53  void clear();
54  void backup();
55  void setIncomingTable( const std::string& incomingTable )
56  { m_incomingTable = incomingTable; }
57  void setOutgoingTable( const std::string& outgoingTable )
58  { m_outgoingTable = outgoingTable; }
59  void setEventTable( const std::string& eventTable )
60  { m_eventTable = eventTable; }
61 
62  void onIncoming( const std::string& value )
63  { insert( m_incomingTable, value ); }
64  void onOutgoing( const std::string& value )
65  { insert( m_outgoingTable, value ); }
66  void onEvent( const std::string& value )
67  { insert( m_eventTable, value ); }
68 
69 private:
70  void init();
71  void insert( const std::string& table, const std::string value );
72 
73  std::string m_incomingTable;
74  std::string m_outgoingTable;
75  std::string m_eventTable;
76  OdbcConnection* m_pConnection;
77  SessionID* m_pSessionID;
78 };
79 
81 class OdbcLogFactory : public LogFactory
82 {
83 public:
84  static const std::string DEFAULT_USER;
85  static const std::string DEFAULT_PASSWORD;
86  static const std::string DEFAULT_CONNECTION_STRING;
87 
88  OdbcLogFactory( const SessionSettings& settings )
89  : m_settings( settings ), m_useSettings( true ) {}
90 
91  OdbcLogFactory( const std::string& user, const std::string& password,
92  const std::string& connectionString );
93 
94  OdbcLogFactory();
95 
96  ~OdbcLogFactory();
97 
98  Log* create();
99  Log* create( const SessionID& );
100  void destroy( Log* );
101 private:
102  void init( const Dictionary& settings,
103  std::string& user, std::string& password,
104  std::string& connectionString );
105 
106  void initLog( const Dictionary& settings, OdbcLog& log );
107 
108  SessionSettings m_settings;
109  std::string m_user;
110  std::string m_password;
111  std::string m_connectionString;
112  bool m_useSettings;
113 };
114 }
115 
116 #endif
117 #endif
SessionSettings.h
OdbcConnection.h
FIX
Definition: Acceptor.cpp:34
Log.h

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001