17 #ifndef KITE_ROUTING_EVENT_H 18 #define KITE_ROUTING_EVENT_H 25 #include "hurricane/Interval.h" 30 #include "kite/TrackCost.h" 31 #include "kite/TrackElement.h" 32 #include "kite/DataNegociate.h" 33 #include "kite/Session.h" 40 using std::binary_function;
47 class RoutingEventHistory;
48 class RoutingEventQueue;
49 class RoutingEventLoop;
60 class Compare :
public binary_function<const Key&,const Key&,bool> {
62 bool operator() (
const Key& lhs,
const Key& rhs )
const;
69 unsigned int _tracksNb:6;
71 unsigned int _eventLevel;
72 unsigned int _segFlags;
73 unsigned int _layerDepth;
84 class Compare :
public binary_function<const RoutingEvent*,const RoutingEvent*,bool> {
89 class CompareById :
public binary_function<const RoutingEvent*,const RoutingEvent*,bool> {
96 enum Mode { Negociate=1, Pack=2, Repair=3 };
99 static unsigned int getStage ();
100 static size_t getAllocateds ();
101 static size_t getProcesseds ();
102 static size_t getCloneds ();
103 static void resetProcesseds ();
104 static void setStage (
unsigned int );
109 inline bool isCloned ()
const;
110 inline bool isValid ()
const;
111 bool isUnimplemented ()
const;
112 inline bool isProcessed ()
const;
113 inline bool isDisabled ()
const;
114 inline bool isForcedToHint ()
const;
115 inline bool isSheared ()
const;
116 inline bool isRipedByLocal ()
const;
117 inline bool isOverConstrained ()
const;
118 inline unsigned int getId ()
const;
119 inline unsigned int getTimeStamp ()
const;
120 inline bool getMode ()
const;
121 inline bool canMinimize ()
const;
122 unsigned int getState ()
const;
123 inline const Key& getKey ()
const;
125 inline const vector<TrackElement*>& getPerpandiculars ()
const;
127 inline DbU::Unit getAxisHistory ()
const;
128 inline long getAxisWeight (
DbU::Unit )
const;
129 inline const Interval& getConstraints ()
const;
130 inline const Interval& getOptimal ()
const;
131 inline const Interval& getPerpandicularFree ()
const;
132 inline float getPriority ()
const;
133 inline unsigned int getTracksNb ()
const;
134 inline unsigned int getTracksFree ()
const;
135 inline unsigned int getInsertState ()
const;
136 inline unsigned int getEventLevel ()
const;
138 inline void updateKey ();
145 void setMode (
unsigned int );
146 void setState (
unsigned int );
147 inline void setTimeStamp (
unsigned int );
148 inline void setProcessed (
bool state=
true );
149 inline void setDisabled (
bool state=
true );
150 inline void setMinimized (
bool state=
true );
151 inline void setRipedByLocal (
bool state=
true );
152 inline void setTracksFree (
unsigned int );
153 inline void setForcedToHint (
bool state =
true );
155 void setAxisHintFromParent ();
156 inline void incInsertState ();
157 inline void resetInsertState ();
158 inline void setEventLevel (
unsigned int );
162 Record* _getRecord ()
const;
163 string _getString ()
const;
164 string _getTypeName ()
const;
171 static unsigned int _idCounter;
172 static unsigned int _stage;
173 static size_t _allocateds;
174 static size_t _processeds;
175 static size_t _cloneds;
176 mutable bool _cloned;
179 bool _overConstrained;
184 unsigned int _timeStamp;
192 unsigned int _tracksNb : 6;
193 unsigned int _tracksFree : 4;
194 unsigned int _insertState : 6;
195 unsigned int _mode : 4;
196 unsigned int _rippleState : 4;
197 unsigned int _eventLevel;
205 inline bool RoutingEvent::isCloned ()
const {
return _cloned; }
206 inline bool RoutingEvent::isProcessed ()
const {
return _processed; }
207 inline bool RoutingEvent::isDisabled ()
const {
return _disabled; }
208 inline bool RoutingEvent::isForcedToHint ()
const {
return _forceToHint; }
209 inline bool RoutingEvent::isRipedByLocal ()
const {
return _ripedByLocal; }
210 inline bool RoutingEvent::isOverConstrained ()
const {
return _overConstrained; }
211 inline unsigned int RoutingEvent::getId ()
const {
return _id; }
212 inline unsigned int RoutingEvent::getTimeStamp ()
const {
return _timeStamp; }
213 inline bool RoutingEvent::getMode ()
const {
return _mode; }
214 inline bool RoutingEvent::canMinimize ()
const {
return not _minimized; }
216 inline TrackElement* RoutingEvent::getSegment ()
const {
return _segment; }
217 inline const vector<TrackElement*>& RoutingEvent::getPerpandiculars ()
const {
return _dataNegociate->
getPerpandiculars(); }
219 inline DbU::Unit RoutingEvent::getAxisHistory ()
const {
return _axisHistory; }
220 inline DbU::Unit RoutingEvent::getAxisHint ()
const {
return _axisHint; }
221 inline long RoutingEvent::getAxisWeight (
DbU::Unit axis )
const {
return labs(axis - getAxisHint()); }
222 inline const Interval& RoutingEvent::getConstraints ()
const {
return _constraints; }
223 inline const Interval& RoutingEvent::getOptimal ()
const {
return _optimal; }
224 inline const Interval& RoutingEvent::getPerpandicularFree ()
const {
return _dataNegociate->getPerpandicularFree(); }
226 inline float RoutingEvent::getPriority ()
const {
return _priority; }
227 inline unsigned int RoutingEvent::getEventLevel ()
const {
return _eventLevel; }
228 inline unsigned int RoutingEvent::getTracksNb ()
const {
return _tracksNb; }
229 inline unsigned int RoutingEvent::getTracksFree ()
const {
return _tracksFree; }
230 inline unsigned int RoutingEvent::getInsertState ()
const {
return _insertState; }
231 inline void RoutingEvent::setTimeStamp (
unsigned int stamp ) { _timeStamp = stamp; }
232 inline void RoutingEvent::setProcessed (
bool state ) { _processed = state; }
233 inline void RoutingEvent::setDisabled (
bool state ) { _disabled = state; }
234 inline void RoutingEvent::setMinimized (
bool state ) { _minimized = state; }
235 inline void RoutingEvent::setRipedByLocal (
bool state ) { _ripedByLocal = state; }
236 inline void RoutingEvent::setTracksFree (
unsigned int nb ) { _tracksFree = nb; }
237 inline void RoutingEvent::setForcedToHint (
bool state ) { _forceToHint = state; }
238 inline void RoutingEvent::incInsertState () { _insertState++; }
239 inline void RoutingEvent::resetInsertState () { _insertState = 0; }
240 inline void RoutingEvent::setEventLevel (
unsigned int level ) { _eventLevel = level; }
241 inline void RoutingEvent::updateKey () { revalidate(); _key.update(
this); }
244 {
return lhs->getId() < rhs->getId(); }
247 typedef set<RoutingEvent*,RoutingEvent::CompareById> RoutingEventSet;
254 # if !defined(NDEBUG) 255 # define _preCheck(segment) \ 256 DbU::Unit beforeMin = segment->base()->getSourcePosition(); \ 257 DbU::Unit beforeMax = segment->base()->getTargetPosition(); \ 258 segment->base()->checkPositions (); \ 259 if ( Session::getSegmentStackSize() ) \ 260 cerr << "[ERROR] Session Segment Stack is not empty (" \ 261 << Session::getSegmentStackSize() << ")." << endl; 263 # define _postCheck(segment) \ 264 cdebug_log(159,0) << "Bounds := [" \ 265 << DbU::getValueString(segment->base()->getSourcePosition()) << ":" \ 266 << DbU::getValueString(segment->base()->getTargetPosition()) << "] " \ 267 << DbU::getValueString(segment->getAxis()) << " " \ 268 << segment->getTrack() << endl; \ 269 if ( beforeMin != segment->base()->getSourcePosition() ) \ 270 cerr << "[ERROR] " << segment \ 271 << " origin was " << DbU::getValueString(beforeMin) << endl; \ 272 if ( beforeMax != segment->base()->getTargetPosition() ) \ 273 cerr << "[ERROR] " << segment \ 274 << " extremity was " << DbU::getValueString(beforeMax) << endl; 276 # define _preCheck(segment) ; 277 # define _postCheck(segment) ; 287 #endif // KITE_ROUTING_EVENT_H Atomic Placement Request for a TrackSegment.
Definition: RoutingEvent.h:55
Simple loop dectector for RoutingEvent.
Definition: RoutingEventLoop.h:32
History of RoutingEvent.
Definition: RoutingEventHistory.h:35
Abstract Class for all Elements inserted inside a Track.
Definition: TrackElement.h:100
virtual TrackElements getPerpandiculars()
Definition: TrackElement.cpp:171
Mode
Definition: RoutingEvent.h:96
RoutingEvent cached key for maps.
Definition: RoutingEvent.h:58
The priority Queue of RoutingEvent.
Definition: RoutingEventQueue.h:35
The namespace dedicated to Kite.
Definition: Constants.h:22
Algorimthmic datas associated the TrackSegment.
Definition: DataNegociate.h:50