OnixS C++ SGX Titan OUCH Trading Handler  1.2.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 
22 #include <set>
23 #include <vector>
24 
29 
30 
32 
33 /// Connection retries settings.
34 ///
36 {
37  /// Default constructor.
38  ///
39  ConnectionRetries () : number (0), intervalSec (0) {}
40 
41  /// Constructor.
42  ///
44  unsigned int inNumber, unsigned int inIntervalSec) : number (inNumber), intervalSec (inIntervalSec) {}
45 
46  /// Number of attempts to restore the telecommunication link.
47  /// -1 - unlimited
48  /// 0 - never (default)
49  /// >0 - the number of attempts
50  unsigned int number;
51 
52  /// The time interval between attempts to restore the telecommunication link (in seconds).
53  ///
54  /// @note The default value is 0 (zero).
55  unsigned int intervalSec;
56 };
57 
58 /// Serializes object into string.
59 ONIXS_SGXTITAN_OUCH_API void toStr(std::string&, const ConnectionRetries&);
60 
61 /// Serializes object into string.
62 inline std::string toStr(const ConnectionRetries& value)
63 {
64  std::string str;
65 
66  toStr(str, value);
67 
68  return str;
69 }
70 
71 /// Logical processors that a thread is allowed to run on (first logical CPU has index 0).
72 ///
73 typedef std::set<size_t> CpuIndexes;
74 
75 /// Handler settings.
76 ///
78 {
79  /// Initialize default instance.
80  ///
82  : logDirectory("logs")
83  , logFileNamePrefix("SgxTitanOuchTradingHandler")
84  , logSettings(LogSettings::Default)
85  , logLevel(LogLevel::Info)
86  , receiveTimeoutMs(1000)
87  , sendTimeoutMs(1000)
88  , auditTrailFileMaxSize(1024 * 1024 * 1024)
89  {}
90 
91  /// Path to the license directory.
92  ///
93  /// @note The default value is empty string (means current directory).
94  std::string licenseDirectory;
95 
96  /// Log files are stored in this directory.
97  ///
98  /// @note The default value is "logs".
99  std::string logDirectory;
100 
101  /// Template of log file name without extension.
102  ///
103  /// @note The default value is "SgxTitanOuchTradingHandler".
104  std::string logFileNamePrefix;
105 
106  /// Combine LogSettings enum values to configure the logger.
107  ///
108  /// @note The default value is LogSettings::Default.
110 
111  /// Log verbosity.
112  ///
113  /// @note The default value is LogLevel::Info.
115 
116  /// Receive timeout in milliseconds.
117  ///
118  /// @note The default value is 1 seconds (1000 ms).
119  unsigned int receiveTimeoutMs;
120 
121  /// Send timeout in milliseconds.
122  ///
123  /// @note The default value is 1 seconds (1000 ms).
124  unsigned int sendTimeoutMs;
125 
126  /// CPU affinity of the receiving thread.
127  ///
129 
130  /// CPU affinity of the sending thread.
131  ///
133 
134  /// Connection retries configuration settings.
135  ///
136  /// @see ConnectionRetries.
138 
139  /// Audit Trail files are stored in this directory.
140  ///
141  /// @note The default value is empty string.
142  std::string auditTrailDirectory;
143 
144  /// Template of Audit Trail file name without extension.
145  ///
146  /// Creates Audit Trail file that contains all messages that Handler sent or received (in the chronological order).
147  ///
148  /// @note The default value is empty string (means no audit trail files required).
149  std::string auditTrailFile;
150 
151  /// CPU affinity of the audit trail thread.
152  ///
154 
155  /// Max size for audit trail file in megabytes, another file will be created if the size is exceeded.
156  ///
157  /// @note The default value is 1024 Mb.
159 };
160 
161 /// Serializes object into string.
162 ONIXS_SGXTITAN_OUCH_API void toStr(std::string&, const HandlerSettings&);
163 
164 /// Serializes object into string.
165 inline std::string toStr(const HandlerSettings& value)
166 {
167  std::string str;
168 
169  toStr(str, value);
170 
171  return str;
172 }
173 
174 
175 ///
177 {
178  /// Requested Session
179  std::string session;
180 
181  /// Username.
182  std::string userName;
183 
184  /// Password.
185  std::string password;
186 
187  /// Specifies the next sequence number the client wants to receive upon
188  /// connection, or 0 to start receiving the most recently generated message
190 
191  /// Consturctor
193  : sequenceNumber(0)
194  {}
195 };
196 
197 /// Serializes object into string.
198 ONIXS_SGXTITAN_OUCH_API void toStr(std::string&, const LogonSettings&);
199 
200 /// Serializes object into string.
201 inline std::string toStr(const LogonSettings& value)
202 {
203  std::string str;
204 
205  toStr(str, value);
206 
207  return str;
208 }
209 
210 
std::string session
Requested Session.
ConnectionRetries(unsigned int inNumber, unsigned int inIntervalSec)
#define ONIXS_SGXTITAN_OUCH_NAMESPACE_END
Definition: Bootstrap.h:31
#define ONIXS_SGXTITAN_OUCH_NAMESPACE_BEGIN
Definition: Bootstrap.h:27
std::string toStr(const LogonSettings &value)
Serializes object into string.