Horizon
rule.hpp
1 #pragma once
2 #include "nlohmann/json_fwd.hpp"
3 #include "rule_match.hpp"
4 #include "util/uuid.hpp"
5 
6 namespace horizon {
7 using json = nlohmann::json;
8 
9 enum class RuleID {
10  NONE,
11  HOLE_SIZE,
12  CLEARANCE_SILKSCREEN_EXPOSED_COPPER,
13  TRACK_WIDTH,
14  CLEARANCE_COPPER,
15  SINGLE_PIN_NET,
16  PARAMETERS,
17  VIA,
18  CLEARANCE_COPPER_OTHER,
19  PLANE,
20  DIFFPAIR,
21  PACKAGE_CHECKS,
22  PREFLIGHT_CHECKS,
23  CLEARANCE_COPPER_KEEPOUT
24 };
25 
26 class Rule {
27 public:
28  Rule(const UUID &uu);
29  Rule(const json &j);
30  Rule(const UUID &uu, const json &j);
31  UUID uuid;
32  int order = 0;
33  RuleID id = RuleID::NONE;
34  bool enabled = true;
35 
36  virtual json serialize() const;
37  virtual std::string get_brief(const class Block *block = nullptr) const = 0;
38  virtual bool is_match_all() const
39  {
40  return false;
41  }
42 
43  virtual ~Rule();
44 
45 protected:
46  Rule();
47 };
48 } // namespace horizon
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Rule
Definition: rule.hpp:26
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:161
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16