OnixS C++ CBOE CFE Binary Order Entry (BOE) Handler  1.11.0
API documentation
HandlerSettings.h
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 
20 #pragma once
21 
26 
27 #include <set>
28 #include <vector>
29 
30 namespace OnixS {
31 namespace CboeCFE {
32 namespace Trading {
33 namespace BOE {
34 
35 /// Connection retries settings.
36 ///
38 {
39  /// Default constructor.
40  ///
42 
43  /// Constructor.
44  ///
45  ConnectionRetries (int inNumber, unsigned inIntervalSec) : number (inNumber), intervalSec (inIntervalSec) {}
46 
47  /// Number of attempts to restore the telecommunication link.
48  /// -1 - unlimited
49  /// 0 - never (default)
50  /// >0 - the number of attempts
51  int number;
52 
53  /// The time interval between attempts to restore the telecommunication link (in seconds).
54  ///
55  /// @note The default value is 0 (zero).
56  unsigned int intervalSec;
57 };
58 
59 /// Serializes object into string.
60 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, const ConnectionRetries&);
61 
62 /// Serializes object into string.
63 inline std::string toStr(const ConnectionRetries& value)
64 {
65  std::string str;
66 
67  toStr(str, value);
68 
69  return str;
70 }
71 
72 /// Logical processors that a thread is allowed to run on (first logical CPU has index 0).
73 ///
74 typedef std::set<size_t> CpuIndexes;
75 
76 /// Handler settings.
77 ///
79 {
80  /// Initialize default instance.
81  ///
83  : logDirectory("logs")
84  , logFileNamePrefix("CboeCfeBoeHandler")
85  , logSettings(LogSettings::Default)
86  , logLevel(LogLevel::Info)
87  , receiveTimeoutMs(1000)
88  , sendTimeoutMs(1000)
89  , auditTrailFileMaxSize(1024 * 1024 * 1024)
90  , receiveSpinningTimeout(0)
91  , sendSpinningTimeout(0)
92  {}
93 
94  /// Path to the license directory.
95  ///
96  /// @note The default value is empty string (means current directory).
97  std::string licenseDirectory;
98 
99  /// Log files are stored in this directory.
100  ///
101  /// @note The default value is "logs".
102  std::string logDirectory;
103 
104  /// Template of log file name without extension.
105  ///
106  /// @note The default value is "CboeCfeBoeHandlerCpp".
107  std::string logFileNamePrefix;
108 
109  /// Combine LogSettings enum values to configure the logger.
110  ///
111  /// @note The default value is LogSettings::Default.
113 
114  /// Log verbosity.
115  ///
116  /// @note The default value is LogLevel::Info.
118 
119  /// Receive timeout in milliseconds.
120  ///
121  /// @note The default value is 1 seconds (1000 ms).
123 
124  /// Send timeout in milliseconds.
125  ///
126  /// @note The default value is 1 seconds (1000 ms).
128 
129  /// CPU affinity of the receiving thread.
130  ///
132 
133  /// CPU affinity of the sending thread.
134  ///
136 
137  /// Connection retries configuration settings.
138  ///
139  /// @see ConnectionRetries.
141 
142  /// Audit Trail files are stored in this directory.
143  ///
144  /// @note The default value is empty string.
145  std::string auditTrailDirectory;
146 
147  /// Template of Audit Trail file name without extension.
148  ///
149  /// Creates Audit Trail file that contains all messages that Handler sent or received (in the chronological order).
150  ///
151  /// @note The default value is empty string (means no audit trail files required).
152  std::string auditTrailFile;
153 
154  /// CPU affinity of the audit trail thread.
155  ///
157 
158  /// Max size for audit trail file in megabytes, another file will be created if the size is exceeded.
159  ///
160  /// @note The default value is 1024 Mb.
162 
163  /// Sets the receive spinning timeout (microseconds).
165 
166  /// Sets the send spinning timeout (microseconds).
168 };
169 
170 /// Serializes object into string.
171 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, const HandlerSettings&);
172 
173 /// Serializes object into string.
174 inline std::string toStr(const HandlerSettings& value)
175 {
176  std::string str;
177 
178  toStr(str, value);
179 
180  return str;
181 }
182 
183 /// Controls replay behavior for unknown units.
185 {
186  typedef Char Base;
187 
188  enum Enum
189  {
190  ///
191  FailIfUnitNotSpecified = 'F',
192 
193  ///
194  ReplayAnyUnspecifiedUnitFromZero = 'R',
195 
196  ///
197  SkipReplayOfUnspecifiedUnits = 'S'
198  };
199 };
200 
201 /// Appends string presentation of object.
202 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, ReplayUnspecifiedUnit::Enum);
203 
204 /// Returns string presentation of object.
205 inline std::string toStr(ReplayUnspecifiedUnit::Enum value)
206 {
207  std::string str;
208 
209  toStr(str, value);
210 
211  return str;
212 }
213 
214 ///
216 {
217  /// Session Id as supplied by CFE
218  std::string sessionId;
219 
220  /// Session Sub ID supplied by CFE.
221  std::string sessionSubId;
222 
223  /// The password associated with the SessionId and SessionSubId.
224  std::string password;
225 
226  /// Controls replay behavior for unknown units.
228 
229  struct Unit
230  {
231  /// A unit number. This must be the unit number of the port.
233 
234  /// Last received sequence number for the unit.
236  };
237 
238  /// Unit/sequence pairs to follow, one per unit from which the TPH has received messages over this port.
239  std::vector<Unit> units;
240 
241  ///
243  : replayUnspecifiedUnit(ReplayUnspecifiedUnit::FailIfUnitNotSpecified)
244  {}
245 };
246 
247 /// Serializes object into string.
248 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, const LogonSettings&);
249 
250 /// Serializes object into string.
251 inline std::string toStr(const LogonSettings& value)
252 {
253  std::string str;
254 
255  toStr(str, value);
256 
257  return str;
258 }
259 
260 }
261 }
262 }
263 }
std::set< size_t > CpuIndexes
std::vector< Unit > units
Unit/sequence pairs to follow, one per unit from which the TPH has received messages over this port...
Binary4 sequence
Last received sequence number for the unit.
void toStr(std::string &str, const FixedPointDecimal< Mantissa, Exponent > &number)
Serializes fixed-point decimal into a string.
Definition: Decimal.h:156
unsigned receiveSpinningTimeout
Sets the receive spinning timeout (microseconds).
std::string sessionSubId
Session Sub ID supplied by CFE.
Controls replay behavior for unknown units.
unsigned sendSpinningTimeout
Sets the send spinning timeout (microseconds).
std::string password
The password associated with the SessionId and SessionSubId.
Binary1 number
A unit number. This must be the unit number of the port.
ReplayUnspecifiedUnit::Enum replayUnspecifiedUnit
Controls replay behavior for unknown units.
std::string sessionId
Session Id as supplied by CFE.
ConnectionRetries(int inNumber, unsigned inIntervalSec)
char Char
Character type alias.
Definition: String.h:42