MessageStore.h
Go to the documentation of this file.
1/* -*- C++ -*- */
2
3/****************************************************************************
4** Copyright (c) 2001-2014
5**
6** This file is part of the QuickFIX FIX Engine
7**
8** This file may be distributed under the terms of the quickfixengine.org
9** license as defined by quickfixengine.org and appearing in the file
10** LICENSE included in the packaging of this file.
11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14**
15** See http://www.quickfixengine.org/LICENSE for licensing information.
16**
17** Contact ask@quickfixengine.org if any conditions of this licensing are
18** not clear to you.
19**
20****************************************************************************/
21
22#ifndef FIX_MESSAGESTORE_H
23#define FIX_MESSAGESTORE_H
24
25#ifdef _MSC_VER
26#pragma warning( disable : 4503 4355 4786 4290 )
27#endif
28
29#include "Message.h"
30#include <map>
31#include <vector>
32#include <string>
33
34namespace FIX
35{
36class MessageStore;
37
42{
43public:
45 virtual MessageStore* create( const SessionID& ) = 0;
46 virtual void destroy( MessageStore* ) = 0;
47};
48
56{
57public:
58 MessageStore* create( const SessionID& );
59 void destroy( MessageStore* );
60};
61
67{
68public:
69 virtual ~MessageStore() {}
70
71 virtual bool set( int, const std::string& )
72 throw ( IOException ) = 0;
73 virtual void get( int, int, std::vector < std::string > & ) const
74 throw ( IOException ) = 0;
75
76 virtual int getNextSenderMsgSeqNum() const throw ( IOException ) = 0;
82
84
87};
97{
98public:
99 MemoryStore() : m_nextSenderMsgSeqNum( 1 ), m_nextTargetMsgSeqNum( 1 ) {}
100
101 bool set( int, const std::string& ) throw ( IOException );
102 void get( int, int, std::vector < std::string > & ) const throw ( IOException );
103
105 { return m_nextSenderMsgSeqNum; }
107 { return m_nextTargetMsgSeqNum; }
108 void setNextSenderMsgSeqNum( int value ) throw ( IOException )
109 { m_nextSenderMsgSeqNum = value; }
110 void setNextTargetMsgSeqNum( int value ) throw ( IOException )
111 { m_nextTargetMsgSeqNum = value; }
113 { ++m_nextSenderMsgSeqNum; }
115 { ++m_nextTargetMsgSeqNum; }
116
118 { m_creationTime = creationTime; }
120 { return m_creationTime; }
121
123 {
124 m_nextSenderMsgSeqNum = 1; m_nextTargetMsgSeqNum = 1;
125 m_messages.clear(); m_creationTime.setCurrent();
126 }
128
129private:
130 typedef std::map < int, std::string > Messages;
131
136};
137
139{
140private:
142public:
144 : m_pFactory( pFactory ) {}
145
146 MessageStore* create( const SessionID&, bool&, ConfigError& );
147 void destroy( MessageStore* );
148};
149
151{
152private:
154public:
155 MessageStoreExceptionWrapper( MessageStore* pStore ) : m_pStore( pStore ) {}
156 ~MessageStoreExceptionWrapper() { delete m_pStore; }
157
158 bool set( int, const std::string&, bool&, IOException& );
159 void get( int, int, std::vector < std::string > &, bool&, IOException& ) const;
160 int getNextSenderMsgSeqNum( bool&, IOException& ) const;
161 int getNextTargetMsgSeqNum( bool&, IOException& ) const;
162 void setNextSenderMsgSeqNum( int, bool&, IOException& );
163 void setNextTargetMsgSeqNum( int, bool&, IOException& );
164 void incrNextSenderMsgSeqNum( bool&, IOException& );
165 void incrNextTargetMsgSeqNum( bool&, IOException& );
166
167 UtcTimeStamp getCreationTime( bool&, IOException& );
168
169 void reset( bool&, IOException& );
170 void refresh( bool&, IOException& );
171};
172}
173
174#endif //FIX_MESSAGESTORE_H
Creates a memory based implementation of MessageStore.
void destroy(MessageStore *)
MessageStore * create(const SessionID &)
Memory based implementation of MessageStore.
UtcTimeStamp m_creationTime
void setCreationTime(const UtcTimeStamp &creationTime)
int getNextTargetMsgSeqNum() const
void incrNextTargetMsgSeqNum()
void incrNextSenderMsgSeqNum()
void setNextTargetMsgSeqNum(int value)
UtcTimeStamp getCreationTime() const
void setNextSenderMsgSeqNum(int value)
std::map< int, std::string > Messages
int getNextSenderMsgSeqNum() const
MessageStoreExceptionWrapper(MessageStore *pStore)
MessageStoreFactoryExceptionWrapper(MessageStoreFactory *pFactory)
This interface must be implemented to create a MessageStore.
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 ~MessageStore()
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 Sun Mar 31 2024 07:07:24 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001