Skip to content

Commit 97a3eee

Browse files
committed
Implemented dbObject::isValid(). Changed default object name to "<type:oid>"
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
1 parent e514c5f commit 97a3eee

9 files changed

Lines changed: 13 additions & 60 deletions

File tree

src/dbSta/src/dbNetwork.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ PinInfo getPinInfo(const dbNetwork* network, const Pin* pin)
140140
if (iterm) {
141141
info.id = iterm->getId();
142142
info.type_name = iterm->getTypeName();
143-
info.valid = dbITerm::isValid(iterm, network->block());
143+
info.valid = iterm->isValid();
144144
info.addr = static_cast<void*>(iterm);
145145
} else if (bterm) {
146146
info.id = bterm->getId();
147147
info.type_name = bterm->getTypeName();
148-
info.valid = dbBTerm::isValid(bterm, network->block());
148+
info.valid = bterm->isValid();
149149
info.addr = static_cast<void*>(bterm);
150150
} else if (moditerm) {
151151
info.id = moditerm->getId();
152152
info.type_name = moditerm->getTypeName();
153-
info.valid = dbModITerm::isValid(moditerm, network->block());
153+
info.valid = moditerm->isValid();
154154
info.addr = static_cast<void*>(moditerm);
155155
}
156156

src/odb/include/odb/db.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,11 +1664,6 @@ class dbBTerm : public dbObject
16641664
/// Return true if this BTerm is mirrored with another pin.
16651665
///
16661666
bool isMirrored();
1667-
1668-
///
1669-
/// Return true if the BTerm is allocated
1670-
///
1671-
static bool isValid(const dbBTerm* bterm, const dbBlock* block);
16721667
};
16731668

16741669
///////////////////////////////////////////////////////////////////////////////
@@ -3342,11 +3337,6 @@ class dbITerm : public dbObject
33423337
///
33433338
void clearPrefAccessPoints();
33443339

3345-
///
3346-
/// Return true if the ITerm is allocated
3347-
///
3348-
static bool isValid(const dbITerm* iterm, const dbBlock* block);
3349-
33503340
///
33513341
/// Translate a database-id back to a pointer.
33523342
///
@@ -8326,11 +8316,6 @@ class dbModBTerm : public dbObject
83268316
void setBusPort(dbBusPort*);
83278317
dbBusPort* getBusPort() const;
83288318

8329-
///
8330-
/// Return true if the dbModBTerm is allocated
8331-
///
8332-
static bool isValid(const dbModBTerm* modbterm, const dbBlock* block);
8333-
83348319
static dbModBTerm* create(dbModule* parentModule, const char* name);
83358320
static void destroy(dbModBTerm*);
83368321
static dbSet<dbModBTerm>::iterator destroy(dbSet<dbModBTerm>::iterator& itr);
@@ -8401,11 +8386,6 @@ class dbModITerm : public dbObject
84018386
void connect(dbModNet* modnet);
84028387
void disconnect();
84038388

8404-
///
8405-
/// Return true if the dbModITerm is allocated
8406-
///
8407-
static bool isValid(const dbModITerm* moditerm, const dbBlock* block);
8408-
84098389
static dbModITerm* create(dbModInst* parentInstance,
84108390
const char* name,
84118391
dbModBTerm* modbterm = nullptr);

src/odb/include/odb/dbObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class dbObject
166166
uint getId() const;
167167
const char* getTypeName() const;
168168
std::string getName() const;
169+
bool isValid() const;
169170

170171
static const char* getTypeName(dbObjectType type);
171172
static dbObjectType getType(const char* name, utl::Logger* logger);

src/odb/src/db/dbBTerm.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,13 +1043,4 @@ bool dbBTerm::isMirrored()
10431043
return bterm->_is_mirrored;
10441044
}
10451045

1046-
bool dbBTerm::isValid(const dbBTerm* bterm, const dbBlock* block)
1047-
{
1048-
if (bterm == nullptr || block == nullptr) {
1049-
return false;
1050-
}
1051-
const _dbBlock* block_impl = (const _dbBlock*) block;
1052-
return block_impl->_bterm_tbl->validId(bterm->getId());
1053-
}
1054-
10551046
} // namespace odb

src/odb/src/db/dbCore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ class _dbObject : public dbObject
172172
dbObjectType getType() const;
173173
uint getOID() const;
174174
utl::Logger* getLogger() const;
175+
bool isValid() const { return _oid & DB_ALLOC_BIT; };
175176

176177
private:
177178
uint _oid;

src/odb/src/db/dbITerm.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -900,15 +900,6 @@ std::vector<std::pair<dbTechLayer*, Rect>> dbITerm::getGeometries() const
900900
return geometries;
901901
}
902902

903-
bool dbITerm::isValid(const dbITerm* iterm, const dbBlock* block)
904-
{
905-
if (iterm == nullptr || block == nullptr) {
906-
return false;
907-
}
908-
const _dbBlock* block_impl = (const _dbBlock*) block;
909-
return block_impl->_iterm_tbl->validId(iterm->getId());
910-
}
911-
912903
void _dbITerm::collectMemInfo(MemInfo& info)
913904
{
914905
info.cnt++;

src/odb/src/db/dbModBTerm.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,15 +524,6 @@ dbSet<dbModBTerm>::iterator dbModBTerm::destroy(
524524
return next;
525525
}
526526

527-
bool dbModBTerm::isValid(const dbModBTerm* modbterm, const dbBlock* block)
528-
{
529-
if (modbterm == nullptr || block == nullptr) {
530-
return false;
531-
}
532-
const _dbBlock* block_impl = (const _dbBlock*) block;
533-
return block_impl->_modbterm_tbl->validId(modbterm->getId());
534-
}
535-
536527
// User Code End dbModBTermPublicMethods
537528
} // namespace odb
538529
// Generator Code End Cpp

src/odb/src/db/dbModITerm.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,6 @@ dbSet<dbModITerm>::iterator dbModITerm::destroy(
459459
return next;
460460
}
461461

462-
bool dbModITerm::isValid(const dbModITerm* moditerm, const dbBlock* block)
463-
{
464-
if (moditerm == nullptr || block == nullptr) {
465-
return false;
466-
}
467-
const _dbBlock* block_impl = (const _dbBlock*) block;
468-
return block_impl->_moditerm_tbl->validId(moditerm->getId());
469-
}
470-
471462
// User Code End dbModITermPublicMethods
472463
} // namespace odb
473464
// Generator Code End Cpp

src/odb/src/db/dbObject.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "odb/dbObject.h"
55

6+
#include <spdlog/fmt/fmt.h>
7+
68
#include <cstdint>
79
#include <cstring>
810
#include <string>
@@ -452,10 +454,15 @@ std::string dbObject::getName() const
452454
case dbModInstObj:
453455
return static_cast<const dbModInst*>(this)->getName();
454456
default:
455-
return "<no_name>";
457+
return fmt::format("<{}:{}>", getTypeName(), getId());
456458
}
457459
}
458460

461+
bool dbObject::isValid() const
462+
{
463+
return getImpl()->isValid();
464+
}
465+
459466
dbIStream& operator>>(dbIStream& stream, dbObjectType& type)
460467
{
461468
uint32_t hash;

0 commit comments

Comments
 (0)