26 #ifndef AVOID_VERTICES_H
27 #define AVOID_VERTICES_H
42 typedef std::list<EdgeInf *> EdgeInfList;
45 typedef unsigned short VertIDProps;
56 static const unsigned short src;
57 static const unsigned short tar;
59 static const VertIDProps PROP_ConnPoint;
60 static const VertIDProps PROP_OrthShapeEdge;
61 static const VertIDProps PROP_ConnectionPin;
62 static const VertIDProps PROP_ConnCheckpoint;
65 VertID(
unsigned int id,
unsigned short n, VertIDProps p = 0);
66 VertID(
const VertID& other);
67 VertID& operator= (
const VertID& rhs);
68 bool operator==(
const VertID& rhs)
const;
69 bool operator!=(
const VertID& rhs)
const;
70 bool operator<(
const VertID& rhs)
const;
71 VertID operator+(
const int& rhs)
const;
72 VertID operator-(
const int& rhs)
const;
73 VertID& operator++(
int);
74 void print(FILE *file = stdout)
const;
75 void db_print(
void)
const;
76 friend std::ostream& operator<<(std::ostream& os,
const VertID& vID);
79 inline bool isOrthShapeEdge(
void)
const
81 return (props & PROP_OrthShapeEdge) ?
true :
false;
83 inline bool isConnPt(
void)
const
85 return (props & PROP_ConnPoint) ?
true :
false;
87 inline bool isConnectionPin(
void)
const
89 return (props & PROP_ConnectionPin) ?
true :
false;
91 inline bool isConnCheckpoint(
void)
const
93 return (props & PROP_ConnCheckpoint) ?
true :
false;
102 static const VertID dummyOrthogID(0, 0);
103 static const VertID dummyOrthogShapeID(0, 0, VertID::PROP_OrthShapeEdge);
109 VertInf(Router *router,
const VertID& vid,
const Point& vpoint,
110 const bool addToRouter =
true);
112 void Reset(
const VertID& vid,
const Point& vpoint);
113 void Reset(
const Point& vpoint);
114 void removeFromGraph(
const bool isConnVert =
true);
117 unsigned int pathLeadsBackTo(
const VertInf *start)
const;
120 bool hasNeighbour(VertInf *target,
bool orthogonal)
const;
130 unsigned int visListSize;
131 EdgeInfList orthogVisList;
132 unsigned int orthogVisListSize;
133 EdgeInfList invisList;
134 unsigned int invisListSize;
139 unsigned int orthogVisPropFlags;
144 static const unsigned int XL_EDGE = 1;
145 static const unsigned int XL_CONN = 2;
146 static const unsigned int XH_EDGE = 4;
147 static const unsigned int XH_CONN = 8;
148 static const unsigned int YL_EDGE = 16;
149 static const unsigned int YL_CONN = 32;
150 static const unsigned int YH_EDGE = 64;
151 static const unsigned int YH_CONN = 128;
154 bool directVis(VertInf *src, VertInf *dst);
166 void addVertex(VertInf *vert);
167 VertInf *removeVertex(VertInf *vert);
168 VertInf *getVertexByID(
const VertID&
id);
169 VertInf *getVertexByPos(
const Point& p);
170 VertInf *shapesBegin(
void);
171 VertInf *connsBegin(
void);
173 unsigned int connsSize(
void)
const;
174 unsigned int shapesSize(
void)
const;
175 void stats(FILE *fp = stderr)
177 fprintf(fp,
"Conns %d, shapes %d\n", _connVertices,
181 VertInf *_firstShapeVert;
182 VertInf *_firstConnVert;
183 VertInf *_lastShapeVert;
184 VertInf *_lastConnVert;
185 unsigned int _shapeVertices;
186 unsigned int _connVertices;
190 typedef std::set<unsigned int> ShapeSet;
191 typedef std::map<VertID, ShapeSet> ContainsMap;