-
Notifications
You must be signed in to change notification settings - Fork 827
odb: UnfoldedModel as a persistent object in dbDatabase #9639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
94cc4d9
498f919
624f216
64ba143
f550678
f0bdd02
bfb68c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,6 @@ add_library(3dblox | |
| dbvWriter.cpp | ||
| dbxWriter.cpp | ||
| 3dblox.cpp | ||
| unfoldedModel.cpp | ||
| checker.cpp | ||
| ) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ | |
| #include "odb/dbDatabaseObserver.h" | ||
| #include "odb/dbObject.h" | ||
| #include "odb/dbStream.h" | ||
| #include "odb/unfoldedModel.h" | ||
| #include "utl/Logger.h" | ||
| // User Code End Includes | ||
| namespace odb { | ||
|
|
@@ -207,6 +208,8 @@ _dbDatabase::_dbDatabase(_dbDatabase* db) | |
| chip_bump_inst_itr_ = new dbChipBumpInstItr(chip_bump_inst_tbl_); | ||
|
|
||
| chip_net_itr_ = new dbChipNetItr(chip_net_tbl_); | ||
|
|
||
| unfolded_model_ = nullptr; | ||
| // User Code End Constructor | ||
| } | ||
|
|
||
|
|
@@ -446,6 +449,7 @@ _dbDatabase::~_dbDatabase() | |
| delete chip_conn_itr_; | ||
| delete chip_bump_inst_itr_; | ||
| delete chip_net_itr_; | ||
| delete unfolded_model_; | ||
| // User Code End Destructor | ||
| } | ||
|
|
||
|
|
@@ -495,6 +499,8 @@ _dbDatabase::_dbDatabase(_dbDatabase* /* unused: db */, int id) | |
| chip_bump_inst_itr_ = new dbChipBumpInstItr(chip_bump_inst_tbl_); | ||
|
|
||
| chip_net_itr_ = new dbChipNetItr(chip_net_tbl_); | ||
|
|
||
| unfolded_model_ = nullptr; | ||
| } | ||
|
|
||
| utl::Logger* _dbDatabase::getLogger() const | ||
|
|
@@ -685,6 +691,19 @@ dbChip* dbDatabase::getChip() | |
| return (dbChip*) db->chip_tbl_->getPtr(db->chip_); | ||
| } | ||
|
|
||
| void dbDatabase::constructUnfoldedModel() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have auto creation in get rather than explicit construction? Do we want get to return a nullptr?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could, which I did earlier, but I think this introduces many issues for the current use cases.
I would prefer to keep it that way temporarily until we make it dynamic.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As it stand calling it twice leaks the previous unfolding. At a minimum it needs to manage memory if you want to stick with this temporarily I think get should create if needed or return otherwise. Updating the unfolding dynamically should be a separate, automatic process inside the database.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the memory leak stands and will be fixed by destroying the unfoldedModel before reconstructing it. |
||
| { | ||
| _dbDatabase* db = (_dbDatabase*) this; | ||
| delete db->unfolded_model_; | ||
| db->unfolded_model_ = new UnfoldedModel(db->logger_, getChip()); | ||
| } | ||
|
|
||
| const UnfoldedModel* dbDatabase::getUnfoldedModel() const | ||
| { | ||
| _dbDatabase* db = (_dbDatabase*) this; | ||
| return db->unfolded_model_; | ||
| } | ||
|
|
||
| dbTech* dbDatabase::getTech() | ||
| { | ||
| auto techs = getTechs(); | ||
|
|
@@ -993,6 +1012,7 @@ void dbDatabase::triggerPostRead3Dbx(dbChip* chip) | |
| for (dbDatabaseObserver* observer : db->observers_) { | ||
| observer->postRead3Dbx(chip); | ||
| } | ||
| constructUnfoldedModel(); | ||
| } | ||
|
|
||
| void dbDatabase::triggerPostReadDb() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.