Skip to content

Commit bfcd6b8

Browse files
committed
odb: refactor dbBox (plus clients)
Signed-off-by: Matt Liberty <[email protected]>
1 parent 90d89cf commit bfcd6b8

File tree

12 files changed

+237
-280
lines changed

12 files changed

+237
-280
lines changed

src/drt/src/io/io.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,7 @@ void io::Parser::updateNetRouting(frNet* netIn, odb::dbNet* net)
958958
== getTech()->name2via_.end()) {
959959
logger_->error(DRT, 109, "Unsupported via in db.");
960960
} else {
961-
int x, y;
962-
box->getViaXY(x, y);
963-
odb::Point p(x, y);
961+
const odb::Point p = box->getViaXY();
964962
auto viaDef = getTech()->name2via_[viaName];
965963
auto tmpP = std::make_unique<frVia>(viaDef);
966964
tmpP->setOrigin(p);
@@ -2666,11 +2664,10 @@ void io::Parser::setMasters(odb::dbDatabase* db)
26662664
master->getName(),
26672665
_term->getName());
26682666
}
2669-
int x, y;
2670-
box->getViaXY(x, y);
2667+
const odb::Point pt = box->getViaXY();
26712668
auto viaDef = getTech()->name2via_[box->getTechVia()->getName()];
26722669
auto tmpP = std::make_unique<frVia>(viaDef);
2673-
tmpP->setOrigin({x, y});
2670+
tmpP->setOrigin(pt);
26742671
// layer1 rect
26752672
addPinFig(
26762673
tmpP->getLayer1BBox(), viaDef->getLayer1Num(), pinIn.get());

src/odb/include/odb/db.h

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -192,74 +192,69 @@ class dbBox : public dbObject
192192
///
193193
/// Get the lower coordinate.
194194
///
195-
int xMin();
195+
int xMin() const;
196196

197197
///
198198
/// Get the lower y coordinate.
199199
///
200-
int yMin();
200+
int yMin() const;
201201

202202
///
203203
/// Get the high x coordinate.
204204
///
205-
int xMax();
205+
int xMax() const;
206206

207207
///
208208
/// Get the high y coordinate.
209209
///
210-
int yMax();
210+
int yMax() const;
211211

212212
///
213213
/// Returns true if this box represents a via
214214
///
215-
bool isVia();
215+
bool isVia() const;
216216

217217
///
218218
/// Get tech-via this box represents.
219219
/// returns nullptr if this box does not represent a tech-via
220220
///
221-
dbTechVia* getTechVia();
221+
dbTechVia* getTechVia() const;
222222

223223
///
224224
/// Get block-via this box represents.
225225
/// returns nullptr if this box does not represent a block-via
226226
///
227-
dbVia* getBlockVia();
228-
229-
///
230-
/// Return the placed location of this via.
231-
///
232-
void getViaXY(int& x, int& y);
227+
dbVia* getBlockVia() const;
233228

234229
///
235230
/// Return the placed location of this via.
236231
///
237-
Point getViaXY();
232+
Point getViaXY() const;
238233

239234
///
240235
/// Get the box bounding points.
241236
///
242-
Rect getBox();
237+
Rect getBox() const;
243238

244239
///
245240
/// Get the translated boxes of this via
246241
///
247-
void getViaBoxes(std::vector<dbShape>& shapes);
242+
void getViaBoxes(std::vector<dbShape>& shapes) const;
248243

249244
///
250245
/// Get the translated boxes of this via on the given layer
251246
///
252-
void getViaLayerBoxes(dbTechLayer* layer, std::vector<dbShape>& shapes);
247+
void getViaLayerBoxes(dbTechLayer* layer, std::vector<dbShape>& shapes) const;
253248

254249
///
255250
/// Get the width (xMax-xMin) of the box.
256251
///
257-
int getDir();
252+
int getDir() const;
258253

259254
///
260255
/// Get the width (xMax-xMin) of the box.
261256
///
262-
uint getDX();
257+
uint getDX() const;
263258

264259
int getDesignRuleWidth() const;
265260

@@ -268,25 +263,25 @@ class dbBox : public dbObject
268263
///
269264
/// Get the height (yMax-yMin) of the box.
270265
///
271-
uint getDY();
272-
uint getWidth(uint dir = 1);
273-
uint getLength(uint dir = 1);
266+
uint getDY() const;
267+
uint getWidth(uint dir = 1) const;
268+
uint getLength(uint dir = 1) const;
274269

275270
///
276271
/// Set temporary flag visited
277272
///
278273
void setVisited(bool value);
279-
bool isVisited();
274+
bool isVisited() const;
280275

281276
///
282277
/// Get the owner of this box
283278
///
284-
dbObject* getBoxOwner();
279+
dbObject* getBoxOwner() const;
285280

286281
///
287282
/// Get the owner type of this box
288283
///
289-
dbBoxOwner getOwnerType();
284+
dbBoxOwner getOwnerType() const;
290285

291286
///
292287
/// Get the layer of this box.
@@ -300,13 +295,13 @@ class dbBox : public dbObject
300295
/// These bboxes have no layer.
301296
/// All dbBox(s) that represent VIA's.
302297
///
303-
dbTechLayer* getTechLayer();
298+
dbTechLayer* getTechLayer() const;
304299

305300
///
306301
/// Get the layer mask assigned to this box.
307302
/// Returns 0 is not assigned or bbox has no layer
308303
///
309-
uint getLayerMask();
304+
uint getLayerMask() const;
310305

311306
///
312307
/// Sets the layer mask for this box.

src/odb/include/odb/dbShape.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ class dbInstShapeItr
364364
dbTechVia* _via;
365365
dbSet<dbBox> _via_boxes;
366366
dbSet<dbBox>::iterator _via_box_itr;
367-
int _via_x;
368-
int _via_y;
367+
Point _via_pt;
369368
bool _expand_vias;
370369
int _prev_state;
371370

@@ -399,8 +398,7 @@ class dbITermShapeItr
399398
dbTechVia* _via;
400399
dbSet<dbBox> _via_boxes;
401400
dbSet<dbBox>::iterator _via_box_itr;
402-
int _via_x;
403-
int _via_y;
401+
Point _via_pt;
404402
bool _expand_vias;
405403

406404
void getShape(dbBox* box, dbShape& shape);

0 commit comments

Comments
 (0)