Metall v0.30
A persistent memory allocator for data-centric analytics
 
Loading...
Searching...
No Matches
equal.hpp
Go to the documentation of this file.
1// Copyright 2021 Lawrence Livermore National Security, LLC and other Metall
2// Project Developers. See the top-level COPYRIGHT file for details.
3//
4// SPDX-License-Identifier: (Apache-2.0 OR MIT)
5
6#ifndef METALL_JSON_EQUAL_HPP
7#define METALL_JSON_EQUAL_HPP
8
10
11namespace metall::json {
12
13namespace {
14namespace bj = boost::json;
15}
16
17template <typename char_type, typename char_traits, typename allocator_type>
18inline bool operator==(
20 const bj::key_value_pair &bj_key_value) {
21 return jsndtl::general_key_value_pair_equal(key_value, bj_key_value);
22}
23
24template <typename char_type, typename char_traits, typename allocator_type>
25inline bool operator==(
26 const bj::key_value_pair &bj_key_value,
28 return key_value == bj_key_value;
29}
30
31template <typename char_type, typename char_traits, typename allocator_type>
32inline bool operator!=(
34 const bj::key_value_pair &bj_key_value) {
35 return !(key_value == bj_key_value);
36}
37
38template <typename char_type, typename char_traits, typename allocator_type>
39inline bool operator!=(
40 const bj::key_value_pair &bj_key_value,
42 return key_value != bj_key_value;
43}
44
45template <typename allocator_type>
47 const bj::value &bj_value) {
48 return jsndtl::general_value_equal(value, bj_value);
49}
50
51template <typename allocator_type>
52inline bool operator==(const bj::value &bj_value,
54 return value == bj_value;
55}
56
57template <typename allocator_type>
59 const bj::value &bj_value) {
60 return !(value == bj_value);
61}
62
63template <typename allocator_type>
64inline bool operator!=(const bj::value &bj_value,
66 return value != bj_value;
67}
68
69template <typename allocator_type>
71 const bj::array &bj_array) {
72 return jsndtl::general_array_equal(array, bj_array);
73}
74
75template <typename allocator_type>
76inline bool operator==(const bj::array &bj_array,
78 return array == bj_array;
79}
80
81template <typename allocator_type>
83 const bj::array &bj_array) {
84 return !(array == bj_array);
85}
86
87template <typename allocator_type>
88inline bool operator!=(const bj::array &bj_array,
90 return array != bj_array;
91}
92
93template <typename allocator_type>
94inline bool operator==(const object<allocator_type> &object,
95 const bj::object &bj_object) {
96 return jsndtl::general_object_equal(object, bj_object);
97}
98
99template <typename allocator_type>
100inline bool operator==(const bj::object &bj_object,
101 const object<allocator_type> &object) {
102 return object == bj_object;
103}
104
105template <typename allocator_type>
106inline bool operator!=(const object<allocator_type> &object,
107 const bj::object &bj_object) {
108 return !(object == bj_object);
109}
110
111template <typename allocator_type>
112inline bool operator!=(const bj::object &bj_object,
113 const object<allocator_type> &object) {
114 return object != bj_object;
115}
116
117template <typename char_t, typename traits, typename allocator>
119 const bj::string &bj_string) {
120 return jsndtl::general_string_equal(string, bj_string);
121}
122
123template <typename char_t, typename traits, typename allocator>
124inline bool operator==(const bj::string &bj_string,
126 return string == bj_string;
127}
128
129template <typename char_t, typename traits, typename allocator>
131 const bj::string &bj_string) {
132 return !(string == bj_string);
133}
134
135template <typename char_t, typename traits, typename allocator>
136inline bool operator!=(const bj::string &bj_string,
138 return string != bj_string;
139}
140} // namespace metall::json
141#endif // METALL_JSON_EQUAL_HPP
JSON array. An array is an ordered collection of values.
Definition array.hpp:43
A class for holding a pair of JSON string (as its key) and JSON value (as its value).
Definition key_value_pair.hpp:47
JSON object. An object is a table key and value pairs. The order of key-value pairs depends on the im...
Definition object.hpp:22
JSON value. A container that holds a single bool, int64, uint64, double, JSON string,...
Definition value.hpp:82
bool general_value_equal(const value< allocator_type > &value, const other_value_type &other_value) noexcept
Provides 'equal' calculation for other value types that have the same interface as the value class.
Definition value.hpp:28
bool general_string_equal(const basic_string< char_t, traits, allocator > &string, const other_string_type &other_string) noexcept
Definition string.hpp:17
bool general_array_equal(const array< allocator_type > &array, const other_array_type &other_array) noexcept
Provides 'equal' calculation for other array types that have the same interface as the array class.
Definition array.hpp:28
bool general_key_value_pair_equal(const key_value_pair< char_type, char_traits, allocator_type > &key_value, const other_key_value_pair_type &other_key_value) noexcept
Provides 'equal' calculation for other key-value types that have the same interface as the object cla...
Definition key_value_pair.hpp:26
Namespace for Metall JSON container, which is in an experimental phase.
Definition array.hpp:17
metall::container::basic_string< char_t, traits, allocator_type > basic_string
JSON basic string type.
Definition json_fwd.hpp:44
bool operator==(const key_value_pair< char_type, char_traits, allocator_type > &key_value, const bj::key_value_pair &bj_key_value)
Definition equal.hpp:18
bool operator!=(const key_value_pair< char_type, char_traits, allocator_type > &key_value, const bj::key_value_pair &bj_key_value)
Definition equal.hpp:32