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


Generated by doxygen 1.9.1 on Sun Dec 14 2025 Return to top of page
Hurricane VLSI Database Copyright © 2000-2020 Bull S.A. All rights reserved