OnixS C++ FIX Engine 2.79.1.0
C:/Users/Pasha/_Dev/fixforge-cpp/fix/cppEngine/include/OnixS/FIX/Scheduling/SessionScheduler.h
00001 /*
00002 * Copyright 2005-2011 Onix Solutions Limited [OnixS]. All rights reserved. 
00003 * 
00004 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law 
00005 * and international copyright treaties. 
00006 * 
00007 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
00008 * Services Agreement (the Agreement) and Customer end user license agreements granting 
00009 * a non-assignable, non-transferable and non-exclusive license to use the software 
00010 * for it's own data processing purposes under the terms defined in the Agreement.
00011 * 
00012 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part 
00013 * of this source code or associated reference material to any other location for further reproduction
00014 * or redistribution, and any amendments to this copyright notice, are expressly prohibited. 
00015 *
00016 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with 
00017 * the terms of the Agreement is a violation of copyright law. 
00018 */
00019 
00020 #if !defined(__ONIXS_FIXENGINE_SCHEDULING_SESSIONSCHEDULER_H__)
00021 #define __ONIXS_FIXENGINE_SCHEDULING_SESSIONSCHEDULER_H__
00022 
00023 #include <string>
00024 
00025 #include "OnixS/FIX/ABI.h"
00026 
00027 namespace OnixS
00028 {
00029     namespace FIX
00030     {
00031         ONIXS_FIXENGINE_API_DECL(class, Session);
00032 
00033         namespace Scheduling
00034         {
00035             ONIXS_FIXENGINE_API_DECL(class, SessionScheduler);
00036 
00037             ONIXS_FIXENGINE_API_DECL(class, SessionSchedule);
00038             ONIXS_FIXENGINE_API_DECL(class, SessionConnectionSettings);
00039 
00040             typedef std::string SessionScheduleId;
00041             typedef std::string SessionConnectionSettingsId;
00042 
00044             class 
00045             ONIXS_FIXENGINE_API 
00046             SessionSchedulerListener
00047             {
00048             public:
00056                 virtual void onLoggingOut(
00057                     const SessionScheduler& scheduler,
00058                     Session* session,
00059                     bool* allowLogout) = 0;
00060 
00063                 virtual void onWarning(
00064                     const SessionScheduler& scheduler, 
00065                     Session* session, 
00066                     const std::string& warningReason) = 0;
00067 
00070                 virtual void onError(
00071                     const SessionScheduler& scheduler, 
00072                     Session* session, 
00073                     const std::string& errorReason) = 0;
00074 
00075             protected:
00078                 virtual ~SessionSchedulerListener();
00079             };
00080 
00083             class 
00084             ONIXS_FIXENGINE_API 
00085             SessionSchedulerOptions
00086             {
00087             public:
00089                 SessionSchedulerOptions();
00090 
00092                 SessionSchedulerOptions(const SessionSchedulerOptions&);
00093 
00095                 ~SessionSchedulerOptions();
00096 
00098                 const std::string& configurationFile() const;
00099 
00101                 void configurationFile(const std::string& file);
00102 
00104                 SessionSchedulerListener* eventListener() const;
00105 
00107                 void eventListener(SessionSchedulerListener* listener);
00108 
00110                 SessionSchedulerOptions&
00111                 operator =(const SessionSchedulerOptions& other);
00112 
00113             private:
00114                 std::string* configurationFile_;
00115                 SessionSchedulerListener* eventListener_;
00116             };
00117 
00122             class ONIXS_FIXENGINE_API SessionScheduler
00123             {
00124             public:
00131                 SessionScheduler(const SessionSchedulerOptions& options);
00132 
00134                 ~SessionScheduler();
00135 
00140                 const SessionSchedule* 
00141                 findSchedule(const SessionScheduleId& id) const;
00142 
00147                 const SessionConnectionSettings* 
00148                 findConnectionSettings(const SessionConnectionSettingsId& id) const;
00149 
00163                 void add(
00164                     Session* session, 
00165                     const SessionSchedule& schedule,
00166                     const SessionConnectionSettings& connection);
00167 
00181                 void add(
00182                     Session* session,
00183                     const SessionScheduleId& scheduleId,
00184                     const SessionConnectionSettingsId& connectionId);
00185 
00188                 void remove(Session* session);
00189 
00190             private:
00191                 class Impl;
00192                 Impl* impl_;
00193             };
00194         }
00195     }
00196 }
00197 
00198 #endif // __ONIXS_FIXENGINE_SCHEDULING_SESSIONSCHEDULER_H__