OnixS C++ CME MDP Premium Market Data Handler 5.9.0
Users' manual and API documentation
Loading...
Searching...
No Matches
SessionSettings.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
27
29
57
60void toStr(std::string&, JoinRecoveryOptions::Enum);
61
63inline std::string toStr(JoinRecoveryOptions::Enum recovery)
64{
65 std::string str;
66
67 toStr(str, recovery);
68
69 return str;
70}
71
94
98
100inline std::string toStr(GapAndErrorHandlingOptions::Enum handling)
101{
102 std::string str;
103
104 toStr(str, handling);
105
106 return str;
107}
108
111{
113 typedef UInt32 Base;
114
115 enum Enum
116 {
133
142 };
143};
144
148
150inline std::string toStr(InstrumentRecoveryOptions::Enum option)
151{
152 std::string str;
153
154 toStr(str, option);
155
156 return str;
157}
158
182
186
188inline std::string toStr(MarketRecoveryOptions::Enum option)
189{
190 std::string str;
191
192 toStr(str, option);
193
194 return str;
195}
196
197ONIXS_CMEMDH_EXPORTED_CLASS_DECL(TcpRecoveryService);
198
201{
202public:
208 : group_(group ? *group : SettingGroup::null())
209 , service_(ONIXS_CMEMDH_NULLPTR)
210 , attempts_(1)
211 , servingTimeLimit_(10)
212 {
213 }
214
220 : group_(SettingGroup::null())
221 , service_(other.service_)
222 , attempts_(other.attempts_)
223 , servingTimeLimit_(other.servingTimeLimit_)
224 {
225 }
226
229
237 {
238 return service_;
239 }
240
245 {
246 group_.controlAssignment("TCP Recovery Service Instance", service_, service);
247
248 return *this;
249 }
250
257 {
258 return attempts_;
259 }
260
267 {
268 group_.controlAssignment("TCP Recovery Attempt Quantity", attempts_, qty);
269
270 return *this;
271 }
272
282 {
283 return servingTimeLimit_;
284 }
285
293 {
294 group_.controlAssignment("TCP Recovery Serving Time Limit", servingTimeLimit_, servingTimeLimit);
295
296 return *this;
297 }
298
302 {
303 group_.controlChange(
304 "TCP Recovery Session Settings", &TcpRecoverySessionSettings::assignNoControl, *this, other
305 );
306
307 return *this;
308 }
309
310private:
313
314 const SettingGroup& group_;
315
316 TcpRecoveryService* service_;
317
318 UInt32 attempts_;
319 UInt32 servingTimeLimit_;
320
321 // Re-initializes the instance as a copy of the
322 // other one and bypassing assignment control.
323 void assignNoControl(const TcpRecoverySessionSettings& other)
324 {
325 service_ = other.service_;
326
327 attempts_ = other.attempts_;
328
329 servingTimeLimit_ = other.servingTimeLimit_;
330 }
331};
332
335void toStr(std::string&, const TcpRecoverySessionSettings&);
336
338inline std::string toStr(const TcpRecoverySessionSettings& settings)
339{
340 std::string str;
341
342 toStr(str, settings);
343
344 return str;
345}
346
350{
351public:
354 : SettingGroup(controller)
355 , joinRecovery_(JoinRecoveryOptions::InstrumentsAndMarketState)
356 , gapAndErrorHandling_(GapAndErrorHandlingOptions::RecoverMarketState)
357 , instrumentRecovery_(InstrumentRecoveryOptions::Accurate)
358 , marketRecovery_(MarketRecoveryOptions::BothMboAndMbp)
359 , tcpRecovery_(&group())
360 {
361 }
362
366 : SettingGroup()
367 , joinRecovery_(other.joinRecovery_)
368 , gapAndErrorHandling_(other.gapAndErrorHandling_)
369 , instrumentRecovery_(other.instrumentRecovery_)
370 , marketRecovery_(other.marketRecovery_)
371 , tcpRecovery_(other.tcpRecovery_)
372 {
373 }
374
377
384 {
385 return joinRecovery_;
386 }
387
391 {
392 group().controlAssignment("Join Recovery Strategy", joinRecovery_, recovery);
393
394 return *this;
395 }
396
403 {
404 return gapAndErrorHandling_;
405 }
406
410 {
411 group().controlAssignment("Gap And Error Handling Strategy", gapAndErrorHandling_, handling);
412
413 return *this;
414 }
415
420 {
421 return instrumentRecovery_;
422 }
423
426 {
427 group().controlAssignment("Instrument Recovery Strategy", instrumentRecovery_, recovery);
428
429 return *this;
430 }
431
436 {
437 return marketRecovery_;
438 }
439
442 {
443 group().controlAssignment("Market Recovery Strategy", marketRecovery_, recovery);
444
445 return *this;
446 }
447
450 {
451 return tcpRecovery_;
452 }
453
456 {
457 return tcpRecovery_;
458 }
459
465 {
466 group().controlChange("Session Settings", &SessionSettings::assignNoControl, *this, other);
467
468 return *this;
469 }
470
471protected:
474 const SettingGroup& group() const
475 {
476 return *this;
477 }
478
482 {
484
485 tcpRecovery_.assignNoControl(other.tcpRecovery_);
486 }
487
489 {
490 joinRecovery_ = other.joinRecovery_;
491
492 gapAndErrorHandling_ = other.gapAndErrorHandling_;
493
494 instrumentRecovery_ = other.instrumentRecovery_;
495
496 marketRecovery_ = other.marketRecovery_;
497 }
498
499private:
500 JoinRecoveryOptions::Enum joinRecovery_;
501 GapAndErrorHandlingOptions::Enum gapAndErrorHandling_;
502
503 InstrumentRecoveryOptions::Enum instrumentRecovery_;
504 MarketRecoveryOptions::Enum marketRecovery_;
505
506 TcpRecoverySessionSettings tcpRecovery_;
507
509 friend struct LegacyAssigner;
510};
511
514void toStr(std::string&, const SessionSettings&);
515
517inline std::string toStr(const SessionSettings& settings)
518{
519 std::string str;
520
521 toStr(str, settings);
522
523 return str;
524}
525
529
537
545
553
561
569
577
585
593
601
609
610// Complex (one-call) setup.
611
624
636
646
647// Deprecated way of session setup.
648
649#if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
650
664
679
694
709
724
739
754
755#endif // ONIXS_CMEMDH_NO_DEPRECATED
756
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:48
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:35
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_NULLPTR
Definition Compiler.h:178
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
SessionSettings & marketRecovery(MarketRecoveryOptions::Enum recovery)
Defines market recovery options.
SessionSettings & gapAndErrorHandling(GapAndErrorHandlingOptions::Enum handling)
SessionSettings & instrumentRecovery(InstrumentRecoveryOptions::Enum recovery)
Defines how instrument definitions are recovered.
void assignNoControlLegacy(const SessionSettings &other)
~SessionSettings()
Cleans everything up.
InstrumentRecoveryOptions::Enum instrumentRecovery() const
SessionSettings(const SessionSettings &other)
const SettingGroup & group() const
JoinRecoveryOptions::Enum joinRecovery() const
const TcpRecoverySessionSettings & tcpRecovery() const
Set of TCP recovery settings.
SessionSettings & joinRecovery(JoinRecoveryOptions::Enum recovery)
SessionSettings(SettingChangeController *controller=nullptr)
Initializes parameters with default values.
void assignNoControl(const SessionSettings &other)
GapAndErrorHandlingOptions::Enum gapAndErrorHandling() const
MarketRecoveryOptions::Enum marketRecovery() const
TcpRecoverySessionSettings & tcpRecovery()
Editable set of TCP recovery settings.
SessionSettings & operator=(const SessionSettings &other)
Base services for settings grouped by a certain criteria.
SettingGroup(SettingChangeController *controller=nullptr)
Collection of session settings related to TCP recovery.
~TcpRecoverySessionSettings()
Finalizes the instance.
TcpRecoverySessionSettings(const SettingGroup *group=nullptr)
TcpRecoverySessionSettings & operator=(const TcpRecoverySessionSettings &other)
TcpRecoverySessionSettings & service(TcpRecoveryService *service)
TcpRecoverySessionSettings & servingTimeLimit(UInt32 servingTimeLimit)
friend class SessionSettings
Lets grouping and value assignment control functioning.
TcpRecoverySessionSettings & attempts(UInt32 qty)
TcpRecoverySessionSettings(const TcpRecoverySessionSettings &other)
void setSessionToRecoverInstrumentsFast(SessionSettings &settings)
void setSessionToJoinInPreopening(SessionSettings &settings)
void setSessionToRecoverMboBooksOnly(SessionSettings &settings)
void setSessionToRecoverMbpBooksOnly(SessionSettings &settings)
void setSessionToNaturalRefresh(SessionSettings &settings)
void setSessionToFullRecoverUponRealtimeIssues(SessionSettings &settings)
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
void setSessionToRecoverBothMboAndMbpBooks(SessionSettings &settings)
void setSessionToRecoverInstrumentsAccurately(SessionSettings &settings)
UInt32 UInt32
uInt32.
Definition Fields.h:202
void setSessionToContinueRealtimeProcessingUponIssues(SessionSettings &settings)
void setSessionToLateJoin(SessionSettings &settings)
void setSessionToRecoverBooksUponRealtimeIssues(SessionSettings &settings)
void setSessionToAccurateLateJoin(SessionSettings &settings)
void setSessionToAccuratePreopening(SessionSettings &settings)
@ ContinueProcessing
Handler continues processing of real-time market data.
@ RecoverMarketState
Handler recovers market state from snapshots.
@ RecoverInstrumentsAndMarketState
Handler recovers instruments and market state afterwards.
Defines different ways of instrument definition recovery.
Defines market state recovery options.