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(DbU::Unit x) {_x = x;};
75  public: void setY(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 // ****************************************************************************************************
std::int64_t Unit
Definition: DbU.h:67
Point description (API)
Definition: Point.h:32
void setY(DbU::Unit y)
Definition: Point.h:75
bool operator==(const Point &point) const
Point & translate(const DbU::Unit &dx, const DbU::Unit &dy)
Point(const DbU::Unit &x, const DbU::Unit &y)
Point(const Point &point)
bool operator!=(const Point &point) const
void setX(DbU::Unit x)
Definition: Point.h:74
Point & operator=(const Point &point)
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5


Generated by doxygen 1.9.1 on Thu Aug 11 2022 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved