OnixS C++ HKEX OMD-C Handler 1.0.0
API documentation
Loading...
Searching...
No Matches
FeedEngine.h
Go to the documentation of this file.
1/*
2* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3*
4* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5* and international copyright treaties.
6*
7* Access to and use of the software is governed by the terms of the applicable ONIXS Software
8* Services Agreement (the Agreement) and Customer end user license agreements granting
9* a non-assignable, non-transferable and non-exclusive license to use the software
10* for it's own data processing purposes under the terms defined in the Agreement.
11*
12* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13* of this source code or associated reference material to any other location for further reproduction
14* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15*
16* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17* the terms of the Agreement is a violation of copyright law.
18*/
19
20#pragma once
21
25
26#include <string>
27
28namespace OnixS
29{
30 namespace HKEX
31 {
32 namespace MarketData
33 {
34 namespace Omdc
35 {
37 class ONIXS_HKEX_OMDC_API FeedEngineSettings
38 {
39 ThreadAffinity threadAffinity_;
40
41 UInt32 threadCount_;
42
43 UInt32 dataWaitTime_;
44 UInt32 spinBeforeIdleTime_;
45
46 UInt32 socketBufferSize_;
47
48 public:
51
60 {
61 return threadAffinity_;
62 }
63
72 {
73 return threadAffinity_;
74 }
75
79 UInt32 threadCount() const
80 {
81 return threadCount_;
82 }
83
85 void threadCount(UInt32 value)
86 {
87 threadCount_ = value;
88 }
89
99 UInt32 dataWaitTime() const
100 {
101 return dataWaitTime_;
102 }
103
105 void dataWaitTime(UInt32 value)
106 {
107 dataWaitTime_ = value;
108 }
109
118 UInt32 spinBeforeIdleTime() const
119 {
120 return spinBeforeIdleTime_;
121 }
122
124 void spinBeforeIdleTime(UInt32 value)
125 {
126 spinBeforeIdleTime_ = value;
127 }
128
132 UInt32 socketBufferSize() const
133 {
134 return socketBufferSize_;
135 }
136
138 void socketBufferSize(UInt32 value)
139 {
140 socketBufferSize_ = value;
141 }
142
144 std::string toString() const;
145 };
146
147 ONIXS_HKEX_OMDC_API std::ostream& operator << (std::ostream& stream, const FeedEngineSettings& settings);
148
151 {
163 };
164
165 //
166 ONIXS_HKEX_OMDC_API_DECL(class, FeedEngine);
167
173 struct ONIXS_HKEX_OMDC_API FeedEngineListener
174 {
180 virtual void onFeedEngineThreadBegin(const FeedEngine&) {}
181
187 virtual void onFeedEngineThreadEnd(const FeedEngine&) {}
188
203 };
204
205 class FeedEngineImpl;
206
208 class ONIXS_HKEX_OMDC_API FeedEngine
209 {
210 public:
212 explicit
214
217
220
221 private:
222 // Copying is not supposed for given class.
223 FeedEngine(const FeedEngine&);
224 FeedEngine& operator =(const FeedEngine&);
225
226 friend class FeedEngineImpl;
227
228 FeedEngineImpl* impl_;
229 };
230 }
231 }
232 }
233}
#define ONIXS_HKEX_OMDC_API_DECL(typeKind, typeName)
Definition ABI.h:31
#define ONIXS_HKEX_OMDC_NULLPTR
Definition Compiler.h:175
Collection of settings affecting Feed Engine behavior.
Definition FeedEngine.h:38
std::string toString() const
Returns the string representation.
void threadCount(UInt32 value)
Sets threadsCount.
Definition FeedEngine.h:85
UInt32 spinBeforeIdleTime() const
Defines amount of time Feed Engine keeps cycling before going to sleep when no useful activity can be...
Definition FeedEngine.h:118
FeedEngineSettings()
Initializes options with default values.
ThreadAffinity & threadAffinity()
Defines set of CPUs allowed for each working thread to be executed on while processing market data by...
Definition FeedEngine.h:71
const ThreadAffinity & threadAffinity() const
Defines set of CPUs allowed for each working thread to be executed on while processing market data by...
Definition FeedEngine.h:59
void socketBufferSize(UInt32 value)
Sets udpSocketBufferSize.
Definition FeedEngine.h:138
void spinBeforeIdleTime(UInt32 value)
Sets redundancySpinTime.
Definition FeedEngine.h:124
UInt32 dataWaitTime() const
Defines amount of time Feed Engine spends on socket waiting for I/O while running master processing l...
Definition FeedEngine.h:99
UInt32 threadCount() const
Number of working threads to be used by feed engine.
Definition FeedEngine.h:79
UInt32 socketBufferSize() const
Defines size of receiving buffer in bytes for sockets.
Definition FeedEngine.h:132
void dataWaitTime(UInt32 value)
Sets dataWaitTime.
Definition FeedEngine.h:105
Manages processing machinery for market data received from feeds.
Definition FeedEngine.h:209
const FeedEngineSettings & settings() const
Settings used define behavior of given instance.
FeedEngine(const FeedEngineSettings &, FeedEngineListener *=nullptr)
Initializes engine with given configuration.
~FeedEngine()
Destructs given instance.
Represents set of CPU indices.
Definition Defines.h:102
ONIXS_HKEX_OMDC_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
Listener for thread-related events.
Definition FeedEngine.h:174
virtual void onFeedEngineThreadBegin(const FeedEngine &)
Member invoked by feed engine when a new processing thread is spawned.
Definition FeedEngine.h:180
virtual void onFeedEngineThreadEnd(const FeedEngine &)
Member is invoked by feed engine when processing thread is about to end.
Definition FeedEngine.h:187
virtual void onFeedEngineThreadIdle(const FeedEngine &, FeedEngineThreadIdle::Reason, UInt32 &)
Is called when feed engine's thread is idle.
Definition FeedEngine.h:202
Identifies reasons feed engine threads becomes idle.
Definition FeedEngine.h:151
@ DataWaitTimeout
Thread waited for incoming data using corresponding I/O operations (like 'select') and exited waiting...
Definition FeedEngine.h:157
@ Redundant
Thread entered idle state due to absence of any data and while other threads are waiting for new inco...
Definition FeedEngine.h:161