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

MessageStore.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (c) quickfixengine.org  All rights reserved.
00003 **
00004 ** This file is part of the QuickFIX FIX Engine
00005 **
00006 ** This file may be distributed under the terms of the quickfixengine.org
00007 ** license as defined by quickfixengine.org and appearing in the file
00008 ** LICENSE included in the packaging of this file.
00009 **
00010 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00011 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00012 **
00013 ** See http://www.quickfixengine.org/LICENSE for licensing information.
00014 **
00015 ** Contact ask@quickfixengine.org if any conditions of this licensing are
00016 ** not clear to you.
00017 **
00018 ****************************************************************************/
00019 
00020 #ifdef _MSC_VER
00021 #include "stdafx.h"
00022 #else
00023 #include "config.h"
00024 #endif
00025 #include "CallStack.h"
00026 
00027 #include "MessageStore.h"
00028 
00029 namespace FIX
00030 {
00031 MessageStore* MemoryStoreFactory::create( const SessionID& )
00032 { QF_STACK_PUSH(MemoryStoreFactory::create)
00033   return new MemoryStore();
00034   QF_STACK_POP
00035 }
00036 
00037 void MemoryStoreFactory::destroy( MessageStore* pStore )
00038 { QF_STACK_PUSH(MemoryStoreFactory::destroy)
00039   delete pStore;
00040   QF_STACK_POP
00041 }
00042 
00043 bool MemoryStore::set( int msgSeqNum, const std::string& msg )
00044 throw( IOException )
00045 { QF_STACK_PUSH(MemoryStore::set)
00046   m_messages[ msgSeqNum ] = msg;
00047   return true;
00048   QF_STACK_POP
00049 }
00050 
00051 void MemoryStore::get( int begin, int end,
00052                        std::vector < std::string > & messages ) const
00053 throw( IOException )
00054 { QF_STACK_PUSH(MemoryStore::get)
00055 
00056   messages.clear();
00057   Messages::const_iterator find = m_messages.find( begin );
00058   for ( ; find != m_messages.end() && find->first <= end; ++find )
00059     messages.push_back( find->second );
00060 
00061   QF_STACK_POP
00062 }
00063 
00064 MessageStore* MessageStoreFactoryExceptionWrapper::create( const SessionID& sessionID, bool& threw, ConfigError& ex )
00065 { QF_STACK_PUSH(MessageStoreFactoryExceptionWrapper::create)
00066 
00067   threw = false;
00068   try { return m_pFactory->create( sessionID ); }
00069   catch ( ConfigError & e ) { threw = true; ex = e; return 0; }
00070 
00071   QF_STACK_POP
00072 }
00073 
00074 void MessageStoreFactoryExceptionWrapper::destroy( MessageStore* pStore )
00075 { QF_STACK_PUSH(MessageStoreFactoryExceptionWrapper::destroy)
00076   m_pFactory->destroy( pStore );
00077   QF_STACK_POP
00078 }
00079 
00080 bool MessageStoreExceptionWrapper::set( int num, const std::string& msg, bool& threw, IOException& ex )
00081 { QF_STACK_PUSH(MessageStoreExceptionWrapper::set)
00082 
00083   threw = false;
00084   try { return m_pStore->set( num, msg ); }
00085   catch ( IOException & e ) { threw = true; ex = e; return false; }
00086 
00087   QF_STACK_POP
00088 }
00089 
00090 void MessageStoreExceptionWrapper::get( int begin, int end, std::vector < std::string > & msgs, bool& threw, IOException& ex ) const
00091 { QF_STACK_PUSH(MessageStoreExceptionWrapper::get)
00092 
00093   threw = false;
00094   try { m_pStore->get( begin, end, msgs ); }
00095   catch ( IOException & e ) { threw = true; ex = e; }
00096 
00097   QF_STACK_POP
00098 }
00099 
00100 int MessageStoreExceptionWrapper::getNextSenderMsgSeqNum( bool& threw, IOException& ex ) const
00101 { QF_STACK_PUSH(MessageStoreExceptionWrapper::getNextSenderMsgSeqNum)
00102 
00103   threw = false;
00104   try { return m_pStore->getNextSenderMsgSeqNum(); }
00105   catch ( IOException & e ) { threw = true; ex = e; return 0; }
00106 
00107   QF_STACK_POP
00108 }
00109 
00110 int MessageStoreExceptionWrapper::getNextTargetMsgSeqNum( bool& threw, IOException& ex ) const
00111 { QF_STACK_PUSH(MessageStoreExceptionWrapper::getNextTargetMsgSeqNum)
00112 
00113   threw = false;
00114   try { return m_pStore->getNextTargetMsgSeqNum(); }
00115   catch ( IOException & e ) { threw = true; ex = e; return 0; }
00116 
00117   QF_STACK_POP
00118 }
00119 
00120 void MessageStoreExceptionWrapper::setNextSenderMsgSeqNum( int num, bool& threw, IOException& ex )
00121 { QF_STACK_PUSH(MessageStoreExceptionWrapper::setNextSenderMsgSeqNum)
00122 
00123   threw = false;
00124   try { m_pStore->setNextSenderMsgSeqNum( num ); }
00125   catch ( IOException & e ) { threw = true; ex = e; }
00126 
00127   QF_STACK_POP
00128 }
00129 
00130 void MessageStoreExceptionWrapper::setNextTargetMsgSeqNum( int num, bool& threw, IOException& ex )
00131 { QF_STACK_PUSH(MessageStoreExceptionWrapper::setNextTargetMsgSeqNum)
00132 
00133   threw = false;
00134   try { m_pStore->setNextTargetMsgSeqNum( num ); }
00135   catch ( IOException & e ) { threw = true; ex = e; }
00136 
00137   QF_STACK_POP
00138 }
00139 
00140 void MessageStoreExceptionWrapper::incrNextSenderMsgSeqNum( bool& threw, IOException& ex )
00141 { QF_STACK_PUSH(MessageStoreExceptionWrapper::incrNextSenderMsgSeqNum)
00142 
00143   threw = false;
00144   try { m_pStore->incrNextSenderMsgSeqNum(); }
00145   catch ( IOException & e ) { threw = true; ex = e; }
00146 
00147   QF_STACK_POP
00148 }
00149 
00150 void MessageStoreExceptionWrapper::incrNextTargetMsgSeqNum( bool& threw, IOException& ex )
00151 { QF_STACK_PUSH(MessageStoreExceptionWrapper::incrNextTargetMsgSeqNum)
00152 
00153   threw = false;
00154   try { m_pStore->incrNextTargetMsgSeqNum(); }
00155   catch ( IOException & e ) { threw = true; ex = e; }
00156 
00157   QF_STACK_POP
00158 }
00159 
00160 UtcTimeStamp MessageStoreExceptionWrapper::getCreationTime( bool& threw, IOException& ex )
00161 { QF_STACK_PUSH(MessageStoreExceptionWrapper::getCreationTime)
00162 
00163   threw = false;
00164   try { return m_pStore->getCreationTime(); }
00165   catch ( IOException & e ) { threw = true; ex = e; return UtcTimeStamp(); }
00166 
00167   QF_STACK_POP
00168 }
00169 
00170 void MessageStoreExceptionWrapper::reset( bool& threw, IOException& ex )
00171 { QF_STACK_PUSH(MessageStoreExceptionWrapper::reset)
00172 
00173   threw = false;
00174   try { m_pStore->reset(); }
00175   catch ( IOException & e ) { threw = true; ex = e; }
00176 
00177   QF_STACK_POP
00178 }
00179 
00180 void MessageStoreExceptionWrapper::refresh( bool& threw, IOException& ex )
00181 { QF_STACK_PUSH(MessageStoreExceptionWrapper::reset)
00182 
00183   threw = false;
00184   try { m_pStore->refresh(); }
00185   catch ( IOException & e ) { threw = true; ex = e; }
00186 
00187   QF_STACK_POP
00188 }
00189 
00190 } //namespace FIX

Generated on Mon Apr 5 20:59:50 2010 for QuickFIX by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2001