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 };
26 
27 extern const LutEnumStr<RuleID> rule_id_lut;
28 
29 class Rule {
30 public:
31  Rule(const UUID &uu);
32  Rule(const json &j);
33  Rule(const UUID &uu, const json &j);
34  UUID uuid;
35  int order = 0;
36  RuleID id = RuleID::NONE;
37  bool enabled = true;
38 
39  virtual json serialize() const;
40  virtual std::string get_brief(const class Block *block = nullptr) const = 0;
41  virtual bool is_match_all() const
42  {
43  return false;
44  }
45 
46  virtual ~Rule();
47 
48 protected:
49  Rule();
50 };
51 } // namespace horizon
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Rule
Definition: rule.hpp:29
horizon::Block
A block is one level of hierarchy in the netlist.
Definition: block.hpp:26
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:165
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16