OnixS C++ Cboe CFE Multicast PITCH Market Data Handler  1.12.1
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 CboeCFE
30  {
31  namespace MarketData
32  {
33  namespace Pitch
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.
98  operator Value() const
99  {
100  return Constant;
101  }
102 
103  /// Returns value of the constant.
104  Value operator()() const
105  {
106  return Constant;
107  }
108 
109  /// Returns value of the constant.
110  static const Value value()
111  {
112  return Constant;
113  }
114  };
115 
116  /// Serializes given integer into a string.
117  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, Int8);
118 
119  /// Serializes given integer into a string.
120  inline std::string toStr(Int8 number)
121  {
122  std::string str;
123 
124  toStr(str, number);
125 
126  return str;
127  }
128 
129  /// Serializes given integer into a string.
130  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, UInt8);
131 
132  /// Serializes given integer into a string.
133  inline std::string toStr(UInt8 number)
134  {
135  std::string str;
136 
137  toStr(str, number);
138 
139  return str;
140  }
141 
142  /// Serializes given integer into a string.
143  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, Int16);
144 
145  /// Serializes given integer into a string.
146  inline std::string toStr(Int16 number)
147  {
148  std::string str;
149 
150  toStr(str, number);
151 
152  return str;
153  }
154 
155  /// Serializes given integer into a string.
156  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, UInt16);
157 
158  /// Serializes given integer into a string.
159  inline std::string toStr(UInt16 number)
160  {
161  std::string str;
162 
163  toStr(str, number);
164 
165  return str;
166  }
167 
168  /// Serializes given integer into a string.
169  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, Int32);
170 
171  /// Serializes given integer into a string.
172  inline std::string toStr(Int32 number)
173  {
174  std::string str;
175 
176  toStr(str, number);
177 
178  return str;
179  }
180 
181  /// Serializes given integer into a string.
182  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, UInt32);
183 
184  /// Serializes given integer into a string.
185  inline std::string toStr(UInt32 number)
186  {
187  std::string str;
188 
189  toStr(str, number);
190 
191  return str;
192  }
193 
194  /// Serializes given integer into a string.
195  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, Int64);
196 
197  /// Serializes given integer into a string.
198  inline std::string toStr(Int64 number)
199  {
200  std::string str;
201 
202  toStr(str, number);
203 
204  return str;
205  }
206 
207  /// Serializes given integer into a string.
208  ONIXS_CBOECFE_PITCH_API void toStr(std::string&, UInt64);
209 
210  /// Serializes given integer into a string.
211  inline std::string toStr(UInt64 number)
212  {
213  std::string str;
214 
215  toStr(str, number);
216 
217  return str;
218  }
219 
220  /// Serializes given constant into a string.
221  template <typename Type,Type Constant>
222  inline void toStr(std::string& str, IntegralConstant<Type, Constant> constant)
223  {
224  toStr(str, constant());
225  }
226 
227  /// Serializes given constant into a string.
228  template <typename Type, Type Constant >
229  inline std::string toStr( IntegralConstant<Type, Constant> constant)
230  {
231  std::string str;
232 
233  toStr(str, constant);
234 
235  return str;
236  }
237  }
238  }
239  }
240 }
241 
Value operator()() const
Returns value of the constant.
Definition: Integral.h:104
static const Value value()
Returns value of the constant.
Definition: Integral.h:110
ONIXS_CBOECFE_PITCH_API void toStr(std::string &, SideIndicator::Enum)
Appends string presentation of object.
#define ONIXS_BATS_PITCH_EXPLICIT
Definition: Compiler.h:109