OnixS C++ CBOE CFE Binary Order Entry (BOE) Handler 1.12.0
API documentation
Loading...
Searching...
No Matches
Integral.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
26
27namespace OnixS
28{
29 namespace CboeCFE
30 {
31 namespace Trading
32 {
33 namespace BOE
34 {
35
36#if defined (_MSC_VER)
37
38 typedef signed char Int8;
39 typedef unsigned char UInt8;
40
41 typedef signed short Int16;
42 typedef unsigned short UInt16;
43
44 typedef signed int Int32;
45 typedef unsigned int UInt32;
46
47 typedef signed long long Int64;
48 typedef unsigned long long UInt64;
49
50#elif defined (__GNUC__)
51
52 typedef signed char Int8;
53 typedef unsigned char UInt8;
54
55 typedef signed short Int16;
56 typedef unsigned short UInt16;
57
58#if defined (__LP64__)
59
60 typedef signed int Int32;
61 typedef unsigned int UInt32;
62
63 typedef signed long Int64;
64 typedef unsigned long UInt64;
65
66#else
67
68 typedef signed int Int32;
69 typedef unsigned int UInt32;
70
71 typedef signed long long Int64;
72 typedef unsigned long long UInt64;
73
74#endif
75
76#else
77
78 // Compiler is not (yet) supported.
79 // Integral types must be defined explicitly.
80
81#error \
82 Cannot identify compiler toolset to define integral types. \
83 Please contact support@onixs.biz on further assistance.
84
85#endif
86
87//
88
90 template<typename Type, Type Constant>
92 {
94 typedef Type Value;
95
97 ONIXS_BATS_BOE_CONSTEXPR
99 {
100 return Constant;
101 }
102
104 ONIXS_BATS_BOE_CONSTEXPR
106 {
107 return Constant;
108 }
109
111 ONIXS_BATS_BOE_CONSTEXPR
113 {
114 return Constant;
115 }
116 };
117
119 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, Int8);
120
122 inline std::string toStr(Int8 number)
123 {
124 std::string str;
125
126 toStr(str, number);
127
128 return str;
129 }
130
132 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, UInt8);
133
135 inline std::string toStr(UInt8 number)
136 {
137 std::string str;
138
139 toStr(str, number);
140
141 return str;
142 }
143
145 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, Int16);
146
148 inline std::string toStr(Int16 number)
149 {
150 std::string str;
151
152 toStr(str, number);
153
154 return str;
155 }
156
158 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, UInt16);
159
161 inline std::string toStr(UInt16 number)
162 {
163 std::string str;
164
165 toStr(str, number);
166
167 return str;
168 }
169
171 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, Int32);
172
174 inline std::string toStr(Int32 number)
175 {
176 std::string str;
177
178 toStr(str, number);
179
180 return str;
181 }
182
184 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, UInt32);
185
187 inline std::string toStr(UInt32 number)
188 {
189 std::string str;
190
191 toStr(str, number);
192
193 return str;
194 }
195
197 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, Int64);
198
200 inline std::string toStr(Int64 number)
201 {
202 std::string str;
203
204 toStr(str, number);
205
206 return str;
207 }
208
210 ONIXS_CBOE_CFE_BOE_API void toStr(std::string&, UInt64);
211
213 inline std::string toStr(UInt64 number)
214 {
215 std::string str;
216
217 toStr(str, number);
218
219 return str;
220 }
221
223 template <typename Type,Type Constant>
224 inline void toStr(std::string& str, IntegralConstant<Type, Constant> constant)
225 {
226 toStr(str, constant());
227 }
228
230 template <typename Type, Type Constant >
231 inline std::string toStr( IntegralConstant<Type, Constant> constant)
232 {
233 std::string str;
234
235 toStr(str, constant);
236
237 return str;
238 }
239 }
240 }
241 }
242}
243
#define ONIXS_BATS_BOE_NOEXCEPT
Definition ABI.h:49
void toStr(std::string &str, const FixedPointDecimal< Mantissa, Exponent > &number)
Serializes fixed-point decimal into a string.
Definition Decimal.h:156
ONIXS_BATS_BOE_CONSTEXPR Value operator()() const ONIXS_BATS_BOE_NOEXCEPT
Returns value of the constant.
Definition Integral.h:105
static ONIXS_BATS_BOE_CONSTEXPR const Value value() ONIXS_BATS_BOE_NOEXCEPT
Returns value of the constant.
Definition Integral.h:112