mdds
standard_element_blocks.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * Copyright (c) 2022 Kohei Yoshida
5  *
6  * Permission is hereby granted, free of charge, to any person
7  * obtaining a copy of this software and associated documentation
8  * files (the "Software"), to deal in the Software without
9  * restriction, including without limitation the rights to use,
10  * copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following
13  * conditions:
14  *
15  * The above copyright notice and this permission notice shall be
16  * included in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  ************************************************************************/
28 #pragma once
29 
30 #include "types.hpp"
31 #include "util.hpp"
32 #include "block_funcs.hpp"
33 #include "macro.hpp"
34 
35 namespace mdds { namespace mtv {
36 
37 constexpr element_t element_type_boolean = element_type_reserved_start;
38 constexpr element_t element_type_int8 = element_type_reserved_start + 1;
39 constexpr element_t element_type_uint8 = element_type_reserved_start + 2;
40 constexpr element_t element_type_int16 = element_type_reserved_start + 3;
41 constexpr element_t element_type_uint16 = element_type_reserved_start + 4;
42 constexpr element_t element_type_int32 = element_type_reserved_start + 5;
43 constexpr element_t element_type_uint32 = element_type_reserved_start + 6;
44 constexpr element_t element_type_int64 = element_type_reserved_start + 7;
45 constexpr element_t element_type_uint64 = element_type_reserved_start + 8;
46 constexpr element_t element_type_float = element_type_reserved_start + 9;
47 constexpr element_t element_type_double = element_type_reserved_start + 10;
48 constexpr element_t element_type_string = element_type_reserved_start + 11;
49 
50 using boolean_element_block = default_element_block<element_type_boolean, bool>;
51 using int8_element_block = default_element_block<element_type_int8, int8_t>;
52 using uint8_element_block = default_element_block<element_type_uint8, uint8_t>;
53 using int16_element_block = default_element_block<element_type_int16, int16_t>;
54 using uint16_element_block = default_element_block<element_type_uint16, uint16_t>;
55 using int32_element_block = default_element_block<element_type_int32, int32_t>;
56 using uint32_element_block = default_element_block<element_type_uint32, uint32_t>;
57 using int64_element_block = default_element_block<element_type_int64, int64_t>;
58 using uint64_element_block = default_element_block<element_type_uint64, uint64_t>;
59 using float_element_block = default_element_block<element_type_float, float>;
60 using double_element_block = default_element_block<element_type_double, double>;
61 using string_element_block = default_element_block<element_type_string, std::string>;
62 
63 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(bool, element_type_boolean, false, boolean_element_block)
64 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int8_t, element_type_int8, 0, int8_element_block)
65 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint8_t, element_type_uint8, 0, uint8_element_block)
66 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int16_t, element_type_int16, 0, int16_element_block)
67 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint16_t, element_type_uint16, 0, uint16_element_block)
68 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int32_t, element_type_int32, 0, int32_element_block)
69 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint32_t, element_type_uint32, 0, uint32_element_block)
70 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int64_t, element_type_int64, 0, int64_element_block)
71 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint64_t, element_type_uint64, 0, uint64_element_block)
72 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(float, element_type_float, 0.0, float_element_block)
73 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(double, element_type_double, 0.0, double_element_block)
74 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(std::string, element_type_string, std::string(), string_element_block)
75 
77 {
82 };
83 
84 }} // namespace mdds::mtv
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: types.hpp:830
Definition: util.hpp:74
Definition: flat_segment_tree.hpp:46
Definition: block_funcs.hpp:64
Definition: standard_element_blocks.hpp:76