asrt
Automated System Runtime Testing library
Loading...
Searching...
No Matches
flat_type_traits.hpp
1
11#pragma once
12
13#include "../asrtl/flat_tree.h"
14
15#include <cstdint>
16
17namespace asrt
18{
19
20using flat_id = asrt_flat_id;
21
23struct obj
24{
25};
27struct arr
28{
29};
30
37template < typename T >
39
40template <>
41struct flat_type_traits< uint32_t >
42{
43 using raw_type = uint32_t;
44 using value_type = uint32_t;
45 static constexpr auto flat_type = ASRT_FLAT_STYPE_U32;
46 static constexpr bool is_scalar = true;
47};
48
49template <>
50struct flat_type_traits< int32_t >
51{
52 using raw_type = int32_t;
53 using value_type = int32_t;
54 static constexpr auto flat_type = ASRT_FLAT_STYPE_I32;
55 static constexpr bool is_scalar = true;
56};
57
58template <>
59struct flat_type_traits< float >
60{
61 using raw_type = float;
62 using value_type = float;
63 static constexpr auto flat_type = ASRT_FLAT_STYPE_FLOAT;
64 static constexpr bool is_scalar = true;
65};
66
67template <>
68struct flat_type_traits< char const* >
69{
70 using raw_type = char const*;
71 using value_type = char const*;
72 static constexpr auto flat_type = ASRT_FLAT_STYPE_STR;
73 static constexpr bool is_scalar = true;
74};
75
76template <>
77struct flat_type_traits< bool >
78{
79 using raw_type = uint32_t;
80 using value_type = bool;
81 static constexpr auto flat_type = ASRT_FLAT_STYPE_BOOL;
82 static constexpr bool is_scalar = true;
83};
84
85template <>
87{
90 static constexpr auto flat_type = ASRT_FLAT_CTYPE_OBJECT;
91 static constexpr bool is_scalar = false;
92};
93
94template <>
96{
99 static constexpr auto flat_type = ASRT_FLAT_CTYPE_ARRAY;
100 static constexpr bool is_scalar = false;
101};
102
103} // namespace asrt
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee ...
Definition: callback.hpp:17
Tag type representing a flat-tree ARRAY container node.
Definition: flat_type_traits.hpp:28
Trait mapping a C++ type to its flat_tree metadata.
Definition: flat_type_traits.hpp:38
Tag type representing a flat-tree OBJECT container node.
Definition: flat_type_traits.hpp:24
Definition: flat_tree.h:69