Katabatic - Routing Toolbox


AutoSegments.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC/LIP6 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | K a t a b a t i c - Routing Toolbox |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./katabatic/AutoSegments.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #ifndef KATABATIC_AUTOSEGMENTS_H
18 #define KATABATIC_AUTOSEGMENTS_H
19 
20 #include <string>
21 #include <list>
22 #include <vector>
23 #include <map>
24 #include "hurricane/Collection.h"
25 #include "hurricane/DbU.h"
26 #include "hurricane/Box.h"
27 
28 namespace Hurricane {
29  class Hook;
30  class Component;
31  class Contact;
32  class Segment;
33  class Net;
34 }
35 
36 
37 namespace Katabatic {
38 
39 
40  using std::string;
41  using std::pair;
42  using std::list;
43  using std::vector;
44  using std::map;
45 
46  using Hurricane::Record;
47  using Hurricane::DbU;
48  using Hurricane::Box;
49  using Hurricane::Hook;
51  using Hurricane::Contact;
52  using Hurricane::Segment;
53  using Hurricane::Net;
54  using Hurricane::Filter;
55  using Hurricane::Locator;
60 
61  class LocatorHelper;
62  class AutoContact;
63  class AutoSegment;
64  class GCell;
65 
66 
67 // -------------------------------------------------------------------
68 // Collections.
69 
76  typedef map<Segment*,AutoSegment*> AutoSegmentLut;
77 
78 
79 // -------------------------------------------------------------------
80 // Class : "Katabatic::AutoSegmentStack".
81 
82  class AutoSegmentStack : protected list<pair<AutoContact*,AutoSegment*> > {
83  public:
84  inline bool isEmpty () const;
85  inline size_t getSize () const;
86  void push ( AutoContact*, AutoSegment* );
87  inline void pop ();
88  inline AutoContact* getAutoContact () const;
89  inline AutoSegment* getAutoSegment () const;
90  };
91 
92 
93  inline bool AutoSegmentStack::isEmpty () const { return empty(); };
94  inline size_t AutoSegmentStack::getSize () const { return size(); };
95  inline void AutoSegmentStack::pop () { if ( !empty() ) pop_back(); };
96  inline AutoContact* AutoSegmentStack::getAutoContact () const { return empty() ? NULL : back().first; };
97  inline AutoSegment* AutoSegmentStack::getAutoSegment () const { return empty() ? NULL : back().second; };
98 
99 
100 // -------------------------------------------------------------------
101 // Class : "Katabatic::AutoSegments_OnContact".
102 
104 
105  public:
106  // Sub-Class: Locator.
107  class Locator : public AutoSegmentHL {
108  public:
109  Locator ( AutoSegment* master, Contact* contact );
110  inline Locator ( const Locator& );
111  virtual AutoSegment* getElement () const;
112  virtual AutoSegmentHL* getClone () const;
113  virtual bool isValid () const;
114  virtual void progress ();
115  virtual string _getString () const;
116  protected:
117  AutoSegment* _master;
118  Hook* _hook;
119  AutoSegment* _element;
120  };
121 
122  public:
123  // AutoSegments_OnContact Methods.
124  inline AutoSegments_OnContact ( AutoSegment* master, Contact* contact );
126  virtual AutoSegmentHC* getClone () const;
127  virtual AutoSegmentHL* getLocator () const;
128  virtual string _getString () const;
129 
130  protected:
131  // AutoSegments_OnContact Attributes.
132  AutoSegment* _master;
133  Contact* _contact;
134  };
135 
136 
137  inline AutoSegments_OnContact::Locator::Locator ( const Locator &locator )
138  : AutoSegmentHL()
139  , _master(locator._master)
140  , _hook(locator._hook)
141  , _element(locator._element)
142  { }
143 
144 
146  : AutoSegmentHC()
147  , _master(master)
148  , _contact(contact)
149  { }
150 
151 
153  : AutoSegmentHC()
154  , _master(segments._master)
155  , _contact(segments._contact)
156  { }
157 
158 
159 // -------------------------------------------------------------------
160 // Class : "AutoSegments_Aligneds".
161 
163 
164  public:
165  // Sub-Class: Locator.
166  class Locator : public AutoSegmentHL {
167  public:
168  inline Locator ( AutoSegment* segment , unsigned int flags );
169  inline Locator ( const Locator &locator );
170  virtual AutoSegment* getElement () const;
171  virtual AutoSegmentHL* getClone () const;
172  virtual bool isValid () const;
173  virtual void progress ();
174  virtual string _getString () const;
175  protected:
176  unsigned int _flags;
177  AutoSegment* _master;
178  AutoSegmentStack _stack;
179  };
180 
181  public:
182  // AutoSegments_Aligneds Methods.
183  AutoSegments_Aligneds ( AutoSegment*, unsigned int flags=KbNoFlags );
185  virtual AutoSegmentHC* getClone () const;
186  virtual AutoSegmentHL* getLocator () const;
187  virtual string _getString () const;
188 
189  protected:
190  // AutoSegments_Aligneds Attributes.
191  unsigned int _flags;
192  AutoSegment* _segment;
193  };
194 
195 
196  inline AutoSegments_Aligneds::Locator::Locator ( const Locator &locator )
197  : AutoSegmentHL()
198  , _flags (locator._flags)
199  , _master(locator._master)
200  , _stack (locator._stack)
201  { }
202 
203 
204  inline AutoSegments_Aligneds::AutoSegments_Aligneds ( AutoSegment* segment, unsigned int flags )
205  : AutoSegmentHC()
206  , _flags (flags)
207  , _segment(segment)
208  { }
209 
210 
212  : AutoSegmentHC()
213  , _flags (autosegments._flags)
214  , _segment(autosegments._segment)
215  { }
216 
217 
218 // -------------------------------------------------------------------
219 // Class : "AutoSegments_Perpandiculars".
220 
222 
223  public:
224  // Sub-Class: Locator.
225  class Locator : public AutoSegmentHL {
226  public:
227  Locator ( AutoSegment* master );
228  inline Locator ( const Locator& );
229  virtual AutoSegment* getElement () const;
230  virtual AutoSegmentHL* getClone () const;
231  virtual bool isValid () const;
232  virtual void progress ();
233  virtual string _getString () const;
234  protected:
235  unsigned int _flags;
236  AutoSegment* _master;
237  AutoSegmentStack _stack;
238  vector<AutoSegment*> _perpandiculars;
239  };
240 
241  public:
242  // AutoSegments_Perpandiculars Methods.
243  inline AutoSegments_Perpandiculars ( AutoSegment* master );
245  virtual AutoSegmentHC* getClone () const;
246  virtual AutoSegmentHL* getLocator () const;
247  virtual string _getString () const;
248 
249  protected:
250  // AutoSegments_Perpandiculars Attributes.
251  AutoSegment* _segment;
252  };
253 
254 
255  inline AutoSegments_Perpandiculars::Locator::Locator ( const Locator& locator )
256  : AutoSegmentHL()
257  , _flags (locator._flags)
258  , _master (locator._master)
259  , _stack (locator._stack)
260  , _perpandiculars()
261  { }
262 
263 
265  ( AutoSegment* segment )
266  : AutoSegmentHC()
267  , _segment(segment)
268  { }
269 
270 
272  ( const AutoSegments_Perpandiculars& autosegments )
273  : AutoSegmentHC()
274  , _segment(autosegments._segment)
275  { }
276 
277 
278 // -------------------------------------------------------------------
279 // Class : "AutoSegments_AnchorOnGCell".
280 
282 
283  public:
284  // Sub-Class: Locator.
285  class Locator : public AutoSegmentHL {
286  public:
287  Locator ( GCell* fcell, unsigned int flags );
288  inline Locator ( const Locator& );
289  virtual ~Locator ();
290  virtual AutoSegment* getElement () const;
291  virtual AutoSegmentHL* getClone () const;
292  virtual bool isValid () const;
293  virtual void progress ();
294  virtual string _getString () const;
295  protected:
296  unsigned int _flags;
297  vector<AutoContact*>::const_iterator _itContact;
298  vector<AutoContact*>::const_iterator _itEnd;
299  Hurricane::Locator<Hook*>* _hookLocator;
300  AutoSegment* _element;
301  };
302 
303  public:
304  // AutoSegments_Perpandiculars Methods.
305  inline AutoSegments_AnchorOnGCell ( GCell* fcell, unsigned int flags );
307  virtual AutoSegmentHC* getClone () const;
308  virtual AutoSegmentHL* getLocator () const;
309  virtual string _getString () const;
310 
311  public:
312  // AutoSegments_Perpandiculars Attributes.
313  GCell* _fcell;
314  unsigned int _flags;
315  };
316 
317 
318  inline AutoSegments_AnchorOnGCell::Locator::Locator ( const Locator &locator )
319  : AutoSegmentHL()
320  , _flags (locator._flags)
321  , _itContact (locator._itContact)
322  , _itEnd (locator._itEnd)
323  , _hookLocator (locator._hookLocator->getClone())
324  , _element (locator._element)
325  { }
326 
327 
328  inline AutoSegments_AnchorOnGCell::AutoSegments_AnchorOnGCell ( GCell* fcell, unsigned int flags )
329  : AutoSegmentHC()
330  , _fcell(fcell)
331  , _flags(flags)
332  { }
333 
334 
336  ( const AutoSegments_AnchorOnGCell& autosegments )
337  : AutoSegmentHC()
338  , _fcell(autosegments._fcell)
339  , _flags(autosegments._flags)
340  { }
341 
342 
343 // -------------------------------------------------------------------
344 // Class : "AutoSegments_CachedOnContact".
345 
346  class AutoSegments_CachedOnContact : public AutoSegmentHC {
347 
348  public:
349  // Sub-Class: Locator.
350  class Locator : public AutoSegmentHL {
351  public:
352  Locator ( AutoContact* sourceAnchor, unsigned int direction );
353  inline Locator ( const Locator& );
354  virtual ~Locator ();
355  virtual AutoSegment* getElement () const;
356  virtual AutoSegmentHL* getClone () const;
357  virtual bool isValid () const;
358  virtual void progress ();
359  virtual string _getString () const;
360  protected:
361  LocatorHelper* _helper;
362  };
363 
364  // Constructors.
365  public:
366  // AutoSegments_CachedOnContact Methods.
367  inline AutoSegments_CachedOnContact ( AutoContact* sourceContact
368  , unsigned int direction=KbHorizontal|KbVertical );
369  inline AutoSegments_CachedOnContact ( const AutoSegments_CachedOnContact& );
370  virtual AutoSegmentHC* getClone () const;
371  virtual AutoSegmentHL* getLocator () const;
372  virtual string _getString () const;
373 
374  protected:
375  // AutoSegments_CachedOnContact Attributes.
376  unsigned int _direction;
377  AutoContact* _sourceContact;
378 
379  };
380 
381 
382  inline AutoSegments_CachedOnContact::Locator::Locator ( const Locator &locator )
383  : AutoSegmentHL()
384  , _helper(locator._helper)
385  { }
386 
387 
388  inline AutoSegments_CachedOnContact::AutoSegments_CachedOnContact
389  ( AutoContact* sourceContact, unsigned int direction )
390  : AutoSegmentHC()
391  , _direction (direction)
392  , _sourceContact(sourceContact)
393  {
394  if (_direction & KbVertical) _direction |= KbWithPerpands;
395  }
396 
397 
398  inline AutoSegments_CachedOnContact::AutoSegments_CachedOnContact
399  ( const AutoSegments_CachedOnContact& autosegments )
400  : AutoSegmentHC()
401  , _direction (autosegments._direction)
402  , _sourceContact(autosegments._sourceContact)
403  { }
404 
405 
406 // -------------------------------------------------------------------
407 // Class : "AutoSegments_IsAccountable".
408 
410  public:
411  virtual AutoSegmentHF* getClone () const;
412  virtual bool accept ( AutoSegment* ) const;
413  virtual string _getString () const;
414  };
415 
416 
417 // -------------------------------------------------------------------
418 // Class : "AutoSegments_InDirection".
419 
421  public:
422  inline AutoSegments_InDirection ( unsigned int direction );
424  virtual AutoSegmentHF* getClone () const;
425  virtual bool accept ( AutoSegment* segment ) const;
426  virtual string _getString () const;
427  protected:
428  unsigned int _direction;
429  };
430 
431 
432  inline AutoSegments_InDirection::AutoSegments_InDirection ( unsigned int direction )
433  : AutoSegmentHF()
434  , _direction(direction)
435  {}
436 
437 
439  : AutoSegmentHF()
440  , _direction(filter._direction)
441  {}
442 
443 
444 } // End of Katabatic namespace.
445 
446 
447 # endif
AutoSegments_Aligneds(AutoSegment *, unsigned int flags=KbNoFlags)
Definition: AutoSegments.h:204
Definition: Constants.h:28
virtual AutoSegmentHL * getLocator() const
Definition: Constants.h:29
virtual AutoSegmentHF * getClone() const
Hurricane::Filter< AutoSegment * > AutoSegmentHF
Definition: AutoSegments.h:64
AutoSegments_AnchorOnGCell(GCell *fcell, unsigned int flags)
Definition: AutoSegments.h:328
virtual AutoSegmentHC * getClone() const
virtual AutoSegmentHL * getLocator() const
virtual AutoSegmentHC * getClone() const
Filter to select accoutable AutoSegment.
Definition: AutoSegments.h:409
Routing Global Cell.
Definition: GCell.h:74
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
GenericLocator< AutoSegment * > AutoSegmentLocator
Definition: AutoSegments.h:74
The namespace dedicated to Katabatic.
Definition: Katabatic.dox:13
Locator Helper Collection&#39;s Locators.
Definition: AutoContact.h:273
All AutoSegment Beginning and/or Stopping in a GCell.
Definition: AutoSegments.h:281
virtual bool accept(AutoSegment *segment) const
virtual bool accept(AutoSegment *) const
Hurricane::Collection< AutoSegment * > AutoSegmentHC
Definition: AutoSegments.h:72
AutoSegments_OnContact(AutoSegment *master, Contact *contact)
Definition: AutoSegments.h:145
GenericCollection< AutoSegment * > AutoSegments
Definition: AutoSegments.h:73
virtual AutoSegmentHC * getClone() const
Filter to select AutoSegment in a given direction.
Definition: AutoSegments.h:420
Hurricane::Locator< AutoSegment * > AutoSegmentHL
Definition: AutoSegments.h:71
Definition: Constants.h:27
All perpandicular AutoSegment to a set of aligneds.
Definition: AutoSegments.h:221
GenericFilter< AutoSegment * > AutoSegmentFilter
Definition: AutoSegments.h:75
All aligned AutoSegment of a set.
Definition: AutoSegments.h:162
Abstract base class for AutoContact.
Definition: AutoContact.h:70
virtual AutoSegmentHF * getClone() const
virtual AutoSegmentHL * getLocator() const
virtual AutoSegmentHC * getClone() const
AutoSegments_Perpandiculars(AutoSegment *master)
Definition: AutoSegments.h:265
virtual AutoSegmentHL * getLocator() const
All AutoSegment anchored on a Contact.
Definition: AutoSegments.h:103
AutoSegments_InDirection(unsigned int direction)
Definition: AutoSegments.h:432


Generated by doxygen 1.8.14 on Sun Nov 21 2021 Return to top of page
Katabatic - Routing Toolbox Copyright © 2008-2020 Sorbonne Universite. All rights reserved