OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
SolarflareFeedEngine.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 <OnixS/CME/MDH/Watch.h>
26
27#include <stdexcept>
28
30
65
72void toStr(std::string& str, SolarflareFeedEngineMemoryPolicy::Enum policy);
73
80{
81 std::string str;
82
83 toStr(str, policy);
84
85 return str;
86}
87
119
124
128{
129 std::string str;
130
131 toStr(str, mode);
132
133 return str;
134}
135
140{
141public:
145 : mode_(SolarflareFeedEngineOperatingMode::Conventional)
146 , memoryPolicy_(SolarflareFeedEngineMemoryPolicy::Native)
147 , receiveRingSize_(static_cast<Messaging::UInt32>(-1))
148 , cacheSize_(1024)
149 , socketBufferSize_(8 * 1024 * 1024)
150 , watch_(&UtcWatch::service())
151 {
152 }
153
156
159 {
160 return mode_;
161 }
162
168
172 {
173 return memoryPolicy_;
174 }
175
179 {
180 memoryPolicy_ = policy;
181 }
182
192 {
193 return receiveRingSize_;
194 }
195
205 {
206 receiveRingSize_ = ringSize;
207 }
208
219 {
220 return cacheSize_;
221 }
222
226 {
227 cacheSize_ = cacheSize;
228 }
229
238 {
239 return socketBufferSize_;
240 }
241
250 {
251 socketBufferSize_ = bufferSize;
252 }
253
261 {
262 return *watch_;
263 }
264
269 {
270 watch_ = &watch;
271 }
272
273private:
276
277 Messaging::UInt32 receiveRingSize_;
278 Messaging::UInt32 cacheSize_;
279
280 Messaging::UInt32 socketBufferSize_;
281
282 WatchService* watch_;
283};
284
287void toStr(std::string&, const SolarflareFeedEngineSettings&);
288
290inline std::string toStr(const SolarflareFeedEngineSettings& settings)
291{
292 std::string str;
293
294 toStr(str, settings);
295
296 return str;
297}
298
309{
310public:
312
315
318
321 void info(std::string&) override;
322
324 NetFeedLink& allocate(const NetFeed&) override;
325
328 WatchService& watch() override;
329
333
334private:
335 const std::string& id() const noexcept {return NetFeedEngine::engineId();}
336
337 class Workhorse;
338 Workhorse* workhorse_;
339};
340
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:69
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:61
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:73
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:163
NetFeedEngineSettings()
Initializes the settings with the default logger.
const std::string & engineId() const noexcept
Returns the identifier generated for this engine.
Definition FeedEngine.h:189
std::string about()
Returns information about the actual feed-engine implementation.
NetFeedEngine(const NetFeedEngineSettings &settings=NetFeedEngineSettings{})
Constructs an engine and generates its identifier.
Base attributes of market data feed.
Definition Feed.h:55
SolarflareFeedEngineOperatingMode::Enum mode() const
The operational mode for the Feed Engine.
void mode(SolarflareFeedEngineOperatingMode::Enum mode)
Defines the operational mode for the Feed Engine.
void memoryPolicy(SolarflareFeedEngineMemoryPolicy::Enum policy)
Sets the memory-allocation policy used for Solarflare receive buffers.
void socketBufferSize(Messaging::UInt32 bufferSize)
void receiveRingSize(Messaging::UInt32 ringSize)
~SolarflareFeedEngineSettings()=default
Cleans everything up.
SolarflareFeedEngineMemoryPolicy::Enum memoryPolicy() const
Returns the memory-allocation policy used for Solarflare receive buffers.
void info(std::string &) override
NetFeedLink & allocate(const NetFeed &) override
Allocates a link for the given feed.
NetFeedEngineProcessResult process() override
WatchService & watch() override
~SolarflareFeedEngine() override
Destructs the given instance.
SolarflareFeedEngine(const SolarflareFeedEngineSettings &)
Initializes the engine according to the given configuration.
std::uint32_t UInt32
uInt32.
Definition Integral.h:35
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
Controls how memory backing Solarflare ef_vi receive-buffer pools is allocated.
Messaging::UInt32 Base
Integral base type used to store or serialize values of Enum.
@ Native
Uses regular heap memory aligned to the operating system's native page size.
@ PreferHuge
Prefers HugeTLB pages and falls back to Native if allocation fails.
Defines modes in with the Solarflare Feed Engine can operate.
Enum
Defines modes in with the Solarflare Feed Engine can operate.
Messaging::UInt32 Base
Underlying integral type for the enum.
Abstract watch service.
Definition Watch.h:35