# Hurricane Documentation

# Hurricane VLSI Database

Segment.h
1 // ****************************************************************************************************
2 // File: ./hurricane/Segment.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_SEGMENT
21 #define HURRICANE_SEGMENT
22
23 #include "hurricane/Component.h"
24 #include "hurricane/Segments.h"
25
26 namespace Hurricane {
27
28
29 // ****************************************************************************************************
30 // Segment declaration
31 // ****************************************************************************************************
32
33 class Segment : public Component {
34 // *****************************
35
36 // Types
37 // *****
38
39 public: typedef Component Inherit;
40
41 public: class SourceHook : public Hook {
42 // ***********************************
43
44 friend class Segment;
45
46 public: typedef Hook Inherit;
47
48 private: SourceHook(Segment* segment);
49
50 public: virtual Component* getComponent() const;
51
52 public: virtual bool isMaster() const {return false;};
53
54 public: virtual string _getTypeName() const { return "Segment::SourceHook"; };
55 public: virtual string _getString() const;
56 public: static Hook* _compToHook(Component*);
57 };
58
59 public: class TargetHook : public Hook {
60 // ***********************************
61
62 friend class Segment;
63
64 public: typedef Hook Inherit;
65
66 private: TargetHook(Segment* segment);
67
68 public: virtual Component* getComponent() const;
69
70 public: virtual bool isMaster() const {return false;};
71
72 public: virtual string _getTypeName() const { return "Segment::TargetHook"; };
73 public: virtual string _getString() const;
74 public: static Hook* _compToHook(Component*);
75 };
76
77 // Attributes
78 // **********
79
80 private: SourceHook _sourceHook;
81 private: TargetHook _targetHook;
82 private: const Layer* _layer;
83 private: DbU::Unit _width;
84
85 // Constructors
86 // ************
87
88 protected: Segment ( Net* net
89 , Component* source
90 , Component* target
91 , const Layer* layer
92 , const DbU::Unit& width = 0
93 );
94
95 // Accessors
96 // *********
97
98 public: virtual Hooks getHooks() const;
99 public: virtual DbU::Unit getX() const {return 0;};
100 public: virtual DbU::Unit getY() const {return 0;};
101 public: virtual const Layer* getLayer() const {return _layer;};
102 public: Hook* getSourceHook() {return &_sourceHook;};
103 public: Hook* getTargetHook() {return &_targetHook;};
104 public: Hook* getOppositeHook(const Hook* hook) const;
105 public: Component* getSource() const;
106 public: Component* getTarget() const;
107 public: Components getAnchors() const;
108 public: Component* getOppositeAnchor(Component* anchor) const;
109 public: const DbU::Unit& getWidth() const {return _width;};
110 public: DbU::Unit getHalfWidth() const {return (_width / 2);};
111 public: virtual DbU::Unit getSourceX() const = 0;
112 public: virtual DbU::Unit getSourceY() const = 0;
113 public: virtual Point getSourcePosition() const;
114 public: virtual DbU::Unit getTargetX() const = 0;
115 public: virtual DbU::Unit getTargetY() const = 0;
116 public: virtual Point getTargetPosition() const;
117 public: virtual DbU::Unit getLength() const = 0;
118
119 // Updators
120 // ********
121
122 public: void setLayer(const Layer* layer);
123 public: void setWidth(const DbU::Unit& width);
124 public: void invert();
125
126 // Others
127 // ******
128
129 protected: virtual void _preDestroy();
130
131 public: virtual void _toJson(JsonWriter*) const;
132 public: virtual string _getString() const;
133 public: virtual Record* _getRecord() const;
134
135 };
136
137
138 // ****************************************************************************************************
139 // JsonSegment declaration
140 // ****************************************************************************************************
141
142 class JsonSegment : public JsonComponent {
143 // ***************************************
144
145 public: JsonSegment(unsigned long flags);
146 };
147
148
149 } // End of Hurricane namespace.
150
151
152 INSPECTOR_P_SUPPORT(Hurricane::Segment);
153 INSPECTOR_P_SUPPORT(Hurricane::Segment::SourceHook);
154 INSPECTOR_P_SUPPORT(Hurricane::Segment::TargetHook);
155
156
157 #endif // HURRICANE_SEGMENT
158
159
160 // ****************************************************************************************************
161 // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
162 // ****************************************************************************************************
Hurricane::Segment::setWidth
void setWidth(const DbU::Unit &width)
Hurricane::Segment::getOppositeHook
Hook * getOppositeHook(const Hook *hook) const
Hurricane::Segment::getHalfWidth
DbU::Unit getHalfWidth() const
Definition: Segment.h:110
Hurricane::Segment::getSourceX
virtual DbU::Unit getSourceX() const =0
Hurricane::Segment::getTargetY
virtual DbU::Unit getTargetY() const =0
Hurricane::Segment::getTarget
Component * getTarget() const
Hurricane::Segment::getSourcePosition
virtual Point getSourcePosition() const
Hurricane::Component
Component description (API)
Definition: Component.h:42
Hurricane::Segment::setLayer
void setLayer(const Layer *layer)
Hurricane::Segment::getSourceHook
Hook * getSourceHook()
Definition: Segment.h:102
Hurricane::Segment::getSource
Component * getSource() const
Hurricane::DbU::Unit
std::int64_t Unit
Definition: DbU.h:70
Hurricane::Segment::invert
void invert()
Hurricane::Segment::TargetHook
Definition: Segment.h:59
Hurricane::Point
Point description (API)
Definition: Point.h:32
Hurricane::GenericCollection
Generic Collection auto-pointer.
Definition: Collection.h:28
Hurricane::Segment::getSourceY
virtual DbU::Unit getSourceY() const =0
Hurricane::Hook
Hook description (API)
Definition: Hook.h:36
Hurricane::Layer
Layer description (API)
Definition: Layer.h:52
Hurricane::Segment
Segment description (API)
Definition: Segment.h:33
Hurricane
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5
Hurricane::Segment::Inherit
Component Inherit
Definition: Segment.h:39
Hurricane::Segment::getWidth
const DbU::Unit & getWidth() const
Definition: Segment.h:109
Hurricane::Segment::getTargetHook
Hook * getTargetHook()
Definition: Segment.h:103
Hurricane::Net
Net description (API)
Definition: Net.h:48
Hurricane::Segment::getOppositeAnchor
Component * getOppositeAnchor(Component *anchor) const
Hurricane::Segment::getLength
virtual DbU::Unit getLength() const =0
Hurricane::Segment::SourceHook
Definition: Segment.h:41
Hurricane::Segment::getTargetPosition
virtual Point getTargetPosition() const
Hurricane::Segment::getTargetX
virtual DbU::Unit getTargetX() const =0
Hurricane::Segment::getAnchors
Components getAnchors() const