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