QuickFIX: /home/omiller/Development/autobuild/quickfix/src/C++/OdbcLog.h Source File

Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# OdbcLog.h

Go to the documentation of this file.

    00001 /* -*- C++ -*- */
    00002
    00003 /****************************************************************************
    00004 ** Copyright (c) quickfixengine.org  All rights reserved.
    00005 **
    00006 ** This file is part of the QuickFIX FIX Engine
    00007 **
    00008 ** This file may be distributed under the terms of the quickfixengine.org
    00009 ** license as defined by quickfixengine.org and appearing in the file
    00010 ** LICENSE included in the packaging of this file.
    00011 **
    00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00014 **
    00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
    00016 **
    00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
    00018 ** not clear to you.
    00019 **
    00020 ****************************************************************************/
    00021
    00022 #ifndef HAVE_ODBC
    00023 #error OdbcLog.h included, but HAVE_ODBC not defined
    00024 #endif
    00025
    00026 #ifdef HAVE_ODBC
    00027 #ifndef FIX_ODBCLOG_H
    00028 #define FIX_ODBCLOG_H
    00029
    00030 #ifdef _MSC_VER
    00031 #pragma warning( disable : 4503 4355 4786 4290 )
    00032 #endif
    00033
    00034 #include "OdbcConnection.h"
    00035 #include "Log.h"
    00036 #include "SessionSettings.h"
    00037 #include <fstream>
    00038 #include <string>
    00039
    00040 namespace FIX
    00041 {
    00043 class OdbcLog : public Log
    00044 {
    00045 public:
    00046   OdbcLog( const SessionID& s, const std::string& user, const std::string& password,
    00047            const std::string& connectionString );
    00048   OdbcLog( const std::string& user, const std::string& password,
    00049            const std::string& connectionString );
    00050
    00051   ~OdbcLog();
    00052
    00053   void clear();
    00054   void backup();
    00055   void setIncomingTable( const std::string& incomingTable )
    00056   { m_incomingTable = incomingTable; }
    00057   void setOutgoingTable( const std::string& outgoingTable )
    00058   { m_outgoingTable = outgoingTable; }
    00059   void setEventTable( const std::string& eventTable )
    00060   { m_eventTable = eventTable; }
    00061
    00062   void onIncoming( const std::string& value )
    00063   { insert( m_incomingTable, value ); }
    00064   void onOutgoing( const std::string& value )
    00065   { insert( m_outgoingTable, value ); }
    00066   void onEvent( const std::string& value )
    00067   { insert( m_eventTable, value ); }
    00068
    00069 private:
    00070   void init();
    00071   void insert( const std::string& table, const std::string value );
    00072
    00073   std::string m_incomingTable;
    00074   std::string m_outgoingTable;
    00075   std::string m_eventTable;
    00076   OdbcConnection* m_pConnection;
    00077   SessionID* m_pSessionID;
    00078 };
    00079
    00081 class OdbcLogFactory : public LogFactory
    00082 {
    00083 public:
    00084   static const std::string DEFAULT_USER;
    00085   static const std::string DEFAULT_PASSWORD;
    00086   static const std::string DEFAULT_CONNECTION_STRING;
    00087
    00088   OdbcLogFactory( const SessionSettings& settings )
    00089   : m_settings( settings ), m_useSettings( true ) {}
    00090
    00091   OdbcLogFactory( const std::string& user, const std::string& password,
    00092                   const std::string& connectionString );
    00093
    00094   OdbcLogFactory();
    00095
    00096   ~OdbcLogFactory();
    00097
    00098   Log* create();
    00099   Log* create( const SessionID& );
    00100   void destroy( Log* );
    00101 private:
    00102   void init( const Dictionary& settings,
    00103              std::string& user, std::string& password,
    00104              std::string& connectionString );
    00105
    00106   void initLog( const Dictionary& settings, OdbcLog& log );
    00107
    00108   SessionSettings m_settings;
    00109   std::string m_user;
    00110   std::string m_password;
    00111   std::string m_connectionString;
    00112   bool m_useSettings;
    00113 };
    00114 }
    00115
    00116 #endif
    00117 #endif