File tree Expand file tree Collapse file tree 11 files changed +150
-52
lines changed
codeGenerator/schema/chip Expand file tree Collapse file tree 11 files changed +150
-52
lines changed Original file line number Diff line number Diff line change @@ -231,14 +231,14 @@ void DRCWidget::setChip(odb::dbChip* chip)
231231{
232232 chip_ = chip;
233233
234- addOwner (chip_-> getBlock () );
234+ addOwner (chip_);
235235 updateMarkerGroups ();
236236}
237237
238238void DRCWidget::showEvent (QShowEvent* event)
239239{
240240 if (chip_) {
241- addOwner (chip_-> getBlock () );
241+ addOwner (chip_);
242242 }
243243
244244 updateMarkerGroups ();
Original file line number Diff line number Diff line change 1919#include " gui/gui.h"
2020#include " inspector.h"
2121#include " odb/db.h"
22- #include " odb/dbBlockCallBackObj .h"
22+ #include " odb/dbChipCallBackObj .h"
2323#include " odb/geom.h"
2424
2525namespace utl {
@@ -51,7 +51,7 @@ class DRCRenderer : public Renderer
5151 odb::dbMarkerCategory* category_;
5252};
5353
54- class DRCWidget : public QDockWidget , public odb ::dbBlockCallBackObj
54+ class DRCWidget : public QDockWidget , public odb ::dbChipCallBackObj
5555{
5656 Q_OBJECT
5757
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ class dbFill;
1818class dbITerm ;
1919class dbInst ;
2020class dbIoType ;
21- class dbMarker ;
22- class dbMarkerCategory ;
2321class dbMaster ;
2422class dbModBTerm ;
2523class dbModule ;
@@ -182,16 +180,6 @@ class dbBlockCallBackObj
182180 virtual void inDbFillCreate (dbFill*) {}
183181 // dbFill End
184182
185- // dbMarkerCategory Start
186- virtual void inDbMarkerCategoryCreate (dbMarkerCategory*) {}
187- virtual void inDbMarkerCategoryDestroy (dbMarkerCategory*) {}
188- // dbMarkerCategory End
189-
190- // dbMarker Start
191- virtual void inDbMarkerCreate (dbMarker*) {}
192- virtual void inDbMarkerDestroy (dbMarker*) {}
193- // dbMarker End
194-
195183 virtual void inDbBlockStreamOutBefore (dbBlock*) {}
196184 virtual void inDbBlockStreamOutAfter (dbBlock*) {}
197185 virtual void inDbBlockReadNetsBefore (dbBlock*) {}
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: BSD-3-Clause
2+ // Copyright (c) 2019-2025, The OpenROAD Authors
3+
4+ #pragma once
5+
6+ #include < list>
7+
8+ #include " odb/odb.h"
9+
10+ namespace odb {
11+
12+ class dbChip ;
13+ class dbMarker ;
14+ class dbMarkerCategory ;
15+
16+ // /////////////////////////////////////////////////////////////////////////////
17+ // /
18+ // / dbChipCallBackObj - An object comprising a list of stub routines
19+ // / invoked by dbChip.
20+ // / Derived classes may implement these routines, causing external code
21+ // / to be invoked from inside dbBlock methods.
22+ // /
23+ // /////////////////////////////////////////////////////////////////////////////
24+
25+ class dbChipCallBackObj
26+ {
27+ public:
28+ // dbMarkerCategory Start
29+ virtual void inDbMarkerCategoryCreate (dbMarkerCategory*) {}
30+ virtual void inDbMarkerCategoryDestroy (dbMarkerCategory*) {}
31+ // dbMarkerCategory End
32+
33+ // dbMarker Start
34+ virtual void inDbMarkerCreate (dbMarker*) {}
35+ virtual void inDbMarkerDestroy (dbMarker*) {}
36+ // dbMarker End
37+
38+ // allow ECO client initialization - payam
39+ virtual dbChipCallBackObj& operator ()() { return *this ; }
40+
41+ // Manipulate _callback list of owner -- in journal.cpp
42+ void addOwner (dbChip* new_owner);
43+ bool hasOwner () const { return (_owner != nullptr ); }
44+ void removeOwner ();
45+
46+ dbChipCallBackObj () { _owner = nullptr ; }
47+ virtual ~dbChipCallBackObj () { removeOwner (); }
48+
49+ private:
50+ dbChip* _owner = nullptr ;
51+ };
52+
53+ } // namespace odb
Original file line number Diff line number Diff line change 195195 " dbBlock.h" ,
196196 " dbTech.h" ,
197197 " dbPropertyItr.h" ,
198- " dbChipConn.h"
198+ " dbChipConn.h" ,
199+ " dbChipConnItr.h" ,
200+ " dbChipInst.h" ,
201+ " dbChipInstItr.h" ,
202+ " dbChipNet.h" ,
203+ " dbChipNetItr.h" ,
204+ " dbCommon.h" ,
205+ " odb/dbChipCallBackObj.h" ,
206+ " odb/dbObject.h" ,
207+ " odb/geom.h"
199208 ]
200209}
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ add_library(db
9090 dbChip.cpp
9191 dbChipBump.cpp
9292 dbChipBumpInst.cpp
93+ dbChipCallBackObj.cpp
9394 dbChipConn.cpp
9495 dbChipInst.cpp
9596 dbChipNet.cpp
Original file line number Diff line number Diff line change 1010#include " dbBlock.h"
1111#include " dbBlockItr.h"
1212#include " dbChipConn.h"
13+ #include " dbChipConnItr.h"
14+ #include " dbChipInst.h"
15+ #include " dbChipInstItr.h"
16+ #include " dbChipNet.h"
17+ #include " dbChipNetItr.h"
1318#include " dbChipRegion.h"
19+ #include " dbCommon.h"
1420#include " dbDatabase.h"
1521#include " dbMarkerCategory.h"
1622#include " dbNameCache.h"
2026#include " dbTable.hpp"
2127#include " dbTech.h"
2228#include " odb/db.h"
29+ #include " odb/dbChipCallBackObj.h"
30+ #include " odb/dbObject.h"
2331#include " odb/dbSet.h"
32+ #include " odb/geom.h"
2433// User Code Begin Includes
2534#include < cstdlib>
26-
27- #include " dbChipConnItr.h"
28- #include " dbChipInst.h"
29- #include " dbChipInstItr.h"
30- #include " dbChipNet.h"
31- #include " dbChipNetItr.h"
32- #include " dbCommon.h"
33- #include " odb/dbObject.h"
34- #include " odb/geom.h"
35+ #include < list>
3536// User Code End Includes
3637namespace odb {
3738template class dbTable <_dbChip>;
@@ -342,6 +343,11 @@ _dbChip::~_dbChip()
342343 delete name_cache_;
343344 delete block_itr_;
344345 delete prop_itr_;
346+
347+ while (!callbacks_.empty ()) {
348+ auto _cbitr = callbacks_.begin ();
349+ (*_cbitr)->removeOwner ();
350+ }
345351 // User Code End Destructor
346352}
347353
Original file line number Diff line number Diff line change 1111#include " odb/dbId.h"
1212#include " odb/geom.h"
1313#include " odb/odb.h"
14+ // User Code Begin Includes
15+ #include < list>
16+ // User Code End Includes
1417
1518namespace odb {
1619class dbIStream ;
@@ -27,6 +30,9 @@ class _dbChipInst;
2730class _dbChipConn ;
2831class _dbChipNet ;
2932class _dbTech ;
33+ // User Code Begin Classes
34+ class dbChipCallBackObj ;
35+ // User Code End Classes
3036
3137class _dbChip : public _dbObject
3238{
@@ -75,6 +81,10 @@ class _dbChip : public _dbObject
7581 dbTable<_dbChipRegion>* chip_region_tbl_;
7682 dbTable<_dbMarkerCategory>* marker_categories_tbl_;
7783 dbId<_dbChip> next_entry_;
84+
85+ // User Code Begin Fields
86+ std::list<dbChipCallBackObj*> callbacks_;
87+ // User Code End Fields
7888};
7989dbIStream& operator >>(dbIStream& stream, _dbChip& obj);
8090dbOStream& operator <<(dbOStream& stream, const _dbChip& obj);
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: BSD-3-Clause
2+ // Copyright (c) 2019-2025, The OpenROAD Authors
3+
4+ #include " odb/dbChipCallBackObj.h"
5+
6+ #include " dbChip.h"
7+
8+ namespace odb {
9+
10+ // //////////////////////////////////////////////////////////////////
11+ //
12+ // dbChipCallBackObj - Methods
13+ //
14+ // //////////////////////////////////////////////////////////////////
15+
16+ void dbChipCallBackObj::addOwner (dbChip* new_owner)
17+ {
18+ if (!new_owner) {
19+ return ;
20+ }
21+
22+ if (_owner) {
23+ removeOwner ();
24+ }
25+
26+ _dbChip* chip = (_dbChip*) new_owner;
27+ chip->callbacks_ .insert (chip->callbacks_ .end (), this );
28+ _owner = new_owner;
29+ }
30+
31+ void dbChipCallBackObj::removeOwner ()
32+ {
33+ if (_owner) {
34+ _dbChip* chip = (_dbChip*) _owner;
35+ chip->callbacks_ .remove (this );
36+ _owner = nullptr ;
37+ }
38+ }
39+
40+ } // namespace odb
Original file line number Diff line number Diff line change 2525// User Code Begin Includes
2626#include " dbChip.h"
2727#include " dbCore.h"
28- #include " odb/dbBlockCallBackObj .h"
28+ #include " odb/dbChipCallBackObj .h"
2929#include " odb/dbObject.h"
3030// User Code End Includes
3131namespace odb {
@@ -806,11 +806,9 @@ dbMarker* dbMarker::create(dbMarkerCategory* category)
806806
807807 _dbMarker* marker = _category->marker_tbl_ ->create ();
808808
809- _dbBlock* block = marker->getBlock ();
810- if (block) {
811- for (auto cb : block->callbacks_ ) {
812- cb->inDbMarkerCreate ((dbMarker*) marker);
813- }
809+ _dbChip* chip = marker->getChip ();
810+ for (auto cb : chip->callbacks_ ) {
811+ cb->inDbMarkerCreate ((dbMarker*) marker);
814812 }
815813
816814 return (dbMarker*) marker;
@@ -820,8 +818,8 @@ void dbMarker::destroy(dbMarker* marker)
820818{
821819 _dbMarker* _marker = (_dbMarker*) marker;
822820
823- _dbBlock* block = _marker->getBlock ();
824- for (auto cb : block ->callbacks_ ) {
821+ _dbChip* chip = _marker->getChip ();
822+ for (auto cb : chip ->callbacks_ ) {
825823 cb->inDbMarkerDestroy (marker);
826824 }
827825
You can’t perform that action at this time.
0 commit comments