MessageStore.cpp
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (c) 2001-2014
3**
4** This file is part of the QuickFIX FIX Engine
5**
6** This file may be distributed under the terms of the quickfixengine.org
7** license as defined by quickfixengine.org and appearing in the file
8** LICENSE included in the packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13** See http://www.quickfixengine.org/LICENSE for licensing information.
14**
15** Contact ask@quickfixengine.org if any conditions of this licensing are
16** not clear to you.
17**
18****************************************************************************/
19
20#ifdef _MSC_VER
21#include "stdafx.h"
22#else
23#include "config.h"
24#endif
25
26#include "MessageStore.h"
27
28namespace FIX
29{
34
36{
37 delete pStore;
38}
39
40bool MemoryStore::set( int msgSeqNum, const std::string& msg )
41throw( IOException )
42{
43 m_messages[ msgSeqNum ] = msg;
44 return true;
45}
46
47void MemoryStore::get( int begin, int end,
48 std::vector < std::string > & messages ) const
49throw( IOException )
50{
51 messages.clear();
52 Messages::const_iterator find = m_messages.find( begin );
53 for ( ; find != m_messages.end() && find->first <= end; ++find )
54 messages.push_back( find->second );
55}
56
58{
59 threw = false;
60 try { return m_pFactory->create( sessionID ); }
61 catch ( ConfigError & e ) { threw = true; ex = e; return 0; }
62}
63
68
69bool MessageStoreExceptionWrapper::set( int num, const std::string& msg, bool& threw, IOException& ex )
70{
71 threw = false;
72 try { return m_pStore->set( num, msg ); }
73 catch ( IOException & e ) { threw = true; ex = e; return false; }
74}
75
76void MessageStoreExceptionWrapper::get( int begin, int end, std::vector < std::string > & msgs, bool& threw, IOException& ex ) const
77{
78 threw = false;
79 try { m_pStore->get( begin, end, msgs ); }
80 catch ( IOException & e ) { threw = true; ex = e; }
81}
82
84{
85 threw = false;
86 try { return m_pStore->getNextSenderMsgSeqNum(); }
87 catch ( IOException & e ) { threw = true; ex = e; return 0; }
88}
89
91{
92 threw = false;
93 try { return m_pStore->getNextTargetMsgSeqNum(); }
94 catch ( IOException & e ) { threw = true; ex = e; return 0; }
95}
96
98{
99 threw = false;
101 catch ( IOException & e ) { threw = true; ex = e; }
102}
103
105{
106 threw = false;
108 catch ( IOException & e ) { threw = true; ex = e; }
109}
110
112{
113 threw = false;
115 catch ( IOException & e ) { threw = true; ex = e; }
116}
117
119{
120 threw = false;
122 catch ( IOException & e ) { threw = true; ex = e; }
123}
124
126{
127 threw = false;
128 try { return m_pStore->getCreationTime(); }
129 catch ( IOException & e ) { threw = true; ex = e; return UtcTimeStamp(); }
130}
131
133{
134 threw = false;
135 try { m_pStore->reset(); }
136 catch ( IOException & e ) { threw = true; ex = e; }
137}
138
140{
141 threw = false;
142 try { m_pStore->refresh(); }
143 catch ( IOException & e ) { threw = true; ex = e; }
144}
145
146} //namespace FIX
void destroy(MessageStore *)
MessageStore * create(const SessionID &)
Memory based implementation of MessageStore.
void get(int, int, std::vector< std::string > &) const
bool set(int, const std::string &)
void incrNextSenderMsgSeqNum(bool &, IOException &)
void setNextSenderMsgSeqNum(int, bool &, IOException &)
void refresh(bool &, IOException &)
int getNextSenderMsgSeqNum(bool &, IOException &) const
void incrNextTargetMsgSeqNum(bool &, IOException &)
void reset(bool &, IOException &)
void get(int, int, std::vector< std::string > &, bool &, IOException &) const
bool set(int, const std::string &, bool &, IOException &)
int getNextTargetMsgSeqNum(bool &, IOException &) const
UtcTimeStamp getCreationTime(bool &, IOException &)
void setNextTargetMsgSeqNum(int, bool &, IOException &)
MessageStore * create(const SessionID &, bool &, ConfigError &)
virtual MessageStore * create(const SessionID &)=0
virtual void destroy(MessageStore *)=0
This interface must be implemented to store and retrieve messages and sequence numbers.
virtual bool set(int, const std::string &)=0
virtual int getNextSenderMsgSeqNum() const =0
virtual void setNextTargetMsgSeqNum(int)=0
virtual void incrNextSenderMsgSeqNum()=0
virtual void incrNextTargetMsgSeqNum()=0
virtual int getNextTargetMsgSeqNum() const =0
virtual UtcTimeStamp getCreationTime() const =0
virtual void reset()=0
virtual void get(int, int, std::vector< std::string > &) const =0
virtual void setNextSenderMsgSeqNum(int)=0
virtual void refresh()=0
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition SessionID.h:31
Date and Time represented in UTC.
Definition FieldTypes.h:583
Application is not configured correctly
Definition Exceptions.h:88

Generated on Thu Feb 29 2024 22:38:19 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001