OnixS C++ SGX Titan OUCH Trading Handler  1.2.0
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 <util/HexEncoding.h>
24 
26 
27 #include "NumberFormatting.h"
28 #include "TypeTraitsVerification.h"
29 #include "SerializationUtils.h"
30 
31 namespace OnixS {
32  namespace SgxTitan {
33  namespace Trading {
34  namespace Ouch
35  {
36 
37  // Verifications on numeric type sizes.
38 
41 
44 
47 
50 
52 
53  // Serialization.
54 
55  void toStr(std::string& str, Int8 value)
56  {
57  integerToStr(str, value);
58  }
59 
60  void toStr(std::string& str, UInt8 value)
61  {
62  integerToStr(str, value);
63  }
64 
65  void toStr(std::string& str, Int16 value)
66  {
67  integerToStr(str, value);
68  }
69 
70  void toStr(std::string& str, UInt16 value)
71  {
72  integerToStr(str, value);
73  }
74 
75  void toStr(std::string& str, Int32 value)
76  {
77  integerToStr(str, value);
78  }
79 
80  void toStr(std::string& str, UInt32 value)
81  {
82  integerToStr(str, value);
83  }
84 
85  void toStr(std::string& str, Int64 value)
86  {
87  integerToStr(str, value);
88  }
89 
90  void toStr(std::string& str, UInt64 value)
91  {
92  integerToStr(str, value);
93  }
94 
95  void toStr(std::string& str, const Binary12& value)
96  {
97  str += "'";
98  //containerToStr(str, &value.value[0], &value.value[sizeof(value)], "" "");
99  str += OnixS::Util::HexEncoding::encode(reinterpret_cast<const char*>(&value.value[0]), sizeof(value.value));
100  str += "'";
102 }
103 
#define ONIXS_SGXTITAN_OUCH_ENSURE_TYPE_SIZE(Type, Size)
#define ONIXS_SGXTITAN_OUCH_NAMESPACE_END
Definition: Bootstrap.h:31
ONIXS_SGXTITAN_OUCH_API void toStr(std::string &, OutboundMessageTypes::Enum)
Appends string presentation of object.
boost::enable_if< boost::is_integral< Integer > >::type integerToStr(std::string &str, Integer integer)