Horizon
odb_util.hpp
1 #pragma once
2 #include "common/common.hpp"
3 #include "util/placement.hpp"
4 #include <ostream>
5 
6 namespace horizon::ODB {
7 
8 extern const char *endl;
9 extern const char *drills_layer;
10 
11 std::ostream &operator<<(std::ostream &os, const Coordi &c);
12 
13 struct Angle {
14  explicit Angle(int a) : angle((((65536 - a) % 65536) * (360. / 65536.)))
15  {
16  }
17  explicit Angle(const Placement &pl) : Angle(pl.get_angle())
18  {
19  }
20  const double angle;
21 };
22 
23 std::ostream &operator<<(std::ostream &os, Angle a);
24 
25 struct Dim {
26  explicit Dim(int64_t x) : dim(x / 1e6)
27  {
28  }
29  explicit Dim(uint64_t x) : dim(x / 1e6)
30  {
31  }
32  explicit Dim(double x) : dim(x / 1e6)
33  {
34  }
35  const double dim;
36 };
37 
38 std::ostream &operator<<(std::ostream &os, Dim d);
39 
40 struct DimUm {
41  explicit DimUm(int64_t x) : dim(x / 1e3)
42  {
43  }
44  explicit DimUm(uint64_t x) : dim(x / 1e3)
45  {
46  }
47  const double dim;
48 };
49 
50 std::ostream &operator<<(std::ostream &os, DimUm d);
51 
52 std::string utf8_to_ascii(const std::string &s);
53 std::string make_legal_name(const std::string &n);
54 std::string make_legal_entity_name(const std::string &s);
55 std::string get_layer_name(int id);
56 
57 std::string make_symbol_circle(uint64_t diameter);
58 std::string make_symbol_rect(uint64_t w, uint64_t h);
59 std::string make_symbol_oval(uint64_t w, uint64_t h);
60 
61 
62 } // namespace horizon::ODB
Definition: placement.hpp:8
Definition: odb_util.hpp:13
Definition: odb_util.hpp:40
Definition: odb_util.hpp:25