Horizon
board_package.hpp
1 #pragma once
2 #include "block/component.hpp"
3 #include "nlohmann/json_fwd.hpp"
4 #include "pool/package.hpp"
5 #include "util/placement.hpp"
6 #include "util/uuid.hpp"
7 #include "util/uuid_ptr.hpp"
8 #include <vector>
9 
10 namespace horizon {
11 using json = nlohmann::json;
12 
13 class BoardPackage {
14 public:
15  BoardPackage(const UUID &uu, const json &, Block &block, class IPool &pool);
16  BoardPackage(const UUID &uu, Component *comp);
17  BoardPackage(const UUID &uu);
18  BoardPackage(shallow_copy_t sh, const BoardPackage &other);
19  UUID uuid;
20  uuid_ptr<Component> component;
21  const Package *alternate_package = nullptr;
22  UUID model;
23 
24  const Package *pool_package;
25  Package package;
26  bool update_package(const class Board &brd);
27  void update_texts(const class Board &brd);
28  void update_nets();
29  void update(const class Board &brd);
30  std::set<UUID> get_nets() const;
31 
32  Placement placement;
33  std::pair<Coordi, Coordi> get_bbox() const;
34 
35  bool flip = false;
36  bool smashed = false;
37  bool omit_silkscreen = false;
38  bool fixed = false;
39  bool omit_outline = false;
40  std::vector<uuid_ptr<Text>> texts;
41 
42  std::string replace_text(const std::string &t, bool *replaced = nullptr) const;
43 
44  UUID get_uuid() const;
45  json serialize() const;
46  static std::vector<UUID> peek_texts(const json &j);
47 };
48 } // namespace horizon
A block is one level of hierarchy in the netlist.
Definition: block.hpp:29
Definition: board_package.hpp:13
Definition: board.hpp:47
A Component is an instanced Entity in a Block.
Definition: component.hpp:40
Definition: ipool.hpp:14
Definition: package.hpp:29
Definition: placement.hpp:8
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:177
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62
Definition: common.hpp:328