OnixS C++ eSpeed ITCH Market Data Handler 1.7.3
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
26
27#include <string>
28#include <set>
29
31
33typedef size_t CpuIndex;
34
36class ONIXS_ESPEED_ITCH_API ThreadAffinity
37{
38 typedef std::set<CpuIndex> CpuIndexes;
39
40public:
43
46
49
51 bool empty() const;
52
54 void copyTo(CpuIndexes&) const;
55
57 bool insert(CpuIndex index);
58
60 bool erase(CpuIndex index);
61
63 void clear();
64
66 ThreadAffinity& operator = (const ThreadAffinity&);
67
69 std::string toString() const;
70
71private:
72
74 CpuIndexes* indices_;
75};
76
78class ONIXS_ESPEED_ITCH_API FeedEngineSettings
79{
80 ThreadAffinity threadAffinity_;
81
82 UInt32 threadCount_;
83
84 UInt32 dataWaitTime_;
85 UInt32 spinBeforeIdleTime_;
86
87 UInt32 socketBufferSize_;
88
89public:
92
93
96
97
106 {
107 return threadAffinity_;
108 }
109
118 {
119 return threadAffinity_;
120 }
121
125 UInt32 threadCount() const
126 {
127 return threadCount_;
128 }
129
131 void threadCount(UInt32 value)
132 {
133 threadCount_ = value;
134 }
135
145 UInt32 dataWaitTime() const
146 {
147 return dataWaitTime_;
148 }
149
151 void dataWaitTime(UInt32 value)
152 {
153 dataWaitTime_ = value;
154 }
155
164 UInt32 spinBeforeIdleTime() const
165 {
166 return spinBeforeIdleTime_;
167 }
168
170 void spinBeforeIdleTime(UInt32 value)
171 {
172 spinBeforeIdleTime_ = value;
173 }
174
178 UInt32 socketBufferSize() const
179 {
180 return socketBufferSize_;
181 }
182
184 void socketBufferSize(UInt32 value)
185 {
186 socketBufferSize_ = value;
187 }
188
190 std::string toString() const;
191};
192
193ONIXS_ESPEED_ITCH_API std::ostream& operator << (std::ostream& stream, const FeedEngineSettings& settings);
194
197{
209};
210
211//
213
219struct ONIXS_ESPEED_ITCH_API FeedEngineListener
220{
226 virtual void onFeedEngineThreadBegin(const FeedEngine&) {}
227
233 virtual void onFeedEngineThreadEnd(const FeedEngine&) {}
234
249};
250
251class FeedEngineImpl;
252
254class ONIXS_ESPEED_ITCH_API FeedEngine
255{
256public:
258 FeedEngine(const FeedEngineSettings&, FeedEngineListener* = ONIXS_ESPEED_ITCH_NULLPTR);
259
262
265
266private:
267 // Copying is not supposed for given class.
268 FeedEngine(const FeedEngine&);
269 FeedEngine& operator =(const FeedEngine&);
270
271 friend class FeedEngineImpl;
272
273 FeedEngineImpl* impl_;
274};
275
#define ONIXS_ESPEED_ITCH_API_DECL(typeKind, typeName)
Definition ABI.h:30
#define ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN
Definition Bootstrap.h:27
#define ONIXS_ESPEED_ITCH_NAMESPACE_END
Definition Bootstrap.h:31
ONIXS_ESPEED_ITCH_API std::ostream & operator<<(std::ostream &stream, const FeedEngineSettings &settings)
ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN typedef size_t CpuIndex
Zero-based index of CPU.
Definition FeedEngine.h:33
Collection of settings affecting Feed Engine behavior.
Definition FeedEngine.h:79
std::string toString() const
Returns the string representation.
void threadCount(UInt32 value)
Sets threadsCount.
Definition FeedEngine.h:131
UInt32 spinBeforeIdleTime() const
Definition FeedEngine.h:164
FeedEngineSettings()
Initializes options with default values.
ThreadAffinity & threadAffinity()
Definition FeedEngine.h:117
const ThreadAffinity & threadAffinity() const
Definition FeedEngine.h:105
void socketBufferSize(UInt32 value)
Sets udpSocketBufferSize.
Definition FeedEngine.h:184
~FeedEngineSettings()
Cleans everything up.
void spinBeforeIdleTime(UInt32 value)
Sets redundancySpinTime.
Definition FeedEngine.h:170
UInt32 dataWaitTime() const
Definition FeedEngine.h:145
UInt32 threadCount() const
Definition FeedEngine.h:125
UInt32 socketBufferSize() const
Definition FeedEngine.h:178
void dataWaitTime(UInt32 value)
Sets dataWaitTime.
Definition FeedEngine.h:151
Manages processing machinery for market data received from feeds.
Definition FeedEngine.h:255
const FeedEngineSettings & settings() const
Settings used define behavior of given instance.
friend class FeedEngineImpl
Definition FeedEngine.h:271
~FeedEngine()
Destructs given instance.
FeedEngine(const FeedEngineSettings &, FeedEngineListener *=ONIXS_ESPEED_ITCH_NULLPTR)
Initializes engine with given configuration.
Represents set of CPU indices.
Definition FeedEngine.h:37
ThreadAffinity()
Initializes empty set.
std::string toString() const
Returns the string representation.
ThreadAffinity(const ThreadAffinity &)
Initializes as copy of other set.
bool empty() const
Indicates whether is empty.
~ThreadAffinity()
Utilizes all the resources.
bool erase(CpuIndex index)
Removes CPU index from the set.
void clear()
Makes set empty.
bool insert(CpuIndex index)
Adds CPU index into set.
void copyTo(CpuIndexes &) const
Copies set into another set.
virtual void onFeedEngineThreadBegin(const FeedEngine &)
Definition FeedEngine.h:226
virtual void onFeedEngineThreadEnd(const FeedEngine &)
Definition FeedEngine.h:233
virtual void onFeedEngineThreadIdle(const FeedEngine &, FeedEngineThreadIdle::Reason, UInt32 &)
Definition FeedEngine.h:248
Identifies reasons feed engine threads becomes idle.
Definition FeedEngine.h:197