Application.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_APPLICATION_H
23 #define FIX_APPLICATION_H
24 
25 #include "Message.h"
26 #include "SessionID.h"
27 #include "Mutex.h"
28 
29 namespace FIX
30 {
43 class Application
44 {
45 public:
46  virtual ~Application() {};
48  virtual void onCreate( const SessionID& ) = 0;
50  virtual void onLogon( const SessionID& ) = 0;
52  virtual void onLogout( const SessionID& ) = 0;
54  virtual void toAdmin( Message&, const SessionID& ) = 0;
56  virtual void toApp( Message&, const SessionID& )
57  throw( DoNotSend ) = 0;
59  virtual void fromAdmin( const Message&, const SessionID& )
62  virtual void fromApp( const Message&, const SessionID& )
64 };
65 
77 {
78 public:
79  SynchronizedApplication( Application& app ) : m_app( app ) {}
80 
81  void onCreate( const SessionID& sessionID )
82  { Locker l( m_mutex ); app().onCreate( sessionID ); }
83  void onLogon( const SessionID& sessionID )
84  { Locker l( m_mutex ); app().onLogon( sessionID ); }
85  void onLogout( const SessionID& sessionID )
86  { Locker l( m_mutex ); app().onLogout( sessionID ); }
87  void toAdmin( Message& message, const SessionID& sessionID )
88  { Locker l( m_mutex ); app().toAdmin( message, sessionID ); }
89  void toApp( Message& message, const SessionID& sessionID )
90  throw( DoNotSend )
91  { Locker l( m_mutex ); app().toApp( message, sessionID ); }
92  void fromAdmin( const Message& message, const SessionID& sessionID )
94  { Locker l( m_mutex ); app().fromAdmin( message, sessionID ); }
95  void fromApp( const Message& message, const SessionID& sessionID )
97  { Locker l( m_mutex ); app().fromApp( message, sessionID ); }
98 
99  Mutex m_mutex;
100 
101  Application& app() { return m_app; }
102  Application& m_app;
103 };
104 
111 class NullApplication : public Application
112 {
113  void onCreate( const SessionID& ) {}
114  void onLogon( const SessionID& ) {}
115  void onLogout( const SessionID& ) {}
116  void toAdmin( Message&, const SessionID& ) {}
117  void toApp( Message&, const SessionID& )
118  throw( DoNotSend ) {}
119  void fromAdmin( const Message&, const SessionID& )
121  void fromApp( const Message&, const SessionID& )
123 };
125 }
126 
127 #endif //FIX_APPLICATION_H
SessionID.h
FIX::Application::toAdmin
virtual void toAdmin(Message &, const SessionID &)=0
Notification of admin message being sent to target.
FIX::Mutex
Portable implementation of a mutex.
Definition: Mutex.h:47
FIX::DoNotSend
Indicates user does not want to send a message.
Definition: Exceptions.h:234
FIX::Application
This interface must be implemented to define what your FIX application does.
Definition: Application.h:60
FIX::SessionID
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition: SessionID.h:47
Mutex.h
FIX::IncorrectTagValue
Field has a value that is out of range.
Definition: Exceptions.h:154
FIX::FieldNotFound
Field not found inside a message.
Definition: Exceptions.h:74
FIX::Application::onLogout
virtual void onLogout(const SessionID &)=0
Notification of a session logging off or disconnecting.
FIX::Message
Base class for all FIX messages.
Definition: Message.h:134
FIX
Definition: Acceptor.cpp:34
FIX::SynchronizedApplication
This is a special implementation of the Application interface that takes in another Application inter...
Definition: Application.h:93
FIX::RejectLogon
User wants to reject permission to logon.
Definition: Exceptions.h:241
FIX::Application::onCreate
virtual void onCreate(const SessionID &)=0
Notification of a session begin created.
FIX::Application::~Application
virtual ~Application()
Definition: Application.h:80
FIX::UnsupportedMessageType
Message type not supported by application.
Definition: Exceptions.h:193
FIX::Application::onLogon
virtual void onLogon(const SessionID &)=0
Notification of a session successfully logging on.
FIX::Locker
Locks/Unlocks a mutex using RAII.
Definition: Mutex.h:112
FIX::Application::fromApp
virtual void fromApp(const Message &, const SessionID &)=0
Notification of app message being received from target.
FIX::IncorrectDataFormat
Field has a badly formatted value.
Definition: Exceptions.h:163
FIX::Application::toApp
virtual void toApp(Message &, const SessionID &)=0
Notification of app message being sent to target.
Message.h
FIX::Application::fromAdmin
virtual void fromAdmin(const Message &, const SessionID &)=0
Notification of admin message being received from target.
FIX::NullApplication
An empty implementation of an Application.
Definition: Application.h:128

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001