4namespace horizon::ODB::attribute {
7std::string make_legal_string_attribute(
const std::string &n);
13enum 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;
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>; \
51template <
typename T>
struct is_feature : std::false_type {
53template <
typename T>
struct is_net : std::false_type {
55template <
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 { \
74enum class drill { PLATED, NON_PLATED, VIA };
78enum class primary_side { TOP, BOTTOM };
79ATTR_NAME(primary_side)
81enum class pad_usage { TOEPRINT, VIA, G_FIDUCIAL, L_FIDUCIAL, TOOLING_HOLE };
83ATTR_IS_FEATURE(pad_usage)
85MAKE_FLOAT_ATTR(drc_max_height, 3)
86ATTR_IS_FEATURE(drc_max_height)
91MAKE_TEXT_ATTR(electrical_class)
92ATTR_IS_NET(electrical_class)
94MAKE_TEXT_ATTR(net_type)
97MAKE_TEXT_ATTR(diff_pair)
100MAKE_TEXT_ATTR(
string)
101ATTR_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