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