Hazelcast C++ Client
Hazelcast C++ Client Library
big_decimal.h
1 /*
2  * Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <vector>
19 #include <boost/multiprecision/cpp_int.hpp>
20 #include "hazelcast/util/export.h"
21 
22 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
23 #pragma warning(push)
24 #pragma warning(disable : 4251) // for dll export
25 #endif
26 
27 namespace hazelcast {
28 namespace client {
43 struct HAZELCAST_API big_decimal
44 {
45  boost::multiprecision::cpp_int unscaled;
46  int32_t scale;
47 };
48 
49 bool HAZELCAST_API
50 operator==(const big_decimal& lhs, const big_decimal& rhs);
51 
52 bool HAZELCAST_API
53 operator<(const big_decimal& lhs, const big_decimal& rhs);
54 } // namespace client
55 } // namespace hazelcast
56 namespace std {
57 template<>
58 struct HAZELCAST_API hash<hazelcast::client::big_decimal>
59 {
60  std::size_t operator()(const hazelcast::client::big_decimal& f) const;
61 };
62 } // namespace std
63 namespace hazelcast {
64 namespace client {
65 namespace pimpl {
66 
73 void HAZELCAST_API
74 twos_complement(std::vector<int8_t>& a);
75 
86 boost::multiprecision::cpp_int HAZELCAST_API
87 from_bytes(std::vector<int8_t> v);
100 std::vector<int8_t> HAZELCAST_API
101 to_bytes(const boost::multiprecision::cpp_int& i);
102 } // namespace pimpl
103 } // namespace client
104 } // namespace hazelcast
105 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
106 #pragma warning(pop)
107 #endif
An arbitrary precision and scale floating point number.
Definition: big_decimal.h:44