4namespace horizon::ODB::attribute {
7std::string make_legal_string_attribute(
const std::string &n);
12enum class Type { FLOAT, BOOLEAN, TEXT };
16 static constexpr unsigned int ndigits = n;
17 static constexpr Type type = Type::FLOAT;
22 static constexpr Type type = Type::BOOLEAN;
26 text_attribute(
const std::string &t) : value(detail::make_legal_string_attribute(t))
30 static constexpr Type type = Type::TEXT;
34 template <> struct attribute_name<n> { \
35 static constexpr const char *name = "." #n; \
38#define MAKE_FLOAT_ATTR(n, nd) \
39 using n = float_attribute<struct n##_t, nd>; \
42#define MAKE_TEXT_ATTR(n) \
43 using n = text_attribute<struct n##_t>; \
46#define MAKE_BOOLEAN_ATTR(n) \
47 using n = boolean_attribute<struct n##_t>; \
50template <
typename T>
struct is_feature : std::false_type {};
51template <
typename T>
struct is_net : std::false_type {};
52template <
typename T>
struct is_pkg : std::false_type {};
58#define ATTR_IS_FEATURE(a) \
59 template <> struct is_feature<a> : std::true_type {};
61#define ATTR_IS_NET(a) \
62 template <> struct is_net<a> : std::true_type {};
64#define ATTR_IS_PKG(a) \
65 template <> struct is_pkg<a> : std::true_type {};
67enum class drill { PLATED, NON_PLATED, VIA };
71enum class primary_side { TOP, BOTTOM };
72ATTR_NAME(primary_side)
74enum class pad_usage { TOEPRINT, VIA, G_FIDUCIAL, L_FIDUCIAL, TOOLING_HOLE };
76ATTR_IS_FEATURE(pad_usage)
78MAKE_FLOAT_ATTR(drc_max_height, 3)
79ATTR_IS_FEATURE(drc_max_height)
84MAKE_TEXT_ATTR(electrical_class)
85ATTR_IS_NET(electrical_class)
87MAKE_TEXT_ATTR(net_type)
90MAKE_TEXT_ATTR(diff_pair)
94ATTR_IS_FEATURE(
string)
Definition attributes.hpp:10
Definition attributes.hpp:20
Definition attributes.hpp:14
Definition attributes.hpp:50
Definition attributes.hpp:51
Definition attributes.hpp:52
Definition attributes.hpp:25