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

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

# OdbcStore.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 OdbcStore.h included, but HAVE_ODBC not defined
    00024 #endif
    00025
    00026 #ifdef HAVE_ODBC
    00027 #ifndef FIX_ODBCSTORE_H
    00028 #define FIX_ODBCSTORE_H
    00029
    00030 #ifdef _MSC_VER
    00031 #pragma warning( disable : 4503 4355 4786 4290 )
    00032 #endif
    00033
    00034 #include "OdbcConnection.h"
    00035 #include "MessageStore.h"
    00036 #include "SessionSettings.h"
    00037 #include <fstream>
    00038 #include <string>
    00039
    00040 namespace FIX
    00041 {
    00043 class OdbcStoreFactory : public MessageStoreFactory
    00044 {
    00045 public:
    00046   static const std::string DEFAULT_USER;
    00047   static const std::string DEFAULT_PASSWORD;
    00048   static const std::string DEFAULT_CONNECTION_STRING;
    00049
    00050   OdbcStoreFactory( const SessionSettings& settings )
    00051 : m_settings( settings ), m_useSettings( true ), m_useDictionary( false ) {}
    00052
    00053   OdbcStoreFactory( const Dictionary& dictionary )
    00054 : m_dictionary( dictionary ), m_useSettings( false ), m_useDictionary( true ) {}
    00055
    00056   OdbcStoreFactory( const std::string& user, const std::string& password,
    00057                     const std::string& connectionString )
    00058 : m_user( user ), m_password( password ), m_connectionString( connectionString ),
    00059   m_useSettings( false ), m_useDictionary( false ) {}
    00060
    00061   OdbcStoreFactory()
    00062 : m_user( DEFAULT_USER ), m_password( DEFAULT_PASSWORD ),
    00063   m_connectionString( DEFAULT_CONNECTION_STRING ), m_useSettings( false ), m_useDictionary( false ) {}
    00064
    00065   MessageStore* create( const SessionID& );
    00066   void destroy( MessageStore* );
    00067 private:
    00068   MessageStore* create( const SessionID& s, const Dictionary& );
    00069
    00070   Dictionary m_dictionary;
    00071   SessionSettings m_settings;
    00072   std::string m_user;
    00073   std::string m_password;
    00074   std::string m_connectionString;
    00075   bool m_useSettings;
    00076   bool m_useDictionary;
    00077 };
    00080
    00081 class OdbcStore : public MessageStore
    00082 {
    00083 public:
    00084   OdbcStore( const SessionID& s, const std::string& user, const std::string& password,
    00085              const std::string& connectionString );
    00086   ~OdbcStore();
    00087
    00088   bool set( int, const std::string& ) throw ( IOException );
    00089   void get( int, int, std::vector < std::string > & ) const throw ( IOException );
    00090
    00091   int getNextSenderMsgSeqNum() const throw ( IOException );
    00092   int getNextTargetMsgSeqNum() const throw ( IOException );
    00093   void setNextSenderMsgSeqNum( int value ) throw ( IOException );
    00094   void setNextTargetMsgSeqNum( int value ) throw ( IOException );
    00095   void incrNextSenderMsgSeqNum() throw ( IOException );
    00096   void incrNextTargetMsgSeqNum() throw ( IOException );
    00097
    00098   UtcTimeStamp getCreationTime() const throw ( IOException );
    00099
    00100   void reset() throw ( IOException );
    00101   void refresh() throw ( IOException );
    00102
    00103 private:
    00104   void populateCache();
    00105
    00106   OdbcConnection* m_pConnection;
    00107   MemoryStore m_cache;
    00108   SessionID m_sessionID;
    00109 };
    00110 }
    00111
    00112 #endif
    00113 #endif