OnixS C++ CME MDP Premium Market Data Handler 5.11.1
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
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_(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
247 {
248 group_.controlAssignment("TCP Recovery Service Instance", service_, service);
249
250 return *this;
251 }
252
259 {
260 return attempts_;
261 }
262
271 {
272 group_.controlAssignment("TCP Recovery Attempt Quantity", attempts_, qty);
273
274 return *this;
275 }
276
286 {
287 return servingTimeLimit_;
288 }
289
299 {
300 group_.controlAssignment("TCP Recovery Serving Time Limit", servingTimeLimit_, servingTimeLimit);
301
302 return *this;
303 }
304
310 {
311 group_.controlChange(
312 "TCP Recovery Session Settings", &TcpRecoverySessionSettings::assignNoControl, *this, other
313 );
314
315 return *this;
316 }
317
318private:
321
322 const SettingGroup& group_;
323
324 TcpRecoveryService* service_;
325
326 Messaging::UInt32 attempts_;
327 Messaging::UInt32 servingTimeLimit_;
328
329 // Re-initializes the instance as a copy of the
330 // other one and bypassing assignment control.
331 void assignNoControl(const TcpRecoverySessionSettings& other)
332 {
333 service_ = other.service_;
334
335 attempts_ = other.attempts_;
336
337 servingTimeLimit_ = other.servingTimeLimit_;
338 }
339};
340
343void toStr(std::string&, const TcpRecoverySessionSettings&);
344
346inline std::string toStr(const TcpRecoverySessionSettings& settings)
347{
348 std::string str;
349
350 toStr(str, settings);
351
352 return str;
353}
354
358{
359public:
362 : SettingGroup(controller)
363 , joinRecovery_(JoinRecoveryOptions::InstrumentsAndMarketState)
364 , gapAndErrorHandling_(GapAndErrorHandlingOptions::RecoverMarketState)
365 , instrumentRecovery_(InstrumentRecoveryOptions::Accurate)
366 , marketRecovery_(MarketRecoveryOptions::BothMboAndMbp)
367 , tcpRecovery_(&group())
368 {
369 }
370
374 : SettingGroup()
375 , joinRecovery_(other.joinRecovery_)
376 , gapAndErrorHandling_(other.gapAndErrorHandling_)
377 , instrumentRecovery_(other.instrumentRecovery_)
378 , marketRecovery_(other.marketRecovery_)
379 , tcpRecovery_(other.tcpRecovery_)
380 {
381 }
382
385
392 {
393 return joinRecovery_;
394 }
395
401 {
402 group().controlAssignment("Join Recovery Strategy", joinRecovery_, recovery);
403
404 return *this;
405 }
406
413 {
414 return gapAndErrorHandling_;
415 }
416
422 {
423 group().controlAssignment("Gap And Error Handling Strategy", gapAndErrorHandling_, handling);
424
425 return *this;
426 }
427
432 {
433 return instrumentRecovery_;
434 }
435
440 {
441 group().controlAssignment("Instrument Recovery Strategy", instrumentRecovery_, recovery);
442
443 return *this;
444 }
445
450 {
451 return marketRecovery_;
452 }
453
458 {
459 group().controlAssignment("Market Recovery Strategy", marketRecovery_, recovery);
460
461 return *this;
462 }
463
466 {
467 return tcpRecovery_;
468 }
469
472 {
473 return tcpRecovery_;
474 }
475
483 {
484 group().controlChange("Session Settings", &SessionSettings::assignNoControl, *this, other);
485
486 return *this;
487 }
488
489protected:
492 const SettingGroup& group() const
493 {
494 return *this;
495 }
496
500 {
502
503 tcpRecovery_.assignNoControl(other.tcpRecovery_);
504 }
505
507 {
508 joinRecovery_ = other.joinRecovery_;
509
510 gapAndErrorHandling_ = other.gapAndErrorHandling_;
511
512 instrumentRecovery_ = other.instrumentRecovery_;
513
514 marketRecovery_ = other.marketRecovery_;
515 }
516
517private:
518 JoinRecoveryOptions::Enum joinRecovery_;
519 GapAndErrorHandlingOptions::Enum gapAndErrorHandling_;
520
521 InstrumentRecoveryOptions::Enum instrumentRecovery_;
522 MarketRecoveryOptions::Enum marketRecovery_;
523
524 TcpRecoverySessionSettings tcpRecovery_;
525
527 friend struct LegacyAssigner;
528};
529
532void toStr(std::string&, const SessionSettings&);
533
535inline std::string toStr(const SessionSettings& settings)
536{
537 std::string str;
538
539 toStr(str, settings);
540
541 return str;
542}
543
547
555
563
571
579
587
595
603
611
619
627
628// Complex (one-call) setup.
629
642
654
664
665// Deprecated way of session setup.
666
667#if !defined(ONIXS_CMEMDH_NO_DEPRECATED)
668
673struct ONIXS_CMEMDH_LTWT AccuratePreopeningSession : SessionSettings
674{
677 AccuratePreopeningSession()
678 {
679 setSessionToAccuratePreopening(*this);
680 }
681};
682
687struct ONIXS_CMEMDH_LTWT AccuratePreopeningMboSession : AccuratePreopeningSession
688{
691 AccuratePreopeningMboSession()
692 {
693 setSessionToAccuratePreopening(*this);
694 setSessionToRecoverMboBooksOnly(*this);
695 }
696};
697
702struct ONIXS_CMEMDH_LTWT AccuratePreopeningMbpSession : AccuratePreopeningSession
703{
706 AccuratePreopeningMbpSession()
707 {
710 }
711};
712
717struct ONIXS_CMEMDH_LTWT AccurateLateJoinSession : SessionSettings
718{
721 AccurateLateJoinSession()
722 : SessionSettings()
723 {
725 }
726};
727
732struct ONIXS_CMEMDH_LTWT AccurateLateJoinMboSession : AccurateLateJoinSession
733{
736 AccurateLateJoinMboSession()
737 {
740 }
741};
742
747struct ONIXS_CMEMDH_LTWT AccurateLateJoinMbpSession : AccurateLateJoinSession
748{
751 AccurateLateJoinMbpSession()
752 {
755 }
756};
757
762struct ONIXS_CMEMDH_LTWT NaturalRefreshSession : SessionSettings
763{
766 NaturalRefreshSession()
767 : SessionSettings()
768 {
770 }
771};
772
773#endif // ONIXS_CMEMDH_NO_DEPRECATED
774
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:69
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:61
#define ONIXS_CMEMDH_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:63
#define ONIXS_CMEMDH_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:50
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:73
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:163
SessionSettings & marketRecovery(MarketRecoveryOptions::Enum recovery)
SessionSettings & gapAndErrorHandling(GapAndErrorHandlingOptions::Enum handling)
SessionSettings & instrumentRecovery(InstrumentRecoveryOptions::Enum recovery)
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)
Associates setting mutations with a change controller.
SettingGroup(SettingChangeController *controller=nullptr)
Creates a setting group that uses the specified controller.
void controlChange(const Messaging::Char *description, void(Changeable::*change)(), Changeable &changeable) const
Invokes a zero-argument member function as a guarded change.
void controlAssignment(const Messaging::Char *description, Assignee &assignee, Value value) const
Assigns a value while coordinating the change with the controller.
Collection of session settings related to TCP recovery.
~TcpRecoverySessionSettings()
Finalizes the instance.
TcpRecoverySessionSettings(const SettingGroup *group=nullptr)
TcpRecoverySessionSettings & operator=(const TcpRecoverySessionSettings &other)
TcpRecoverySessionSettings & servingTimeLimit(Messaging::UInt32 servingTimeLimit)
TcpRecoverySessionSettings & service(TcpRecoveryService *service)
friend class SessionSettings
Lets grouping and value assignment control functioning.
TcpRecoverySessionSettings & attempts(Messaging::UInt32 qty)
TcpRecoverySessionSettings(const TcpRecoverySessionSettings &other)
std::uint32_t UInt32
uInt32.
Definition Integral.h:35
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 setSessionToRecoverBothMboAndMbpBooks(SessionSettings &settings)
void setSessionToRecoverInstrumentsAccurately(SessionSettings &settings)
void setSessionToContinueRealtimeProcessingUponIssues(SessionSettings &settings)
void toStr(std::string &str, BookState::Enum bookState)
Appends a string representation of a book state.
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.
Messaging::UInt32 Base
Integral type used as basement for constants.
Defines market state recovery options.
Coordinates changes to settings that belong to a setting group.