OnixS C++ CME MDP Premium Market Data Handler 5.9.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
28
29#if defined(_MSC_VER)
30
31typedef signed char Int8;
32typedef unsigned char UInt8;
33
34typedef signed short Int16;
35typedef unsigned short UInt16;
36
37typedef signed int Int32;
38typedef unsigned int UInt32;
39
40typedef signed long long Int64;
41typedef unsigned long long UInt64;
42
43#elif defined(__GNUC__)
44
45typedef signed char Int8;
46typedef unsigned char UInt8;
47
48typedef signed short Int16;
49typedef unsigned short UInt16;
50
51# if defined(__LP64__)
52
53typedef signed int Int32;
54typedef unsigned int UInt32;
55
56typedef signed long Int64;
57typedef unsigned long UInt64;
58
59# else
60
61typedef signed int Int32;
62typedef unsigned int UInt32;
63
64typedef signed long long Int64;
65typedef unsigned long long UInt64;
66
67# endif
68
69#else
70
71// Compiler is not (yet) supported.
72// Integral types must be defined explicitly.
73
74# error Cannot identify compiler toolset to define integral types. \
75 Please contact support@onixs.biz on further assistance.
76
77#endif
78
79//
80
82template <typename Type, Type Constant>
84{
86 typedef Type Value;
87
89 operator Value() const
90 {
91 return Constant;
92 }
93
96 {
97 return Constant;
98 }
99
101 static Value value()
102 {
103 return Constant;
104 }
105};
106
109void toStr(std::string&, Int8);
110
112inline std::string toStr(Int8 number)
113{
114 std::string str;
115
116 toStr(str, number);
117
118 return str;
119}
120
123void toStr(std::string&, UInt8);
124
126inline std::string toStr(UInt8 number)
127{
128 std::string str;
129
130 toStr(str, number);
131
132 return str;
133}
134
137void toStr(std::string&, Int16);
138
140inline std::string toStr(Int16 number)
141{
142 std::string str;
143
144 toStr(str, number);
145
146 return str;
147}
148
151void toStr(std::string&, UInt16);
152
154inline std::string toStr(UInt16 number)
155{
156 std::string str;
157
158 toStr(str, number);
159
160 return str;
161}
162
165void toStr(std::string&, Int32);
166
168inline std::string toStr(Int32 number)
169{
170 std::string str;
171
172 toStr(str, number);
173
174 return str;
175}
176
179void toStr(std::string&, UInt32);
180
182inline std::string toStr(UInt32 number)
183{
184 std::string str;
185
186 toStr(str, number);
187
188 return str;
189}
190
193void toStr(std::string&, Int64);
194
196inline std::string toStr(Int64 number)
197{
198 std::string str;
199
200 toStr(str, number);
201
202 return str;
203}
204
207void toStr(std::string&, UInt64);
208
210inline std::string toStr(UInt64 number)
211{
212 std::string str;
213
214 toStr(str, number);
215
216 return str;
217}
218
220template <typename Type, Type Constant>
221inline void toStr(std::string& str, IntegralConstant<Type, Constant> constant)
222{
223 toStr(str, constant());
224}
225
227template <typename Type, Type Constant>
228inline std::string toStr(IntegralConstant<Type, Constant> constant)
229{
230 std::string str;
231
232 toStr(str, constant);
233
234 return str;
235}
236
237//
238
246bool fromStr(Int8&, const Char*, size_t);
247
255bool fromStr(UInt8&, const Char*, size_t);
256
264bool fromStr(Int16&, const Char*, size_t);
265
273bool fromStr(UInt16&, const Char*, size_t);
274
282bool fromStr(Int32&, const Char*, size_t);
283
291bool fromStr(UInt32&, const Char*, size_t);
292
300bool fromStr(Int64&, const Char*, size_t);
301
309bool fromStr(UInt64&, const Char*, size_t);
310
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
Int8 Int8
int8.
Definition Fields.h:63
bool fromStr(Decimal &, const Char *, size_t)
Deserializes a decimal number from the given text presentation.
UInt64 UInt64
uInt64.
Definition Fields.h:205
Int32 Int32
int32.
Definition Fields.h:60
char Char
Character type alias.
Definition String.h:36
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
UInt32 UInt32
uInt32.
Definition Fields.h:202
Int16 Int16
int16.
Definition Fields.h:57
UInt8 UInt8
uInt8.
Definition Fields.h:208
UInt16 UInt16
uInt16.
Definition Fields.h:199
static Value value()
Returns value of the constant.
Definition Integral.h:101
Value operator()() const
Returns value of the constant.
Definition Integral.h:95