MessageStore.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (c) 2001-2014
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 
00026 #include "MessageStore.h"
00027 
00028 namespace FIX
00029 {
00030 MessageStore* MemoryStoreFactory::create( const SessionID& )
00031 {
00032   return new MemoryStore();
00033 }
00034 
00035 void MemoryStoreFactory::destroy( MessageStore* pStore )
00036 {
00037   delete pStore;
00038 }
00039 
00040 bool MemoryStore::set( int msgSeqNum, const std::string& msg )
00041 throw( IOException )
00042 {
00043   m_messages[ msgSeqNum ] = msg;
00044   return true;
00045 }
00046 
00047 void MemoryStore::get( int begin, int end,
00048                        std::vector < std::string > & messages ) const
00049 throw( IOException )
00050 {
00051   messages.clear();
00052   Messages::const_iterator find = m_messages.find( begin );
00053   for ( ; find != m_messages.end() && find->first <= end; ++find )
00054     messages.push_back( find->second );
00055 }
00056 
00057 MessageStore* MessageStoreFactoryExceptionWrapper::create( const SessionID& sessionID, bool& threw, ConfigError& ex )
00058 {
00059   threw = false;
00060   try { return m_pFactory->create( sessionID ); }
00061   catch ( ConfigError & e ) { threw = true; ex = e; return 0; }
00062 }
00063 
00064 void MessageStoreFactoryExceptionWrapper::destroy( MessageStore* pStore )
00065 {
00066   m_pFactory->destroy( pStore );
00067 }
00068 
00069 bool MessageStoreExceptionWrapper::set( int num, const std::string& msg, bool& threw, IOException& ex )
00070 {
00071   threw = false;
00072   try { return m_pStore->set( num, msg ); }
00073   catch ( IOException & e ) { threw = true; ex = e; return false; }
00074 }
00075 
00076 void MessageStoreExceptionWrapper::get( int begin, int end, std::vector < std::string > & msgs, bool& threw, IOException& ex ) const
00077 {
00078   threw = false;
00079   try { m_pStore->get( begin, end, msgs ); }
00080   catch ( IOException & e ) { threw = true; ex = e; }
00081 }
00082 
00083 int MessageStoreExceptionWrapper::getNextSenderMsgSeqNum( bool& threw, IOException& ex ) const
00084 {
00085   threw = false;
00086   try { return m_pStore->getNextSenderMsgSeqNum(); }
00087   catch ( IOException & e ) { threw = true; ex = e; return 0; }
00088 }
00089 
00090 int MessageStoreExceptionWrapper::getNextTargetMsgSeqNum( bool& threw, IOException& ex ) const
00091 {
00092   threw = false;
00093   try { return m_pStore->getNextTargetMsgSeqNum(); }
00094   catch ( IOException & e ) { threw = true; ex = e; return 0; }
00095 }
00096 
00097 void MessageStoreExceptionWrapper::setNextSenderMsgSeqNum( int num, bool& threw, IOException& ex )
00098 {
00099   threw = false;
00100   try { m_pStore->setNextSenderMsgSeqNum( num ); }
00101   catch ( IOException & e ) { threw = true; ex = e; }
00102 }
00103 
00104 void MessageStoreExceptionWrapper::setNextTargetMsgSeqNum( int num, bool& threw, IOException& ex )
00105 {
00106   threw = false;
00107   try { m_pStore->setNextTargetMsgSeqNum( num ); }
00108   catch ( IOException & e ) { threw = true; ex = e; }
00109 }
00110 
00111 void MessageStoreExceptionWrapper::incrNextSenderMsgSeqNum( bool& threw, IOException& ex )
00112 {
00113   threw = false;
00114   try { m_pStore->incrNextSenderMsgSeqNum(); }
00115   catch ( IOException & e ) { threw = true; ex = e; }
00116 }
00117 
00118 void MessageStoreExceptionWrapper::incrNextTargetMsgSeqNum( bool& threw, IOException& ex )
00119 {
00120   threw = false;
00121   try { m_pStore->incrNextTargetMsgSeqNum(); }
00122   catch ( IOException & e ) { threw = true; ex = e; }
00123 }
00124 
00125 UtcTimeStamp MessageStoreExceptionWrapper::getCreationTime( bool& threw, IOException& ex )
00126 {
00127   threw = false;
00128   try { return m_pStore->getCreationTime(); }
00129   catch ( IOException & e ) { threw = true; ex = e; return UtcTimeStamp(); }
00130 }
00131 
00132 void MessageStoreExceptionWrapper::reset( bool& threw, IOException& ex )
00133 {
00134   threw = false;
00135   try { m_pStore->reset(); }
00136   catch ( IOException & e ) { threw = true; ex = e; }
00137 }
00138 
00139 void MessageStoreExceptionWrapper::refresh( bool& threw, IOException& ex )
00140 {
00141   threw = false;
00142   try { m_pStore->refresh(); }
00143   catch ( IOException & e ) { threw = true; ex = e; }
00144 }
00145 
00146 } //namespace FIX

Generated on Mon Sep 15 2014 01:23:54 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001