Horizon
line_net.hpp
1 #pragma once
2 #include "util/uuid.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 #include "common/common.hpp"
5 #include "util/uuid_ptr.hpp"
6 #include "util/uuid_path.hpp"
7 #include <vector>
8 #include <map>
9 
10 namespace horizon {
11 using json = nlohmann::json;
12 
17 class LineNet {
18 public:
19  enum class End { TO, FROM };
20 
21  LineNet(const UUID &uu, const json &j, class Sheet *sheet = nullptr);
22  LineNet(const UUID &uu);
23 
24  void update_refs(class Sheet &sheet);
25  bool is_connected_to(const UUID &uu_sym, const UUID &uu_pin) const;
26  UUID get_uuid() const;
27  bool coord_on_line(const Coordi &coord) const;
28 
29  uuid_ptr<class Net> net = nullptr;
30  uuid_ptr<class Bus> bus = nullptr;
31  UUID net_segment = UUID();
32 
33 
34  UUID uuid;
35 
36  class Connection {
37  public:
38  Connection()
39  {
40  }
41  Connection(const json &j, Sheet *sheet);
42  uuid_ptr<class SchematicJunction> junc = nullptr;
43  uuid_ptr<class SchematicSymbol> symbol = nullptr;
44  uuid_ptr<class SymbolPin> pin = nullptr;
45  uuid_ptr<class BusRipper> bus_ripper = nullptr;
46  bool operator<(const Connection &other) const;
47  bool operator==(const Connection &other) const;
48 
49  void connect(SchematicJunction *j);
50  void connect(BusRipper *r);
51  void connect(SchematicSymbol *j, SymbolPin *pin);
52  UUIDPath<2> get_pin_path() const;
53  bool is_junc() const;
54  bool is_pin() const;
55  bool is_bus_ripper() const;
56  UUID get_net_segment() const;
57  void update_refs(class Sheet &sheet);
58  Coordi get_position() const;
59  json serialize() const;
60  };
61 
62  Connection from;
63  Connection to;
64 
65 
66  json serialize() const;
67 };
68 } // namespace horizon
Make a Bus member's Net available on the schematic.
Definition: bus_ripper.hpp:19
Definition: line_net.hpp:36
LineNet is similar to Line, except it denotes electrical connection.
Definition: line_net.hpp:17
Definition: schematic_junction.hpp:6
Definition: schematic_symbol.hpp:17
Definition: sheet.hpp:39
Definition: symbol.hpp:19
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: uuid_ptr.hpp:8
a class to store JSON values
Definition: json.hpp:166
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61