OnixS C++ CME MDP Conflated UDP Handler  1.1.2
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 
26 
28 
32 
33 /// Designed to reflect various aspects
34 /// of feed engine processing flow.
37 {
38 public:
39  /// Aliases integral type whose bits
40  /// are used to indicate flag presence.
41  typedef UInt32 Flags;
42 
43  /// Initializes zero-state instance.
45  : eventsDispatched_(0)
46  , ioWaited_(0)
47  , reserved_(0)
48  {
49  }
50 
51  /// Indicates whether feed-related events like
52  /// data reception or absense have been dispatched.
53  bool
55  {
56  return
57  0 !=
58  eventsDispatched_;
59  }
60 
61  /// Indicates whether feed-related events like
62  /// data reception or absense have been dispatched.
63  void
64  eventsDispatched(bool state)
65  {
66  eventsDispatched_ =
67  state
68  ? 1
69  : 0;
70  }
71 
72  /// Indicates whether processing had to sleep
73  /// in kernel while checking data availability.
74  bool
75  ioWaited() const
76  {
77  return
78  0 !=
79  ioWaited_;
80  }
81 
82  /// Indicates whether processing had to sleep
83  /// in kernel while checking data availability.
84  void
86  bool state)
87  {
88  ioWaited_ =
89  state
90  ? 1
91  : 0;
92  }
93 
94  /// Reserved (unused) flags.
95  Flags
96  reserved() const
97  {
98  return reserved_;
99  }
100 
101  /// Reserved (unused) flags.
102  void
104  Flags flags)
105  {
106  reserved_ = flags;
107  }
108 
109 private:
110  Flags eventsDispatched_ : 1;
111  Flags ioWaited_ : 1;
112  Flags reserved_ : 30;
113 };
114 
115 /// Abstraction for the Feed Engine machinery.
116 ///
117 /// The given abstract class exposes the interface
118 /// through which instances of the Handler class
119 /// manipulate feeds.
121 {
123  const NetFeedEngine&);
124 
125  NetFeedEngine&
126  operator =(
127  const NetFeedEngine&);
128 
129 protected:
130  /// Construction through the descendants.
132  {
133  }
134 
135 public:
136  /// Finalizes the instance.
137  virtual ~NetFeedEngine()
138  {
139  }
140 
141  /// Provides information about the actual
142  /// implementation of the feed engine.
143  virtual
144  void
145  info(
146  std::string&) = 0;
147 
148  /// Constructs a link for the given feed.
149  ///
150  /// Caller is responsible for releasing the returned
151  /// instance using the NetFeedLink::release() member.
152  virtual
153  NetFeedLink&
154  allocate(
155  const NetFeed&) = 0;
156 
157  /// Watch service used by the Feed Engine
158  /// to assign timestamps for received packets
159  /// and to track heartbeats.
160  virtual
161  WatchService&
162  watch() = 0;
163 
164  /// Carries out pending actions like
165  /// data retrival and event dispatching.
166  ///
167  /// The particular implementation of the feed
168  /// engine concept may have own specific on returned
169  /// value. Thus, see the documentation for the particular
170  /// feed engine on the behavior and returned value.
171  virtual
173  process() = 0;
174 };
175 
176 /// Carries out pending actions like
177 /// data retrival and event dispatching.
178 ///
179 /// The returned value indicates whether any
180 /// events have been handled by the engine.
181 inline
182 bool
184  NetFeedEngine& engine)
185 {
186  return
187  engine.
188  process().
189  eventsDispatched();
190 }
191 
virtual ~NetFeedEngine()
Finalizes the instance.
Definition: FeedEngine.h:137
Base attributes of market data feed.
Definition: Feed.h:60
NetFeedEngineProcessResult()
Initializes zero-state instance.
Definition: FeedEngine.h:44
#define ONIXS_CONFLATEDUDP_EXPORTED_STRUCT_DECL(typeName)
Definition: Bootstrap.h:51
UInt32 UInt32
uInt32.
Definition: Fields.h:261
#define ONIXS_CONFLATEDUDP_LTWT_CLASS_DECL(name)
Definition: Bootstrap.h:107
#define ONIXS_CONFLATEDUDP_EXPORTED_CLASS_DECL(typeName)
Definition: Bootstrap.h:47
bool process(NetFeedEngine &engine)
Definition: FeedEngine.h:183
NetFeedEngine()
Construction through the descendants.
Definition: FeedEngine.h:131
Flags reserved() const
Reserved (unused) flags.
Definition: FeedEngine.h:96
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition: Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_EXPORTED_CLASS
Definition: Bootstrap.h:55
void reserved(Flags flags)
Reserved (unused) flags.
Definition: FeedEngine.h:103
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition: Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition: Bootstrap.h:153
Abstract watch service.
Definition: Watch.h:29