Horizon
bus.hpp
1 #pragma once
2 #include "nlohmann/json_fwd.hpp"
3 #include "net.hpp"
4 #include "pool/unit.hpp"
5 #include "util/uuid.hpp"
6 #include "util/uuid_provider.hpp"
7 #include "util/uuid_ptr.hpp"
8 #include <deque>
9 #include <fstream>
10 #include <map>
11 
12 namespace horizon {
13 using json = nlohmann::json;
14 
21 class Bus : public UUIDProvider {
22 public:
23  class Member : public UUIDProvider {
24  public:
25  Member(const UUID &uu, const json &, class Block &block);
26  Member(const UUID &uu);
27  UUID uuid;
28  std::string name;
29  uuid_ptr<Net> net = nullptr;
30  json serialize() const;
31  virtual UUID get_uuid() const;
32  };
33 
34  Bus(const UUID &uu, const json &, class Block &block);
35  Bus(const UUID &uu);
36  virtual UUID get_uuid() const;
37  UUID uuid;
38  std::string name;
39  std::map<UUID, Member> members;
40  bool is_referenced = false;
41  void update_refs(Block &block);
42  json serialize() const;
43 };
44 } // namespace horizon
horizon::uuid_ptr
Definition: uuid_ptr.hpp:9
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Block
A block is one level of hierarchy in the netlist.
Definition: block.hpp:26
horizon::Bus::Member
Definition: bus.hpp:23
horizon::Bus
A Bus is used for grouping nets.
Definition: bus.hpp:21
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
horizon::UUIDProvider
Interface for objects that have a UUID.
Definition: uuid_provider.hpp:9