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 {
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 
100 
101  Application& app() { return m_app; }
103 };
104 
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
Field has a badly formatted value.
Definition: Exceptions.h:146
Message type not supported by application.
Definition: Exceptions.h:176
virtual void onCreate(const SessionID &)=0
Notification of a session begin created.
virtual void onLogout(const SessionID &)=0
Notification of a session logging off or disconnecting.
An empty implementation of an Application.
Definition: Application.h:111
void onLogout(const SessionID &)
Notification of a session logging off or disconnecting.
Definition: Application.h:115
virtual ~Application()
Definition: Application.h:46
void fromAdmin(const Message &message, const SessionID &sessionID)
Notification of admin message being received from target.
Definition: Application.h:92
virtual void onLogon(const SessionID &)=0
Notification of a session successfully logging on.
virtual void fromApp(const Message &, const SessionID &)=0
Notification of app message being received from target.
void fromApp(const Message &, const SessionID &)
Notification of app message being received from target.
Definition: Application.h:121
void onLogon(const SessionID &)
Notification of a session successfully logging on.
Definition: Application.h:114
void fromAdmin(const Message &, const SessionID &)
Notification of admin message being received from target.
Definition: Application.h:119
void toApp(Message &, const SessionID &)
Notification of app message being sent to target.
Definition: Application.h:117
Definition: Acceptor.cpp:34
virtual void fromAdmin(const Message &, const SessionID &)=0
Notification of admin message being received from target.
This interface must be implemented to define what your FIX application does.
Definition: Application.h:43
virtual void toApp(Message &, const SessionID &)=0
Notification of app message being sent to target.
void toAdmin(Message &message, const SessionID &sessionID)
Notification of admin message being sent to target.
Definition: Application.h:87
Locks/Unlocks a mutex using RAII.
Definition: Mutex.h:95
SynchronizedApplication(Application &app)
Definition: Application.h:79
void fromApp(const Message &message, const SessionID &sessionID)
Notification of app message being received from target.
Definition: Application.h:95
Base class for all FIX messages.
Definition: Message.h:117
Field not found inside a message.
Definition: Exceptions.h:57
virtual void toAdmin(Message &, const SessionID &)=0
Notification of admin message being sent to target.
void toAdmin(Message &, const SessionID &)
Notification of admin message being sent to target.
Definition: Application.h:116
Portable implementation of a mutex.
Definition: Mutex.h:30
Indicates user does not want to send a message.
Definition: Exceptions.h:217
void onCreate(const SessionID &)
Notification of a session begin created.
Definition: Application.h:113
void toApp(Message &message, const SessionID &sessionID)
Notification of app message being sent to target.
Definition: Application.h:89
void onLogon(const SessionID &sessionID)
Notification of a session successfully logging on.
Definition: Application.h:83
void onCreate(const SessionID &sessionID)
Notification of a session begin created.
Definition: Application.h:81
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition: SessionID.h:30
void onLogout(const SessionID &sessionID)
Notification of a session logging off or disconnecting.
Definition: Application.h:85
This is a special implementation of the Application interface that takes in another Application inter...
Definition: Application.h:76
Field has a value that is out of range.
Definition: Exceptions.h:137
User wants to reject permission to logon.
Definition: Exceptions.h:224

Generated on Sun Apr 15 2018 21:44:00 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001