Horizon
rule.hpp
1 #pragma once
2 #include "nlohmann/json_fwd.hpp"
3 #include "rule_match.hpp"
4 #include "util/uuid.hpp"
5 #include "common/lut.hpp"
6 
7 namespace horizon {
8 using json = nlohmann::json;
9 
10 enum class RuleID {
11  NONE,
12  HOLE_SIZE,
13  CLEARANCE_SILKSCREEN_EXPOSED_COPPER,
14  TRACK_WIDTH,
15  CLEARANCE_COPPER,
16  SINGLE_PIN_NET,
17  PARAMETERS,
18  VIA,
19  CLEARANCE_COPPER_OTHER,
20  PLANE,
21  DIFFPAIR,
22  PACKAGE_CHECKS,
23  PREFLIGHT_CHECKS,
24  CLEARANCE_COPPER_KEEPOUT,
25  LAYER_PAIR,
26  CLEARANCE_SAME_NET,
27  SYMBOL_CHECKS,
28  CLEARANCE_PACKAGE,
29 };
30 
31 extern const LutEnumStr<RuleID> rule_id_lut;
32 
33 class Rule {
34  friend class Rules;
35 
36 public:
37  Rule(const UUID &uu);
38  Rule(const json &j);
39  Rule(const UUID &uu, const json &j);
40  UUID uuid;
41  RuleID id = RuleID::NONE;
42  bool enabled = true;
43  int get_order() const
44  {
45  return order;
46  }
47 
48  virtual json serialize() const;
49  virtual std::string get_brief(const class Block *block = nullptr) const = 0;
50  virtual bool is_match_all() const
51  {
52  return false;
53  }
54 
55  virtual ~Rule();
56 
57 protected:
58  Rule();
59 
60 private:
61  int order = -1;
62 };
63 } // namespace horizon
horizon::Rules
Definition: rules.hpp:48
horizon::Rule
Definition: rule.hpp:33
horizon::Block
A block is one level of hierarchy in the netlist.
Definition: block.hpp:25
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:166
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61