OnixS C++ B3 Binary UMDF Market Data Handler 1.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
Decimal.Operations.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
24
27
29
31template
32<
33 class Mantissa,
34 class Exponent
35>
36inline
38std::string
40 const
42 <
43 Mantissa,
44 Exponent
45 >& number)
46{
47 std::string str;
48
49 toStr(str, number);
50
51 return str;
52}
53
55template
56 <
57 class Mantissa,
58 class Exponent
59 >
60inline
61std::ostream&
63 std::ostream& stream,
64 const
66 <Mantissa, Exponent>& value)
67{
68 std::string str;
69
70 toStr(str, value);
71
72 return stream << str;
73}
74
76template
77<
78 class Mantissa,
79 class Exponent
80>
83bool
84operator ==(
85 const
87 <Mantissa, Exponent>& left,
88 const
90 <Mantissa, Exponent>& right)
91{
92 if(isNull(left) && isNull(right))
93 return true;
94
95 return left.mantissa() == right.mantissa();
96}
97
99template
100<
101 class Mantissa,
102 class Exponent
103>
106bool
107operator !=(
108 const
110 <Mantissa, Exponent>& left,
111 const
113 <Mantissa, Exponent>& right)
114{
115 return !(left == right);
116}
117
119template
120<
121 class Mantissa,
122 class Exponent
123>
126bool
127operator <(
128 const
130 <Mantissa, Exponent>& left,
131 const
133 <Mantissa, Exponent>& right)
134{
135 checkAgsValid(left, right);
136
137 return left.mantissa() < right.mantissa();
138}
139
141template
142<
143 class Mantissa,
144 class Exponent
145>
148bool
149operator >(
150 const
152 <Mantissa, Exponent>& left,
153 const
155 <Mantissa, Exponent>& right)
156{
157 checkAgsValid(left, right);
158
159 return left.mantissa() > right.mantissa();
160}
161
163template
164<
165 class Mantissa,
166 class Exponent
167>
170bool
171operator <=(
172 const
174 <Mantissa, Exponent>& left,
175 const
177 <Mantissa, Exponent>& right)
178{
179 checkAgsValid(left, right);
180
181 return left.mantissa() <= right.mantissa();
182}
183
185template
186<
187 class Mantissa,
188 class Exponent
189>
192bool
193operator >=(
194 const
196 <Mantissa, Exponent>& left,
197 const
199 <Mantissa, Exponent>& right)
200{
201 checkAgsValid(left, right);
202
203 return left.mantissa() >= right.mantissa();
204}
205
#define ONIXS_B3_UMDF_MD_MESSAGING_NAMESPACE_END
Definition ABI.h:158
#define ONIXS_B3_UMDF_MD_MESSAGING_NAMESPACE_BEGIN
Definition ABI.h:153
#define ONIXS_B3_UMDF_MD_NODISCARD
Definition Compiler.h:131
#define ONIXS_B3_UMDF_MD_PURE
Definition Compiler.h:134
bool isNull(const PriceOptional &value) noexcept
Definition Composites.h:221
void toStr(std::string &str, Char character)
Appends the character to the given std::string instance.
Definition String.h:34
std::ostream & operator<<(std::ostream &stream, const StrRef &text)
StrRef serialization operator.
Definition StrRef.h:317