Horizon
entity.hpp
1 #pragma once
2 #include "gate.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 #include "unit.hpp"
5 #include "util/uuid.hpp"
6 #include <fstream>
7 #include <map>
8 #include <vector>
9 
10 namespace horizon {
11 using json = nlohmann::json;
12 
13 class Entity : public UUIDProvider {
14 private:
15  Entity(const UUID &uu, const json &, class Pool &pool);
16 
17 public:
18  Entity(const UUID &uu);
19 
20  static Entity new_from_file(const std::string &filename, Pool &pool);
21  UUID uuid;
22  std::string name;
23  std::string manufacturer;
24  std::string prefix;
25  std::set<std::string> tags;
26  std::map<UUID, Gate> gates;
27  json serialize() const;
28  void update_refs(Pool &pool);
29  UUID get_uuid() const;
30 };
31 } // namespace horizon
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Entity
Definition: entity.hpp:13
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
horizon::Pool
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:21
horizon::UUIDProvider
Interface for objects that have a UUID.
Definition: uuid_provider.hpp:9