OnixS C++ eSpeed ITCH Market Data Handler 1.7.3
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
27
29
30#if defined (_MSC_VER)
31
32 typedef signed char Int8;
33 typedef unsigned char UInt8;
34
35 typedef signed short Int16;
36 typedef unsigned short UInt16;
37
38 typedef signed int Int32;
39 typedef unsigned int UInt32;
40
41 typedef signed long long Int64;
42 typedef unsigned long long UInt64;
43
44#elif defined (__GNUC__)
45
46 typedef signed char Int8;
47 typedef unsigned char UInt8;
48
49 typedef signed short Int16;
50 typedef unsigned short UInt16;
51
52 #if defined (__LP64__)
53
54 typedef signed int Int32;
55 typedef unsigned int UInt32;
56
57 typedef signed long Int64;
58 typedef unsigned long UInt64;
59
60#else
61
62 typedef signed int Int32;
63 typedef unsigned int UInt32;
64
65 typedef signed long long Int64;
66 typedef unsigned long long UInt64;
67
68#endif
69
70#else
71
72 // Compiler is not (yet) supported.
73 // Integral types must be defined explicitly.
74
75 #error \
76 Cannot identify compiler toolset to define integral types. \
77 Please contact support@onixs.biz on further assistance.
78
79#endif
80
81//
82
84template<typename Type, Type Constant>
86{
88 typedef Type Value;
89
91 operator Value() const
92 {
93 return Constant;
94 }
95
98 {
99 return Constant;
100 }
101
103 static const Value value()
104 {
105 return Constant;
106 }
107};
108
110ONIXS_ESPEED_ITCH_API void toStr(std::string&, Int8);
111
113inline std::string toStr(Int8 number)
114{
115 std::string str;
116
117 toStr(str, number);
118
119 return str;
120}
121
123ONIXS_ESPEED_ITCH_API void 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
136ONIXS_ESPEED_ITCH_API void toStr(std::string&, Int16);
137
139inline std::string toStr(Int16 number)
140{
141 std::string str;
142
143 toStr(str, number);
144
145 return str;
146}
147
149ONIXS_ESPEED_ITCH_API void toStr(std::string&, UInt16);
150
152inline std::string toStr(UInt16 number)
153{
154 std::string str;
155
156 toStr(str, number);
157
158 return str;
159}
160
162ONIXS_ESPEED_ITCH_API void toStr(std::string&, Int32);
163
165inline std::string toStr(Int32 number)
166{
167 std::string str;
168
169 toStr(str, number);
170
171 return str;
172}
173
175ONIXS_ESPEED_ITCH_API void toStr(std::string&, UInt32);
176
178inline std::string toStr(UInt32 number)
179{
180 std::string str;
181
182 toStr(str, number);
183
184 return str;
185}
186
188ONIXS_ESPEED_ITCH_API void toStr(std::string&, Int64);
189
191inline std::string toStr(Int64 number)
192{
193 std::string str;
194
195 toStr(str, number);
196
197 return str;
198}
199
201ONIXS_ESPEED_ITCH_API void toStr(std::string&, UInt64);
202
204inline std::string toStr(UInt64 number)
205{
206 std::string str;
207
208 toStr(str, number);
209
210 return str;
211}
212
214template <typename Type,Type Constant>
215inline void toStr(std::string& str, IntegralConstant<Type, Constant> constant)
216{
217 toStr(str, constant());
218}
219
221template <typename Type, Type Constant >
222inline std::string toStr( IntegralConstant<Type, Constant> constant)
223{
224 std::string str;
225
226 toStr(str, constant);
227
228 return str;
229}
230
#define ONIXS_ESPEED_ITCH_NAMESPACE_BEGIN
Definition Bootstrap.h:27
#define ONIXS_ESPEED_ITCH_NAMESPACE_END
Definition Bootstrap.h:31
ONIXS_ESPEED_ITCH_API void toStr(std::string &, Int8)
Serializes given integer into a string.
Integral constant.
Definition Integral.h:86
static const Value value()
Returns value of the constant.
Definition Integral.h:103
Value operator()() const
Returns value of the constant.
Definition Integral.h:97
Type Value
Type of the constant.
Definition Integral.h:88