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
35namespace mdds { namespace mtv {
36
37constexpr element_t element_type_boolean = element_type_reserved_start;
38constexpr element_t element_type_int8 = element_type_reserved_start + 1;
39constexpr element_t element_type_uint8 = element_type_reserved_start + 2;
40constexpr element_t element_type_int16 = element_type_reserved_start + 3;
41constexpr element_t element_type_uint16 = element_type_reserved_start + 4;
42constexpr element_t element_type_int32 = element_type_reserved_start + 5;
43constexpr element_t element_type_uint32 = element_type_reserved_start + 6;
44constexpr element_t element_type_int64 = element_type_reserved_start + 7;
45constexpr element_t element_type_uint64 = element_type_reserved_start + 8;
46constexpr element_t element_type_float = element_type_reserved_start + 9;
47constexpr element_t element_type_double = element_type_reserved_start + 10;
48constexpr element_t element_type_string = element_type_reserved_start + 11;
49
50using boolean_element_block = default_element_block<element_type_boolean, bool>;
51using int8_element_block = default_element_block<element_type_int8, int8_t>;
52using uint8_element_block = default_element_block<element_type_uint8, uint8_t>;
53using int16_element_block = default_element_block<element_type_int16, int16_t>;
54using uint16_element_block = default_element_block<element_type_uint16, uint16_t>;
55using int32_element_block = default_element_block<element_type_int32, int32_t>;
56using uint32_element_block = default_element_block<element_type_uint32, uint32_t>;
57using int64_element_block = default_element_block<element_type_int64, int64_t>;
58using uint64_element_block = default_element_block<element_type_uint64, uint64_t>;
59using float_element_block = default_element_block<element_type_float, float>;
60using double_element_block = default_element_block<element_type_double, double>;
61using string_element_block = default_element_block<element_type_string, std::string>;
62
63MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(bool, element_type_boolean, false, boolean_element_block)
64MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int8_t, element_type_int8, 0, int8_element_block)
65MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint8_t, element_type_uint8, 0, uint8_element_block)
66MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int16_t, element_type_int16, 0, int16_element_block)
67MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint16_t, element_type_uint16, 0, uint16_element_block)
68MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int32_t, element_type_int32, 0, int32_element_block)
69MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint32_t, element_type_uint32, 0, uint32_element_block)
70MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(int64_t, element_type_int64, 0, int64_element_block)
71MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint64_t, element_type_uint64, 0, uint64_element_block)
72MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(float, element_type_float, 0.0, float_element_block)
73MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(double, element_type_double, 0.0, double_element_block)
74MDDS_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:794
Definition: util.hpp:75
Definition: block_funcs.hpp:65
Definition: standard_element_blocks.hpp:77