OnixS C++ CME MDP Premium Market Data Handler  5.8.9
API Documentation
FeedEngine.h
Go to the documentation of this file.
1 // Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2 //
3 // This software owned by Onix Solutions Limited [OnixS] and is
4 // protected by copyright law and international copyright treaties.
5 //
6 // Access to and use of the software is governed by the terms of the applicable
7 // OnixS Software Services Agreement (the Agreement) and Customer end user license
8 // agreements granting a non-assignable, non-transferable and non-exclusive license
9 // to use the software for it's own data processing purposes under the terms defined
10 // in the Agreement.
11 //
12 // Except as otherwise granted within the terms of the Agreement, copying or
13 // reproduction of any part of this source code or associated reference material
14 // to any other location for further reproduction or redistribution, and any
15 // amendments to this copyright notice, are expressly prohibited.
16 //
17 // Any reproduction or redistribution for sale or hiring of the Software not in
18 // accordance with the terms of the Agreement is a violation of copyright law.
19 //
20 
21 #pragma once
22 
23 #include <string>
24 
25 #include <OnixS/CME/MDH/Integral.h>
26 
28 
32 
33 /// Designed to reflect various aspects
34 /// of feed engine processing flow.
36 {
37 public:
38  /// Aliases integral type whose bits
39  /// are used to indicate flag presence.
40  typedef UInt32 Flags;
41 
42  /// Initializes zero-state instance.
44  : eventsDispatched_(0)
45  , ioWaited_(0)
46  , reserved_(0)
47  {
48  }
49 
50  /// Indicates whether feed-related events like
51  /// data reception or absence have been dispatched.
52  bool eventsDispatched() const
53  {
54  return 0 != eventsDispatched_;
55  }
56 
57  /// Indicates whether feed-related events like
58  /// data reception or absence have been dispatched.
59  void eventsDispatched(bool state)
60  {
61  eventsDispatched_ = state ? 1 : 0;
62  }
63 
64  /// Indicates whether processing had to sleep
65  /// in kernel while checking data availability.
66  bool ioWaited() const
67  {
68  return 0 != ioWaited_;
69  }
70 
71  /// Indicates whether processing had to sleep
72  /// in kernel while checking data availability.
73  void ioWaited(bool state)
74  {
75  ioWaited_ = state ? 1 : 0;
76  }
77 
78  /// Reserved (unused) flags.
79  Flags reserved() const
80  {
81  return reserved_;
82  }
83 
84  /// Reserved (unused) flags.
85  void reserved(Flags flags)
86  {
87  reserved_ = flags;
88  }
89 
90 private:
91  Flags eventsDispatched_ : 1;
92  Flags ioWaited_ : 1;
93  Flags reserved_ : 30;
94 };
95 
96 /// Abstraction for the Feed Engine machinery.
97 ///
98 /// The given abstract class exposes the interface
99 /// through which instances of the Handler class
100 /// manipulate feeds.
102 {
103 public:
104  /// Finalizes the instance.
105  virtual ~NetFeedEngine() {}
106 
107  /// Provides information about the actual
108  /// implementation of the feed engine.
109  virtual void info(std::string&) = 0;
110 
111  /// Constructs a link for the given feed.
112  ///
113  /// Caller is responsible for releasing the returned
114  /// instance using the NetFeedLink::release() member.
115  virtual NetFeedLink& allocate(const NetFeed&) = 0;
116 
117  /// A watch service used by the Feed Engine
118  /// to assign timestamps for received packets
119  /// and to track heartbeats.
120  virtual WatchService& watch() = 0;
121 
122  /// Carries out pending actions like
123  /// data retrieval and event dispatching.
124  ///
125  /// The particular implementation of the feed
126  /// engine concept may have own specific on returned
127  /// value. Thus, see the documentation for the particular
128  /// feed engine on the behavior and returned value.
129  virtual NetFeedEngineProcessResult process() = 0;
130 
131 protected:
132  /// Construction through the descendants.
134 
135 private:
137 
138  NetFeedEngine& operator=(const NetFeedEngine&);
139 };
140 
141 /// Carries out pending actions like
142 /// data retrieval and event dispatching.
143 ///
144 /// The returned value indicates whether any
145 /// events have been handled by the engine.
146 inline bool process(NetFeedEngine& engine)
147 {
148  return engine.process().eventsDispatched();
149 }
150 
void ioWaited(bool state)
Indicates whether processing had to sleep in kernel while checking data availability.
Definition: FeedEngine.h:73
UInt32 Flags
Aliases integral type whose bits are used to indicate flag presence.
Definition: FeedEngine.h:40
Designed to reflect various aspects of feed engine processing flow.
Definition: FeedEngine.h:35
UInt32 UInt32
uInt32.
Definition: Fields.h:192
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:35
Abstract watch service.
Definition: Watch.h:29
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
virtual NetFeedEngineProcessResult process()=0
Carries out pending actions like data retrieval and event dispatching.
Abstraction for the Feed Engine machinery.
Definition: FeedEngine.h:101
bool process(NetFeedEngine &engine)
Carries out pending actions like data retrieval and event dispatching.
Definition: FeedEngine.h:146
bool eventsDispatched() const
Indicates whether feed-related events like data reception or absence have been dispatched.
Definition: FeedEngine.h:52
virtual ~NetFeedEngine()
Finalizes the instance.
Definition: FeedEngine.h:105
NetFeedEngine()
Construction through the descendants.
Definition: FeedEngine.h:133
Base attributes of market data feed.
Definition: Feed.h:54
Flags reserved() const
Reserved (unused) flags.
Definition: FeedEngine.h:79
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
#define ONIXS_CMEMDH_EXPORTED_STRUCT_DECL(typeName)
Definition: Bootstrap.h:36
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:160
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:48
void reserved(Flags flags)
Reserved (unused) flags.
Definition: FeedEngine.h:85
void eventsDispatched(bool state)
Indicates whether feed-related events like data reception or absence have been dispatched.
Definition: FeedEngine.h:59
NetFeedEngineProcessResult()
Initializes zero-state instance.
Definition: FeedEngine.h:43
bool ioWaited() const
Indicates whether processing had to sleep in kernel while checking data availability.
Definition: FeedEngine.h:66
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68