4 namespace horizon::ODB::attribute {
7 std::string make_legal_string_attribute(
const std::string &n);
13 enum class Type { FLOAT, BOOLEAN, TEXT };
17 static constexpr
unsigned int ndigits = n;
18 static constexpr Type type = Type::FLOAT;
23 static constexpr Type type = Type::BOOLEAN;
27 text_attribute(
const std::string &t) : value(detail::make_legal_string_attribute(t))
31 static constexpr Type type = Type::TEXT;
34 #define ATTR_NAME(n) \
35 template <> struct attribute_name<n> { \
36 static constexpr const char *name = "." #n; \
39 #define MAKE_FLOAT_ATTR(n, nd) \
40 using n = float_attribute<struct n##_t, nd>; \
43 #define MAKE_TEXT_ATTR(n) \
44 using n = text_attribute<struct n##_t>; \
47 #define MAKE_BOOLEAN_ATTR(n) \
48 using n = boolean_attribute<struct n##_t>; \
51 template <
typename T>
struct is_feature : std::false_type {
53 template <
typename T>
struct is_net : std::false_type {
55 template <
typename T>
struct is_pkg : std::false_type {
62 #define ATTR_IS_FEATURE(a) \
63 template <> struct is_feature<a> : std::true_type { \
66 #define ATTR_IS_NET(a) \
67 template <> struct is_net<a> : std::true_type { \
70 #define ATTR_IS_PKG(a) \
71 template <> struct is_pkg<a> : std::true_type { \
74 enum class drill { PLATED, NON_PLATED, VIA };
76 ATTR_IS_FEATURE(drill)
78 enum class primary_side { TOP, BOTTOM };
79 ATTR_NAME(primary_side)
81 enum class pad_usage { TOEPRINT, VIA, G_FIDUCIAL, L_FIDUCIAL, TOOLING_HOLE };
83 ATTR_IS_FEATURE(pad_usage)
85 MAKE_FLOAT_ATTR(drc_max_height, 3)
86 ATTR_IS_FEATURE(drc_max_height)
88 MAKE_BOOLEAN_ATTR(smd)
91 MAKE_TEXT_ATTR(electrical_class)
92 ATTR_IS_NET(electrical_class)
94 MAKE_TEXT_ATTR(net_type)
97 MAKE_TEXT_ATTR(diff_pair)
98 ATTR_IS_NET(diff_pair)
100 MAKE_TEXT_ATTR(
string)
101 ATTR_IS_FEATURE(
string)
Definition: attributes.hpp:10
Definition: attributes.hpp:21
Definition: attributes.hpp:15
Definition: attributes.hpp:51
Definition: attributes.hpp:53
Definition: attributes.hpp:55
Definition: attributes.hpp:26