OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
FeedSettings.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
28
30
31// A bit of forward declarations.
32
34(
35 NetFeedEngine
36);
37
40template
41<
42 typename Layout
43>
44class
46{
47 const SettingGroup& group_;
48
49 Layout layout_;
50 UInt32 heartbeatInterval_;
51
52 std::string feedANetworkInterfaces_;
53 std::string feedBNetworkInterfaces_;
54
56 operator =(
57 const
58 FeedSettingsBase& other);
59
60protected:
61 // Makes assignment more flexible.
62 friend
64 (
66 );
67
71 const SettingGroup* group,
72 Layout layout, UInt32 heartbeat)
73 : group_(
74 group
75 ? *group
76 : SettingGroup::null())
77 , layout_(layout)
78 , heartbeatInterval_(heartbeat)
79 {
80 }
81
89 const
90 FeedSettingsBase& other)
91 : group_(
92 SettingGroup::null())
93 , layout_(
94 other.layout_)
95 , heartbeatInterval_(
96 other.heartbeatInterval_)
97 , feedANetworkInterfaces_(
98 other.feedANetworkInterfaces_)
99 , feedBNetworkInterfaces_(
100 other.feedBNetworkInterfaces_)
101 {
102 }
103
104 // Finalizes the instance.
106 {
107 }
108
111 const
113 group() const
114 {
115 return group_;
116 }
117
121 void
123 const FeedSettingsBase& other)
124 {
125 layout_ =
126 other.layout_;
127
128 heartbeatInterval_ =
129 other.heartbeatInterval_;
130
131 feedANetworkInterfaces_ =
132 other.feedANetworkInterfaces_;
133
134 feedBNetworkInterfaces_ =
135 other.feedBNetworkInterfaces_;
136 }
137
138public:
140 Layout layout() const
141 {
142 return layout_;
143 }
144
146 void
148 Layout value)
149 {
150 group_.
151 controlAssignment
152 (
153 "Layout",
154 layout_,
155 value
156 );
157 }
158
165 UInt32
167 {
168 return heartbeatInterval_;
169 }
170
172 void
174 UInt32 interval)
175 {
176 group_.
177 controlAssignment
178 (
179 "Heartbeat Interval",
180 heartbeatInterval_,
181 interval
182 );
183 }
184
194 const
195 std::string&
197 {
198 return feedANetworkInterfaces_;
199 }
200
204 void
206 const std::string& interfaces)
207 {
208 group_.
209 controlAssignment
210 (
211 "Feed A Network Interfaces",
212 feedANetworkInterfaces_,
213 interfaces
214 );
215 }
216
226 const
227 std::string&
229 {
230 return feedBNetworkInterfaces_;
231 }
232
236 void
238 const std::string& interfaces)
239 {
240 group_.
241 controlAssignment
242 (
243 "Feed B Network Interfaces",
244 feedBNetworkInterfaces_,
245 interfaces
246 );
247 }
248};
249
284
286ONIXS_CONFLATEDUDP_EXPORTED
287void
289 std::string&,
291
293inline
294std::string
297{
298 std::string str;
299
300 toStr(str, layout);
301
302 return str;
303}
304
308: public FeedSettingsBase
309 <
311 >
312{
313 friend
315 (
317 );
318
319 typedef
321 <
323 >
324 Base;
325
326 void
327 assignNoControl(
328 const
330 {
331 Base::assignNoControl(other);
332 }
333
334public:
341 const SettingGroup* group = NULL)
342 : Base(
343 group,
345 FeedAWithFailoverToFeedB,
346 30)
347 {
348 }
349
353 : Base(static_cast<const Base&>(other))
354 {
355 }
356
361
364 operator =(
365 const
367 {
368 group().
369 controlAssignment
370 (
371 "Multicast Recovery Feed Settings",
372 &MulticastRecoveryFeedSettings::assignNoControl,
373 *this,
374 other
375 );
376
377 return *this;
378 }
379};
380
382ONIXS_CONFLATEDUDP_EXPORTED
383void
385 std::string&,
387
389inline
390std::string
392 const
394{
395 std::string str;
396
397 toStr(str, settings);
398
399 return str;
400}
401
405: public FeedSettingsBase
406 <
408 >
409{
410 // Makes assignment more flexible.
411 friend
413 (
415 );
416
417 typedef
419 <
421 >
422 Base;
423
424 UInt32 connectionAttempts_;
425 UInt32 connectionTimeout_;
426 UInt32 sendTimeout_;
427
428 void
429 assignNoControl(
430 const TcpRecoveryFeedSettings& other)
431 {
432 Base::assignNoControl(other);
433
434 connectionAttempts_ =
435 other.connectionAttempts_;
436
437 connectionTimeout_ =
438 other.connectionTimeout_;
439
440 sendTimeout_ =
441 other.sendTimeout_;
442 }
443
444public:
451 const SettingGroup* group = NULL)
452 : Base(
453 group,
455 FeedAOnly,
456 2)
457 , connectionAttempts_(3)
458 , connectionTimeout_(500)
459 , sendTimeout_(5000)
460 {
461 }
462
466 const
468 : Base(
469 static_cast
470 <const Base&>
471 (other))
472 , connectionAttempts_(
473 other.connectionAttempts_)
474 , connectionTimeout_(
475 other.connectionTimeout_)
476 , sendTimeout_(
477 other.sendTimeout_)
478 {
479 }
480
485
491 UInt32
493 {
494 return connectionAttempts_;
495 }
496
500 void
502 UInt32 attemptQty)
503 {
504 group().
505 controlAssignment
506 (
507 "Connection Attempts",
508 connectionAttempts_,
509 attemptQty
510 );
511 }
512
520 UInt32
522 {
523 return connectionTimeout_;
524 }
525
531 void
534 {
535 group().
536 controlAssignment
537 (
538 "Connection Timeout",
539 connectionTimeout_,
541 );
542 }
543
549 UInt32
551 {
552 return sendTimeout_;
553 }
554
558 void
561 {
562 group().
563 controlAssignment
564 (
565 "Send Timeout",
566 sendTimeout_,
568 );
569 }
570
574 operator =(
575 const
577 {
578 group().
579 controlAssignment
580 (
581 "TCP Recovery Feed Settings",
582 &TcpRecoveryFeedSettings::assignNoControl,
583 *this,
584 other
585 );
586
587 return *this;
588 }
589};
590
592ONIXS_CONFLATEDUDP_EXPORTED
593void
595 std::string&,
597
599inline
600std::string
602 const TcpRecoveryFeedSettings& settings)
603{
604 std::string str;
605
606 toStr(str, settings);
607
608 return str;
609}
610
648
650ONIXS_CONFLATEDUDP_EXPORTED
651void
653 std::string&,
655
657inline
658std::string
661{
662 std::string str;
663
664 toStr(str, layout);
665
666 return str;
667}
668
672: public FeedSettingsBase
673 <
675 >
676{
677 friend
679 (
681 );
682
683 typedef
685 <
687 >
688 Base;
689
690 UInt32 outOfOrderPacketMaxInterval_;
691 UInt32 lostPacketWaitTime_;
692
693 void
694 assignNoControl(
695 const RealtimeFeedSettings& other)
696 {
697 Base::assignNoControl(other);
698
699 outOfOrderPacketMaxInterval_ =
700 other.outOfOrderPacketMaxInterval_;
701
702 lostPacketWaitTime_ =
703 other.lostPacketWaitTime_;
704 }
705
706public:
712 const SettingGroup* group = NULL)
713 : Base(
714 group,
716 BothFeedsWithArbitrage,
717 30)
718 , outOfOrderPacketMaxInterval_(3)
719 , lostPacketWaitTime_(100000)
720 {
721 }
722
726 const
728 : Base(
729 static_cast
730 <const Base&>
731 (other))
732 , outOfOrderPacketMaxInterval_(
733 other.outOfOrderPacketMaxInterval_)
734 , lostPacketWaitTime_(
735 other.lostPacketWaitTime_)
736 {
737 }
738
743
772 UInt32
774 {
775 return outOfOrderPacketMaxInterval_;
776 }
777
780 void
782 UInt32 intervalLength)
783 {
784 group().
785 controlAssignment
786 (
787 "Out Of Order Packet Max Interval",
788 outOfOrderPacketMaxInterval_,
789 intervalLength
790 );
791 }
792
814 UInt32
816 {
817 return lostPacketWaitTime_;
818 }
819
822 void
824 UInt32 waitTime)
825 {
826 group().
827 controlAssignment
828 (
829 "Lost Packet Wait Time",
830 lostPacketWaitTime_,
831 waitTime
832 );
833 }
834
838 operator =(
839 const
841 {
842 group().
843 controlAssignment
844 (
845 "Realtime Feed Settings",
846 &RealtimeFeedSettings::assignNoControl,
847 *this,
848 other
849 );
850
851 return *this;
852 }
853};
854
856ONIXS_CONFLATEDUDP_EXPORTED
857void
859 std::string&,
860 const RealtimeFeedSettings&);
861
863inline
864std::string
866 const RealtimeFeedSettings& settings)
867{
868 std::string str;
869
870 toStr(str, settings);
871
872 return str;
873}
874
878FeedSettings : public SettingGroup
879{
880 // To let assignment be controlled
881 // by the master container.
882 friend
884 (
886 );
887
888 std::string connectivityConfigurationFile_;
889
890 PacketSize packetMaxSize_;
891
892 RealtimeFeedSettings incrementalFeeds_;
893
894 MulticastRecoveryFeedSettings instrumentFeeds_;
895 MulticastRecoveryFeedSettings snapshotFeeds_;
896 MulticastRecoveryFeedSettings mboSnapshotFeeds_;
897
898 TcpRecoveryFeedSettings historicalFeeds_;
899
900 NetFeedEngine* engine_;
901
902 // Casts the given instance to an
903 // instance of SettingGroup class.
904 const
905 SettingGroup&
906 group() const
907 {
908 return *this;
909 }
910
911 // Re-initializes the given instance
912 // as a copy of the other one without
913 // involving assignment control service.
914 void
915 assignNoControl(
916 const FeedSettings& other)
917 {
918 connectivityConfigurationFile_ =
919 other.connectivityConfigurationFile_;
920
921 packetMaxSize_ =
922 other.packetMaxSize_;
923
924 incrementalFeeds_.
925 assignNoControl(
926 other.incrementalFeeds_);
927
928 instrumentFeeds_.
929 assignNoControl(
930 other.instrumentFeeds_);
931
932 snapshotFeeds_.
933 assignNoControl(
934 other.snapshotFeeds_);
935
936 mboSnapshotFeeds_.
937 assignNoControl(
938 other.mboSnapshotFeeds_);
939
940 historicalFeeds_.
941 assignNoControl(
942 other.historicalFeeds_);
943
944 engine_ = other.engine_;
945 }
946
947 // Updates interfaces for all primary feeds
948 // without involving assignment control services.
949 void
950 assignFeedAInterfaces(
951 const std::string& interfaces)
952 {
953 incrementalFeeds_.
954 feedANetworkInterfaces_ =
955
956 instrumentFeeds_.
957 feedANetworkInterfaces_ =
958
959 snapshotFeeds_.
960 feedANetworkInterfaces_ =
961
962 mboSnapshotFeeds_.
963 feedANetworkInterfaces_ =
964
965 historicalFeeds_.
966 feedANetworkInterfaces_ =
967
968 interfaces;
969 }
970
971 // Updates interfaces for all primary feeds
972 // without involving assignment control services.
973 void
974 assignFeedBInterfaces(
975 const std::string& interfaces)
976 {
977 incrementalFeeds_.
978 feedBNetworkInterfaces_ =
979
980 instrumentFeeds_.
981 feedBNetworkInterfaces_ =
982
983 snapshotFeeds_.
984 feedBNetworkInterfaces_ =
985
986 mboSnapshotFeeds_.
987 feedBNetworkInterfaces_ =
988
989 historicalFeeds_.
990 feedBNetworkInterfaces_ =
991
992 interfaces;
993 }
994
995public:
999 controller = NULL)
1000 : SettingGroup(controller)
1001 , packetMaxSize_(1420)
1002 , incrementalFeeds_(&group())
1003 , instrumentFeeds_(&group())
1004 , snapshotFeeds_(&group())
1005 , mboSnapshotFeeds_(&group())
1006 , historicalFeeds_(&group())
1007 , engine_(NULL)
1008 {
1009 }
1010
1014 const FeedSettings& other)
1015 : SettingGroup()
1016 , connectivityConfigurationFile_(
1017 other.connectivityConfigurationFile_)
1018 , packetMaxSize_(
1019 other.packetMaxSize_)
1020 , incrementalFeeds_(
1021 other.incrementalFeeds_)
1022 , instrumentFeeds_(
1023 other.instrumentFeeds_)
1024 , snapshotFeeds_(
1025 other.snapshotFeeds_)
1026 , mboSnapshotFeeds_(
1027 other.mboSnapshotFeeds_)
1028 , historicalFeeds_(
1029 other.historicalFeeds_)
1030 , engine_(
1031 other.engine_)
1032 {
1033 }
1034
1036 const
1037 std::string&
1039 {
1040 return connectivityConfigurationFile_;
1041 }
1042
1044 void
1046 const std::string& configurationFile)
1047 {
1048 group().
1050 (
1051 "Connectivity Configuration File",
1052 connectivityConfigurationFile_,
1053 configurationFile
1054 );
1055 }
1056
1060 void
1062 const std::string& interfaces)
1063 {
1064 group().
1066 (
1067 "Feed A Network Interfaces for All Feeds",
1068 &FeedSettings::assignFeedAInterfaces,
1069 *this,
1070 interfaces
1071 );
1072 }
1073
1077 void
1079 const std::string& interfaces)
1080 {
1081 group().
1083 (
1084 "Feed B Network Interfaces for All Feeds",
1085 &FeedSettings::assignFeedBInterfaces,
1086 *this,
1087 interfaces
1088 );
1089 }
1090
1095 {
1096 return packetMaxSize_;
1097 }
1098
1100 void
1102 PacketSize value)
1103 {
1104 group().
1106 (
1107 "Packet Max Size",
1108 packetMaxSize_,
1109 value
1110 );
1111 }
1112
1114 const
1117 {
1118 return incrementalFeeds_;
1119 }
1120
1124 {
1125 return incrementalFeeds_;
1126 }
1127
1129 const
1132 {
1133 return instrumentFeeds_;
1134 }
1135
1139 {
1140 return instrumentFeeds_;
1141 }
1142
1144 const
1147 {
1148 return snapshotFeeds_;
1149 }
1150
1154 {
1155 return snapshotFeeds_;
1156 }
1157
1159 const
1162 {
1163 return mboSnapshotFeeds_;
1164 }
1165
1169 {
1170 return mboSnapshotFeeds_;
1171 }
1172
1174 const
1177 {
1178 return historicalFeeds_;
1179 }
1180
1184 {
1185 return historicalFeeds_;
1186 }
1187
1191 {
1192 return engine_;
1193 }
1194
1196 void
1199 {
1200 group().
1202 (
1203 "Feed Engine",
1204 engine_,
1205 engine
1206 );
1207 }
1208
1212 operator =(
1213 const FeedSettings& other)
1214 {
1215 group().
1217 (
1218 "Feed Settings",
1219 &FeedSettings::assignNoControl,
1220 *this,
1221 other
1222 );
1223
1224 return *this;
1225 }
1226};
1227
1229ONIXS_CONFLATEDUDP_EXPORTED
1230void
1232 std::string&,
1233 const FeedSettings&);
1234
1236inline
1237std::string
1239 const FeedSettings& settings)
1240{
1241 std::string str;
1242
1243 toStr(str, settings);
1244
1245 return str;
1246}
1247
#define ONIXS_CONFLATEDUDP_LTWT_STRUCT
Definition Bootstrap.h:99
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_EXPORTED_CLASS_DECL(typeName)
Definition Bootstrap.h:47
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:107
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
void feedANetworkInterfaces(const std::string &interfaces)
void assignNoControl(const FeedSettingsBase &other)
const std::string & feedANetworkInterfaces() const
void layout(Layout value)
Defines feed layout for recovery feed group.
const std::string & feedBNetworkInterfaces() const
void heartbeatInterval(UInt32 interval)
Specifies maximal time interval between two packets.
FeedSettingsBase(const SettingGroup *group, Layout layout, UInt32 heartbeat)
FeedSettingsBase(const FeedSettingsBase &other)
void feedBNetworkInterfaces(const std::string &interfaces)
void feedANetworkInterfaces(const std::string &interfaces)
RealtimeFeedSettings & incrementalFeeds()
The settings related to incremental feeds.
FeedSettings(const FeedSettings &other)
void connectivityConfigurationFile(const std::string &configurationFile)
Sets path to the connectivity configuration file.
void packetMaxSize(PacketSize value)
Max size for network packet transmitted by MDP.
const MulticastRecoveryFeedSettings & instrumentFeeds() const
The settings related to instrument feeds.
const std::string & connectivityConfigurationFile() const
Path to the connectivity configuration file.
TcpRecoveryFeedSettings & historicalFeeds()
The settings related to historical (TCP Recovery) feeds.
void engine(NetFeedEngine *engine)
Defines instance of the Feed Engine to be used by the Handler.
const MulticastRecoveryFeedSettings & snapshotFeeds() const
The settings related to snapshot feeds.
const RealtimeFeedSettings & incrementalFeeds() const
The settings related to incremental feeds.
MulticastRecoveryFeedSettings & instrumentFeeds()
The settings related to instrument feeds.
FeedSettings(SettingAssignController *controller=NULL)
Initializes the instance with the default values.
const MulticastRecoveryFeedSettings & mboSnapshotFeeds() const
The settings related to snapshot feeds.
void feedBNetworkInterfaces(const std::string &interfaces)
MulticastRecoveryFeedSettings & snapshotFeeds()
The settings related to snapshot feeds.
MulticastRecoveryFeedSettings & mboSnapshotFeeds()
The settings related to snapshot feeds.
const TcpRecoveryFeedSettings & historicalFeeds() const
The settings related to historical (TCP recovery) feeds.
Collection of parameters affecting recovery feeds behavior.
MulticastRecoveryFeedSettings(const SettingGroup *group=NULL)
MulticastRecoveryFeedSettings(const MulticastRecoveryFeedSettings &other)
Initializes the instance as a copy of the other one.
Collection of parameters affecting real-time feeds behavior.
void outOfOrderPacketMaxInterval(UInt32 intervalLength)
RealtimeFeedSettings(const RealtimeFeedSettings &other)
RealtimeFeedSettings(const SettingGroup *group=NULL)
Base services for settings grouped by a certain criteria.
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
Collection of parameters affecting recovery feeds behavior.
TcpRecoveryFeedSettings(const TcpRecoveryFeedSettings &other)
TcpRecoveryFeedSettings(const SettingGroup *group=NULL)
void connectionTimeout(UInt32 connectionTimeout)
ONIXS_CONFLATEDUDP_EXPORTED void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
UInt32 UInt32
uInt32.
Definition Fields.h:261
UInt16 PacketSize
Integral type for measuring packets.
@ FeedBOnly
Indicates only feed B is used as source for market data.
@ BothFeedsWithArbitrage
Handler arbitrates between both feeds A and B.
@ FeedAOnly
Indicates only feed A is used as source for market data.
@ FeedBOnly
Indicates only feed B is used as source for market data.
@ FeedAOnly
Indicates only feed A is used as source for market data.