OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
Numeric.cpp
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 #include <cassert>
22 
23 #include "NumberFormatting.h"
24 #include "TypeTraitsVerification.h"
25 
26 #include "NamespaceHelper.h"
27 
28 ONIXS_HANDLER_NAMESPACE_BEGIN
29 
30 // Verifications on numeric type sizes.
31 
32 ONIXS_ENSURE_TYPE_SIZE(Int8, 1);
33 ONIXS_ENSURE_TYPE_SIZE(UInt8, 1);
34 
35 ONIXS_ENSURE_TYPE_SIZE(Int16, 2);
36 ONIXS_ENSURE_TYPE_SIZE(UInt16, 2);
37 
38 ONIXS_ENSURE_TYPE_SIZE(Int32, 4);
39 ONIXS_ENSURE_TYPE_SIZE(UInt32, 4);
40 
41 ONIXS_ENSURE_TYPE_SIZE(Int64, 8);
42 ONIXS_ENSURE_TYPE_SIZE(UInt64, 8);
43 
44 // Serialization.
45 
46 void toStr(std::string& str, Int8 value)
47 {
48  integerToStr(str, value);
49 }
50 
51 void toStr(std::string& str, UInt8 value)
52 {
53  integerToStr(str, value);
54 }
55 
56 void toStr(std::string& str, Int16 value)
57 {
58  integerToStr(str, value);
59 }
60 
61 void toStr(std::string& str, UInt16 value)
62 {
63  integerToStr(str, value);
64 }
65 
66 void toStr(std::string& str, Int32 value)
67 {
68  integerToStr(str, value);
69 }
70 
71 void toStr(std::string& str, UInt32 value)
72 {
73  integerToStr(str, value);
74 }
75 
76 void toStr(std::string& str, Int64 value)
77 {
78  integerToStr(str, value);
79 }
80 
81 void toStr(std::string& str, UInt64 value)
82 {
83  integerToStr(str, value);
84 }
85 
86 ONIXS_HANDLER_NAMESPACE_END
#define ONIXS_ENSURE_TYPE_SIZE(Type, Size)
boost::enable_if< boost::is_integral< Integer > >::type integerToStr(std::string &str, Integer integer)
ONIXS_SGXTITAN_ITCH_API void toStr(std::string &, MessageType::Enum)
Appends string presentation of object.