OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.4.2
API documentation
HandlerSettings.cpp
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 
21 
22 #include "Formatting.h"
23 #include "Formatting.Helpers.h"
24 
25 using namespace std;
27 using namespace OnixS::Util;
28 
29 
30 namespace OnixS {
31 namespace Eurex {
32 namespace MarketData {
33 
34 std::ostream& operator << (std::ostream& stream, const ServiceDescriptor& descriptor)
35 {
36  TextBuilder tb;
37  tb << descriptor;
38  return stream << tb.toString();
39 }
40 
41 std::ostream& operator << (std::ostream& stream, const FeedDescriptor& descriptor)
42 {
43  TextBuilder tb;
44  tb << descriptor;
45  return stream << tb.toString();
46 }
47 
48 std::ostream& operator << (std::ostream& stream, const InterfaceDescriptor& descriptor)
49 {
50  TextBuilder tb;
51  tb << descriptor;
52  return stream << tb.toString();
53 }
54 
55 ThreadAffinity::ThreadAffinity()
56 : indices_(new CpuIndexes())
57 {
58 }
59 
61  : indices_(new CpuIndexes())
62 {
63  *indices_ = *other.indices_;
64 }
65 
67 {
68  delete indices_;
69 }
70 
72 {
73  return indices_->empty();
74 }
75 
76 void ThreadAffinity::copyTo(CpuIndexes& indices) const
77 {
78  indices.insert(indices_->begin(), indices_->end());
79 }
80 
82 {
83  return indices_->insert(index).second;
84 }
85 
87 {
88  return indices_->erase(index);
89 }
90 
92 {
93  indices_->clear();
94 }
95 
97 {
98  *indices_ = *other.indices_;
99 
100  return *this;
101 }
102 
103 /// Returns the string representation.
104 std::string ThreadAffinity::toString() const
105 {
106  TextBuilder buidler;
107  buidler << JoinWrapper<CpuIndexes>(*indices_, ",");
108  return buidler.toString();
109 }
110 
111 std::ostream & operator << (std::ostream & stream, const RdiHandlerSettings & settings)
112 {
113  stream
114  << "Settings ["
115 
116  << endl << "incrementalFeed=" << settings.interfaceDescriptor.incrementalFeed
117  << "," << endl << "snapshotFeed=" << settings.interfaceDescriptor.snapshotFeed
118 
119  << "," << endl << "licenseDirectory=" << settings.licenseDirectory
120  << "," << endl << "lostPacketWaitTime (ms)=" << settings.lostPacketWaitTime
121  << "," << endl << "fastTemplates=" << settings.fastTemplatesFile
122  << "," << endl << "startRecoveryOnPacketGap=" << (settings.startRecoveryOnPacketGap ? "yes" : "no")
123  << "," << endl << "networkInterface=" << settings.networkInterface
124  << "," << endl << "networkInterfaceA=" << settings.networkInterfaceA
125  << "," << endl << "networkInterfaceB=" << settings.networkInterfaceB
126  << "," << endl << "logSettings=" << settings.logSettings
127  << "," << endl << "logLevel=" << settings.logLevel
128  << "," << endl << "logDirectory=" << settings.logDirectory
129  << "," << endl << "logFileNameTemplate=" << settings.logFileNamePrefix
130  << "," << endl << "useFeedA=" << settings.useFeedA
131  << "," << endl << "useFeedB=" << settings.useFeedB
132  << "," << endl << "maxPacketSize=" << settings.maxPacketSize
133  << "," << endl << "heartbeatInterval (sec)=" << settings.heartbeatInterval
134  << "," << endl << "outOfOrderPacketMaxInterval=" << settings.outOfOrderPacketMaxInterval
135  << "," << endl << "messagePoolSize (bytes)=" << settings.messagePoolSize
136  << "," << endl << "useFullSnapshotCycle=" << settings.useFullSnapshotCycle
137  << "]";
138 
139  return stream;
140 }
141 
142 std::ostream & operator << (std::ostream & stream, const EmdiHandlerSettings & settings)
143 {
144  stream
145  << "Settings ["
146 
147  << endl << "incrementalFeed=" << settings.interfaceDescriptor.incrementalFeed
148  << "," << endl << "snapshotFeed=" << settings.interfaceDescriptor.snapshotFeed
149 
150  << "," << endl << "licenseDirectory=" << settings.licenseDirectory
151  << "," << endl << "lostPacketWaitTime (ms)=" << settings.lostPacketWaitTime
152  << "," << endl << "fastTemplates=" << settings.fastTemplatesFile
153  << "," << endl << "startRecoveryOnPacketGap=" << (settings.startRecoveryOnPacketGap ? "yes" : "no")
154  << "," << endl << "networkInterface=" << settings.networkInterface
155  << "," << endl << "networkInterfaceA=" << settings.networkInterfaceA
156  << "," << endl << "networkInterfaceB=" << settings.networkInterfaceB
157  << "," << endl << "logSettings=" << settings.logSettings
158  << "," << endl << "logLevel=" << settings.logLevel
159  << "," << endl << "logDirectory=" << settings.logDirectory
160  << "," << endl << "logFileNameTemplate=" << settings.logFileNamePrefix
161  << "," << endl << "useFeedA=" << settings.useFeedA
162  << "," << endl << "useFeedB=" << settings.useFeedB
163  << "," << endl << "maxPacketSize=" << settings.maxPacketSize
164  << "," << endl << "heartbeatInterval (sec)=" << settings.heartbeatInterval
165  << "," << endl << "outOfOrderPacketMaxInterval=" << settings.outOfOrderPacketMaxInterval
166  << "," << endl << "messagePoolSize (bytes)=" << settings.messagePoolSize
167  << "," << endl << "buildInternalOrderBooks=" << settings.buildInternalOrderBooks
168  << "]";
169 
170  return stream;
171 }
172 
173 std::ostream & operator << (std::ostream & stream, const MdiHandlerSettings & settings)
174 {
175  stream
176  << "Settings ["
177  << endl << "incrementalFeed=" << settings.interfaceDescriptor.incrementalFeed
178  << "," << endl << "licenseDirectory=" << settings.licenseDirectory
179  << "," << endl << "lostPacketWaitTime (ms)=" << settings.lostPacketWaitTime
180  << "," << endl << "fastTemplates=" << settings.fastTemplatesFile
181  << "," << endl << "startRecoveryOnPacketGap=" << (settings.startRecoveryOnPacketGap ? "yes" : "no")
182  << "," << endl << "networkInterface=" << settings.networkInterface
183  << "," << endl << "networkInterfaceA=" << settings.networkInterfaceA
184  << "," << endl << "networkInterfaceB=" << settings.networkInterfaceB
185  << "," << endl << "logSettings=" << settings.logSettings
186  << "," << endl << "logLevel=" << settings.logLevel
187  << "," << endl << "logDirectory=" << settings.logDirectory
188  << "," << endl << "logFileNameTemplate=" << settings.logFileNamePrefix
189  << "," << endl << "useFeedA=" << settings.useFeedA
190  << "," << endl << "useFeedB=" << settings.useFeedB
191  << "," << endl << "maxPacketSize=" << settings.maxPacketSize
192  << "," << endl << "heartbeatInterval (sec)=" << settings.heartbeatInterval
193  << "," << endl << "outOfOrderPacketMaxInterval=" << settings.outOfOrderPacketMaxInterval
194  << "," << endl << "messagePoolSize (bytes)=" << settings.messagePoolSize
195  << "," << endl << "buildInternalOrderBooks=" << settings.buildInternalOrderBooks
196  << "]";
197 
198  return stream;
199 }
200 
201 std::ostream & operator << (std::ostream & stream, const EmdsHandlerSettings & settings)
202 {
203  stream
204  << "Settings ["
205 
206  << endl << "settlementFeed=" << settings.settlementFeedDescriptor
207  << "," << endl << "openInterestFeed=" << settings.openInterestFeedDescriptor
208  << "," << endl << "exchangeTradeFeed=" << settings.exchangeTradeFeedDescriptor
209 
210  << "," << endl << "licenseDirectory=" << settings.licenseDirectory
211  << "," << endl << "lostPacketWaitTime (ms)=" << settings.lostPacketWaitTime
212  << "," << endl << "fastTemplates=" << settings.fastTemplatesFile
213  << "," << endl << "networkInterface=" << settings.networkInterface
214  << "," << endl << "networkInterfaceA=" << settings.networkInterfaceA
215  << "," << endl << "networkInterfaceB=" << settings.networkInterfaceB
216  << "," << endl << "logSettings=" << settings.logSettings
217  << "," << endl << "logLevel=" << settings.logLevel
218  << "," << endl << "logDirectory=" << settings.logDirectory
219  << "," << endl << "logFileNameTemplate=" << settings.logFileNamePrefix
220  << "," << endl << "useFeedA=" << settings.useFeedA
221  << "," << endl << "useFeedB=" << settings.useFeedB
222  << "," << endl << "maxPacketSize=" << settings.maxPacketSize
223  << "," << endl << "heartbeatInterval (sec)=" << settings.heartbeatInterval
224  << "," << endl << "outOfOrderPacketMaxInterval=" << settings.outOfOrderPacketMaxInterval
225  << "," << endl << "messagePoolSize (bytes)=" << settings.messagePoolSize
226  << "]";
227 
228  return stream;
229 }
230 
231 namespace EOBI {
232 
233 std::ostream& operator << (std::ostream& stream, const EobiHandlerSettings& settings)
234 {
235  stream
236  << "Settings ["
237 
238  << endl << "incrementalFeed=" << settings.interfaceDescriptor.incrementalFeed
239  << "," << endl << "snapshotFeed=" << settings.interfaceDescriptor.snapshotFeed
240 
241  << "," << endl << "licenseDirectory=" << settings.licenseDirectory
242  << "," << endl << "lostPacketWaitTime (ms)=" << settings.lostPacketWaitTime
243  << "," << endl << "startRecoveryOnPacketGap=" << (settings.startRecoveryOnPacketGap ? "yes" : "no")
244  << "," << endl << "networkInterface=" << settings.networkInterface
245  << "," << endl << "networkInterfaceA=" << settings.networkInterfaceA
246  << "," << endl << "networkInterfaceB=" << settings.networkInterfaceB
247  << "," << endl << "logSettings=" << settings.logSettings
248  << "," << endl << "logLevel=" << settings.logLevel
249  << "," << endl << "logDirectory=" << settings.logDirectory
250  << "," << endl << "logFileNameTemplate=" << settings.logFileNamePrefix
251  << "," << endl << "useFeedA=" << settings.useFeedA
252  << "," << endl << "useFeedB=" << settings.useFeedB
253  << "," << endl << "maxPacketSize=" << settings.maxPacketSize
254  << "," << endl << "heartbeatInterval (sec)=" << settings.heartbeatInterval
255  << "," << endl << "outOfOrderPacketMaxInterval=" << settings.outOfOrderPacketMaxInterval
256  << "," << endl << "messagePoolSize (bytes)=" << settings.messagePoolSize
257  << "," << endl << "buildInternalOrderBooks=" << settings.buildInternalOrderBooks
258  << "," << endl << "maxBooksObjectAmount=" << settings.maxBooksObjectAmount
259  << "," << endl << "bookDepth=" << settings.bookDepth
260  << "]";
261 
262  return stream;
263 }
264 
265 }
266 
267 }}}
268 
Represents set of CPU indices.
Definition: FeedEngine.h:39
FeedDescriptor settlementFeedDescriptor
Sets Settlement prices feed technical configuration.
InterfaceDescriptor interfaceDescriptor
Sets data interface technical configuration.
FeedDescriptor openInterestFeedDescriptor
Sets Open Interest prices feed technical configuration.
MDI handler configuration settings.
InterfaceDescriptor interfaceDescriptor
Sets data interface technical configuration.
EMDI handler configuration settings.
STL namespace.
bool empty() const
Indicates whether is empty.
~ThreadAffinity()
Utilizes all the resources.
Util::TextBuilder TextBuilder
Definition: Formatting.h:43
Definition: Defines.h:30
unsigned bookDepth
Sets max book depth for order books. Default value is 10.
size_t CpuIndex
Zero-based index of CPU.
Definition: FeedEngine.h:36
ThreadAffinity & operator=(const ThreadAffinity &)
Re-initializes instance as copy of other set.
EMDI handler configuration settings.
bool insert(CpuIndex index)
Adds CPU index into set.
std::string logFileNamePrefix
Template of log file name without extension.
LogSettings::Enum logSettings
Combine LogSettings enum values to configure the logger.
FeedDescriptor exchangeTradeFeedDescriptor
Sets On-exchange trade prices feed technical configuration.
RDI handler configuration settings.
EOBI handler configuration settings.
bool buildInternalOrderBooks
Build internal books.
std::string licenseDirectory
Path to the license directory.
std::string logDirectory
Log files are stored in this directory.
bool buildInternalOrderBooks
Build internal books.
Service endpoint description.
ONIXS_EUREX_EMDI_API std::ostream & operator<<(std::ostream &stream, const FeedEngineSettings &settings)
unsigned maxBooksObjectAmount
Defines size of preallocated memory for Order Book. Default value is 100.
std::string toString() const
Returns the string representation.
void copyTo(CpuIndexes &) const
Copies set into another set.
InterfaceDescriptor interfaceDescriptor
Sets data interface technical configuration.
bool erase(CpuIndex index)
Removes CPU index from the set.