# Hurricane VLSI Database

Transformation.h
1 // ****************************************************************************************************
2 // File: ./hurricane/Transformation.h
3 // Authors: R. Escassut
4 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
5 //
6 // This file is part of Hurricane.
7 //
8 // Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU
9 // Lesser General Public License as published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
11 //
12 // Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
13 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the Lesser GNU General Public License along with Hurricane. If
17 // not, see <http://www.gnu.org/licenses/>.
18 // ****************************************************************************************************
19
20 #ifndef HURRICANE_TRANSFORMATION
21 #define HURRICANE_TRANSFORMATION
22
23 #include "hurricane/Box.h"
24
25 namespace Hurricane {
26
27
28 // ****************************************************************************************************
29 // Transformation declaration
30 // ****************************************************************************************************
31
32 class Transformation {
33 // *****************
34
35 // Types
36 // *****
37
38 public: class Orientation {
39 // **********************
40
41 public: enum Code {ID=0, R1=1, R2=2, R3=3, MX=4, XR=5, MY=6, YR=7};
42
43 private: Code _code;
44
45 public: Orientation(const Code& code = ID);
46 public: Orientation(const Orientation& orientation);
47 public: Orientation(const string& );
48
49 public: Orientation& operator=(const Orientation& orientation);
50
51 public: operator const Code&() const {return _code;};
52
53 public: const Code& getCode() const {return _code;};
54
55 public: string _getTypeName() const { return _TName("Transformation::Orientation"); };
56 public: string _getString() const;
57 public: Record* _getRecord() const;
58 };
59
60 // Attributes
61 // **********
62
63 private: DbU::Unit _tx;
64 private: DbU::Unit _ty;
65 private: Orientation _orientation;
66
67 // Constructors
68 // ************
69
70 public: Transformation();
71
72 public: Transformation(const DbU::Unit& tx, const DbU::Unit& ty, const Orientation& orientation = Orientation::ID);
73 public: Transformation(const Point& translation, const Orientation& orientation = Orientation::ID);
74
75 public: Transformation(const Transformation& transformation);
76
77 // Operators
78 // *********
79
80 public: Transformation& operator=(const Transformation& transformation);
81
82 public: bool operator==(const Transformation& transformation) const;
83 public: bool operator!=(const Transformation& transformation) const;
84
85 // Accessors
86 // *********
87
88 public: const DbU::Unit& getTx() const {return _tx;};
89 public: const DbU::Unit& getTy() const {return _ty;};
90 public: Point getTranslation() const {return Point(_tx, _ty);};
91 public: const Orientation& getOrientation() const {return _orientation;};
92
93 public: DbU::Unit getX(const DbU::Unit& x, const DbU::Unit& y) const;
94 public: DbU::Unit getY(const DbU::Unit& x, const DbU::Unit& y) const;
95
96 public: DbU::Unit getX(const Point& point) const;
97 public: DbU::Unit getY(const Point& point) const;
98
99 public: DbU::Unit getDx(const DbU::Unit& dx, const DbU::Unit& dy) const;
100 public: DbU::Unit getDy(const DbU::Unit& dx, const DbU::Unit& dy) const;
101
102 public: Point getPoint(const DbU::Unit& x, const DbU::Unit& y) const;
103 public: Point getPoint(const Point& point) const;
104
105 public: Box getBox(const DbU::Unit& x1, const DbU::Unit& y1, const DbU::Unit& x2, const DbU::Unit& y2) const;
106 public: Box getBox(const Point& point1, const Point& point2) const;
107 public: Box getBox(const Box& box) const;
108
109 public: Transformation getTransformation(const Transformation& transformation) const;
110
111 public: Transformation getInvert() const;
112
113 // Predicates
114 // **********
115
116 public: bool isEven() const {return !(_orientation.getCode() & 1);};
117 public: bool isOdd() const {return (_orientation.getCode() & 1);};
118
119 // Updators
120 // ********
121
122 public: Transformation& invert();
123
124 // Manipulators
125 // ************
126
127 public: void applyOn(DbU::Unit& x, DbU::Unit& y) const;
128 public: void applyOn(Point& point) const;
129 public: void applyOn(Box& box) const;
130 public: void applyOn(Transformation& transformation) const;
131
132 // Others
133 // ******
134
135 public: string _getTypeName() const { return _TName("Transformation"); };
136 public: string _getString() const;
137 public: Record* _getRecord() const;
138 public: void toJson(JsonWriter*) const;
139
140 };
141
142 class JsonTransformation : public JsonObject {
143 // *******************************************
144
145 public: static void initialize();
146 public: JsonTransformation(unsigned long);
147 public: virtual string getTypeName() const;
148 public: virtual JsonTransformation* clone(unsigned long) const;
149 public: virtual void toData(JsonStack&);
150 };
151
152
153 } // End of Hurricane namespace.
154
155
156 // -------------------------------------------------------------------
157 // Inspector Support for : "Transformation::Orientation::Code*".
158
159 template<>
160 inline std::string getString<const Hurricane::Transformation::Orientation::Code*>
161 ( const Hurricane::Transformation::Orientation::Code* object )
162 {
163 switch ( *object ) {
164 case Hurricane::Transformation::Orientation::ID: return "ID";
165 case Hurricane::Transformation::Orientation::R1: return "R1";
166 case Hurricane::Transformation::Orientation::R2: return "R2";
167 case Hurricane::Transformation::Orientation::R3: return "R3";
168 case Hurricane::Transformation::Orientation::MX: return "MX";
169 case Hurricane::Transformation::Orientation::XR: return "XR";
170 case Hurricane::Transformation::Orientation::MY: return "MY";
171 case Hurricane::Transformation::Orientation::YR: return "YR";
172 }
173 return "ABNORMAL";
174 }
175
176 template<>
177 inline Hurricane::Record* getRecord<const Hurricane::Transformation::Orientation::Code*>
178 ( const Hurricane::Transformation::Orientation::Code* object )
179 {
180 Hurricane::Record* record = new Hurricane::Record(getString(object));
181 record->add(getSlot("Code", (unsigned int*)object));
182 return record;
183 }
184
185 template<>
186 inline std::string getString<Hurricane::Transformation::Orientation::Code*>
187 ( Hurricane::Transformation::Orientation::Code* object )
188 {
189 switch ( *object ) {
190 case Hurricane::Transformation::Orientation::ID: return "ID";
191 case Hurricane::Transformation::Orientation::R1: return "R1";
192 case Hurricane::Transformation::Orientation::R2: return "R2";
193 case Hurricane::Transformation::Orientation::R3: return "R3";
194 case Hurricane::Transformation::Orientation::MX: return "MX";
195 case Hurricane::Transformation::Orientation::XR: return "XR";
196 case Hurricane::Transformation::Orientation::MY: return "MY";
197 case Hurricane::Transformation::Orientation::YR: return "YR";
198 }
199 return "ABNORMAL";
200 }
201
202 template<>
203 inline Hurricane::Record* getRecord<Hurricane::Transformation::Orientation::Code*>
204 ( Hurricane::Transformation::Orientation::Code* object )
205 {
206 Hurricane::Record* record = new Hurricane::Record(getString(object));
207 record->add(getSlot("Code", (unsigned int*)object));
208 return record;
209 }
210
211
212 INSPECTOR_PR_SUPPORT(Hurricane::Transformation);
213 INSPECTOR_PR_SUPPORT(Hurricane::Transformation::Orientation);
214 IOSTREAM_POINTER_SUPPORT(Hurricane::Transformation::Orientation::Code);
215
216 #endif // HURRICANE_TRANSFORMATION
217
218
219 // ****************************************************************************************************
220 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
221 // ****************************************************************************************************
Hurricane::Transformation::operator=
Transformation & operator=(const Transformation &transformation)
Hurricane::Transformation::operator==
bool operator==(const Transformation &transformation) const
Hurricane::Transformation::Orientation
Definition: Transformation.h:38
Hurricane::Transformation::getPoint
Point getPoint(const DbU::Unit &x, const DbU::Unit &y) const
Hurricane::Transformation::getTy
const DbU::Unit & getTy() const
Definition: Transformation.h:89
Hurricane::Transformation::getY
DbU::Unit getY(const DbU::Unit &x, const DbU::Unit &y) const
Hurricane::Transformation::applyOn
void applyOn(DbU::Unit &x, DbU::Unit &y) const
Hurricane::DbU::Unit
std::int64_t Unit
Definition: DbU.h:70
Hurricane::Transformation::getTransformation
Transformation getTransformation(const Transformation &transformation) const
Hurricane::Point
Point description (API)
Definition: Point.h:32
Hurricane::Transformation::getOrientation
const Orientation & getOrientation() const
Definition: Transformation.h:91
Hurricane::Transformation::getTx
const DbU::Unit & getTx() const
Definition: Transformation.h:88
Hurricane::Transformation
Transformation description (API)
Definition: Transformation.h:32
Hurricane::Transformation::Transformation
Transformation()
Hurricane::Transformation::operator!=
bool operator!=(const Transformation &transformation) const
Hurricane::Transformation::getDx
DbU::Unit getDx(const DbU::Unit &dx, const DbU::Unit &dy) const
Hurricane::Transformation::getX
DbU::Unit getX(const DbU::Unit &x, const DbU::Unit &y) const
Hurricane::Box
Box description (API)
Definition: Box.h:31
Hurricane::Transformation::getDy
DbU::Unit getDy(const DbU::Unit &dx, const DbU::Unit &dy) const
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5
Hurricane::Transformation::getTranslation
Point getTranslation() const
Definition: Transformation.h:90
Hurricane::Transformation::invert
Transformation & invert()
Hurricane::Transformation::getBox
Box getBox(const DbU::Unit &x1, const DbU::Unit &y1, const DbU::Unit &x2, const DbU::Unit &y2) const
Hurricane::Transformation::getInvert
Transformation getInvert() const

Generated by doxygen 1.8.14 on Tue Jul 21 2020 | Return to top of page

Hurricane VLSI Database | Copyright © 2000-2016 Bull S.A. All rights reserved