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 // ****************************************************************************************************
Component description (API)
Definition: Component.h:42
std::int64_t Unit
Definition: DbU.h:67
Generic Collection auto-pointer.
Definition: Collection.h:235
Hook description (API)
Definition: Hook.h:34
Layer description (API)
Definition: Layer.h:52
Net description (API)
Definition: Net.h:48
Point description (API)
Definition: Point.h:32
Definition: Segment.h:41
Definition: Segment.h:59
Segment description (API)
Definition: Segment.h:33
virtual DbU::Unit getSourceX() const =0
Hook * getTargetHook()
Definition: Segment.h:103
Component * getTarget() const
virtual DbU::Unit getTargetY() const =0
Component Inherit
Definition: Segment.h:39
const DbU::Unit & getWidth() const
Definition: Segment.h:109
virtual Point getSourcePosition() const
DbU::Unit getHalfWidth() const
Definition: Segment.h:110
virtual DbU::Unit getLength() const =0
Component * getOppositeAnchor(Component *anchor) const
Hook * getSourceHook()
Definition: Segment.h:102
Component * getSource() const
virtual DbU::Unit getTargetX() const =0
virtual DbU::Unit getSourceY() const =0
Components getAnchors() const
void setLayer(const Layer *layer)
void setWidth(const DbU::Unit &width)
virtual Point getTargetPosition() const
Hook * getOppositeHook(const Hook *hook) const
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