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


Generated by doxygen 1.13.2 on Fri Sep 27 2024 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved