OnixS C++ Tradeweb Approved Publication Arrangement (APA) Handler  1.2.2.18
API documentation
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 
27 namespace OnixS
28 {
29  namespace Tradeweb
30  {
31  namespace MarketData
32  {
33  namespace Apa
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 
89  /// Integral constant.
90  template<typename Type, Type Constant>
92  {
93  /// Type of the constant.
94  typedef Type Value;
95 
96  /// Returns value of the constant.
97  operator Value() const
98  {
99  return Constant;
100  }
101 
102  /// Returns value of the constant.
103  Value operator()() const
104  {
105  return Constant;
106  }
107 
108  /// Returns value of the constant.
109  static const Value value()
110  {
111  return Constant;
112  }
113  };
114 
115  /// Serializes given integer into a string.
116  ONIXS_TRADEWEB_APA_API void toStr(std::string&, Int8);
117 
118  /// Serializes given integer into a string.
119  inline std::string toStr(Int8 number)
120  {
121  std::string str;
122 
123  toStr(str, number);
124 
125  return str;
126  }
127 
128  /// Serializes given integer into a string.
129  ONIXS_TRADEWEB_APA_API void toStr(std::string&, UInt8);
130 
131  /// Serializes given integer into a string.
132  inline std::string toStr(UInt8 number)
133  {
134  std::string str;
135 
136  toStr(str, number);
137 
138  return str;
139  }
140 
141  /// Serializes given integer into a string.
142  ONIXS_TRADEWEB_APA_API void toStr(std::string&, Int16);
143 
144  /// Serializes given integer into a string.
145  inline std::string toStr(Int16 number)
146  {
147  std::string str;
148 
149  toStr(str, number);
150 
151  return str;
152  }
153 
154  /// Serializes given integer into a string.
155  ONIXS_TRADEWEB_APA_API void toStr(std::string&, UInt16);
156 
157  /// Serializes given integer into a string.
158  inline std::string toStr(UInt16 number)
159  {
160  std::string str;
161 
162  toStr(str, number);
163 
164  return str;
165  }
166 
167  /// Serializes given integer into a string.
168  ONIXS_TRADEWEB_APA_API void toStr(std::string&, Int32);
169 
170  /// Serializes given integer into a string.
171  inline std::string toStr(Int32 number)
172  {
173  std::string str;
174 
175  toStr(str, number);
176 
177  return str;
178  }
179 
180  /// Serializes given integer into a string.
181  ONIXS_TRADEWEB_APA_API void toStr(std::string&, UInt32);
182 
183  /// Serializes given integer into a string.
184  inline std::string toStr(UInt32 number)
185  {
186  std::string str;
187 
188  toStr(str, number);
189 
190  return str;
191  }
192 
193  /// Serializes given integer into a string.
194  ONIXS_TRADEWEB_APA_API void toStr(std::string&, Int64);
195 
196  /// Serializes given integer into a string.
197  inline std::string toStr(Int64 number)
198  {
199  std::string str;
200 
201  toStr(str, number);
202 
203  return str;
204  }
205 
206  /// Serializes given integer into a string.
207  ONIXS_TRADEWEB_APA_API void toStr(std::string&, UInt64);
208 
209  /// Serializes given integer into a string.
210  inline std::string toStr(UInt64 number)
211  {
212  std::string str;
213 
214  toStr(str, number);
215 
216  return str;
217  }
218 
219  /// Serializes given constant into a string.
220  template <typename Type,Type Constant>
221  inline void toStr(std::string& str, IntegralConstant<Type, Constant> constant)
222  {
223  toStr(str, constant());
224  }
225 
226  /// Serializes given constant into a string.
227  template <typename Type, Type Constant >
228  inline 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  }
239 }
240 
static const Value value()
Returns value of the constant.
Definition: Integral.h:109
void toStr(std::string &str, const Decimal &value)
Definition: Decimal.h:251
Value operator()() const
Returns value of the constant.
Definition: Integral.h:103