# Hurricane Documentation

# Hurricane VLSI Database

Point.h
1 // ****************************************************************************************************
2 // File: ./hurricane/Point.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_POINT
21 #define HURRICANE_POINT
22
23 #include "hurricane/DbU.h"
24
25 namespace Hurricane {
26
27
28 // ****************************************************************************************************
29 // Point declaration
30 // ****************************************************************************************************
31
32 class Point {
33 // ********
34
35 // Attributes
36 // **********
37
38 private: DbU::Unit _x;
39 private: DbU::Unit _y;
40
41 // Constructors
42 // ************
43
44 public: Point();
45
46 public: Point(const DbU::Unit& x, const DbU::Unit& y);
47
48 public: Point(const Point& point);
49
50 // Operators
51 // *********
52
53 public: Point& operator=(const Point& point);
54
55 public: bool operator==(const Point& point) const;
56 public: bool operator!=(const Point& point) const;
57
58 public: Point operator+(const Point& point) const;
59 public: Point operator-(const Point& point) const;
60 public: Point& operator+=(const Point& point);
61 public: Point& operator-=(const Point& point);
62
63 // Accessors
64 // *********
65
66 public: const DbU::Unit& getX() const {return _x;};
67 public: const DbU::Unit& getY() const {return _y;};
68 public: DbU::Unit manhattanDistance(const Point pt) const
69 { return abs(_x - pt.getX()) + abs(_y - pt.getY()); }
70
71 // Updators
72 // ********
73
74 public: void setX(const DbU::Unit& x) {_x = x;};
75 public: void setY(const DbU::Unit& y) {_y = y;};
76 public: Point& translate(const DbU::Unit& dx, const DbU::Unit& dy);
77 public: Point getTranslated(const DbU::Unit& dx, const DbU::Unit& dy) const;
78
79 // Others
80 // ******
81
82 public: string _getTypeName() const { return _TName("Point"); };
83 public: string _getString() const;
84 public: Record* _getRecord() const;
85 public: void toJson(JsonWriter*) const;
86
87 };
88
89
90 class JsonPoint : public JsonObject {
91 // **********************************
92
93 public: static void initialize();
94 public: JsonPoint(unsigned long);
95 public: virtual string getTypeName() const;
96 public: virtual JsonPoint* clone(unsigned long) const;
97 public: virtual void toData(JsonStack&);
98 };
99
100
101 } // End of Hurricane namespace.
102
103 INSPECTOR_PR_SUPPORT(Hurricane::Point);
104
105
106 #endif // HURRICANE_POINT
107
108
109 // ****************************************************************************************************
110 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
111 // ****************************************************************************************************
Hurricane::Point::translate
Point & translate(const DbU::Unit &dx, const DbU::Unit &dy)
Hurricane::Point::operator==
bool operator==(const Point &point) const
Hurricane::Point::operator=
Point & operator=(const Point &point)
Hurricane::DbU::Unit
std::int64_t Unit
Definition: DbU.h:70
Hurricane::Point
Point description (API)
Definition: Point.h:32
Hurricane::Point::Point
Point()
Hurricane::Point::operator!=
bool operator!=(const Point &point) const
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5
Hurricane::Point::setY
void setY(const DbU::Unit &y)
Definition: Point.h:75
Hurricane::Point::setX
void setX(const DbU::Unit &x)
Definition: Point.h:74