CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
OdDbObjectId Class Reference

#include <DbObjectId.h>

Inheritance diagram for OdDbObjectId:
OdDbBlockTableRecordId OdDbHardOwnershipId OdDbHardPointerId OdDbSoftOwnershipId OdDbSoftPointerId OdDbTypedId

Public Member Functions

 OdDbObjectId ()
 
 OdDbObjectId (OdDbStub *objectId)
 
bool isNull () const
 
void setNull ()
 
bool isValid () const
 
OdDbObjectIdoperator= (OdDbStub *objectId)
 
bool operator< (const OdDbObjectId &objectId) const
 
bool operator> (const OdDbObjectId &objectId) const
 
bool operator>= (const OdDbObjectId &objectId) const
 
bool operator<= (const OdDbObjectId &objectId) const
 
bool operator== (const OdDbObjectId &objectId) const
 
bool operator!= (const OdDbObjectId &objectId) const
 
bool operator! () const
 
 operator OdDbStub * () const
 
OdDbStubExt * operator-> () const
 
OdDbDatabasedatabase () const
 
OdDbDatabaseoriginalDatabase () const
 
void convertToRedirectedId ()
 
bool isErased () const
 
bool isEffectivelyErased () const
 
bool objectLeftOnDisk () const
 
const OdDbHandlegetHandle () const
 
const OdDbHandlegetNonForwardedHandle () const
 
OdResult openObject (OdDbObjectPtr &pObj, OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
 
OdDbObjectPtr openObject (OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
 
OdDbObjectPtr safeOpenObject (OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
 
void bindObject (OdDbObject *pObj)
 
OdRxClassobjectClass () const
 

Static Public Attributes

static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
 

Protected Attributes

OdDbStubm_Id
 

Friends

class OdDbStub
 

Detailed Description

This class implements memory-resident ObjectId objects for OdDbDatabase objects.

Remarks
Database objects reference other database objects using ObjectId objects, and a database object pointer can always be obtained from a valid ObjectId objects. The effect of this mechanism is that database objects do not have to reside in memory unless they are explicitly being examined or modified by the user.

The user must explicitly open an object before reading or writing to it, and should release it when the operation is completed. This functionality allows the Drawings to support partial loading of a database, where ObjectId objects exist for all objects in the database, but the actual database objects need not be loaded until they are accessed.
It also allows database objects that are not in use to be swapped out of memory, and loaded back in when they are accessed. ObjectId objects are not written out to a DWG/DXF file. If a reference must be preserved to a database object that has been serialized, the object's database handle (OdDbHandle) should be used.

See also
OdDbHandle OdDbObject

Corresponding C++ library: TD_Db

<group OdDb_Classes>

Definition at line 90 of file DbObjectId.h.

Constructor & Destructor Documentation

◆ OdDbObjectId() [1/2]

OdDbObjectId::OdDbObjectId ( )
inline
Remarks
This function guarantees that isNull() will return true if it is the first operation applied to this instance.

Definition at line 97 of file DbObjectId.h.

◆ OdDbObjectId() [2/2]

OdDbObjectId::OdDbObjectId ( OdDbStub objectId)
inline

For internal use only.

DOM

Definition at line 104 of file DbObjectId.h.

Member Function Documentation

◆ bindObject()

void OdDbObjectId::bindObject ( OdDbObject pObj)

Binds the specified object.

Parameters
pObj[in] Pointer to the object to bind.

◆ convertToRedirectedId()

void OdDbObjectId::convertToRedirectedId ( )

If this ObjectId object has been redirected from another database (possibly an Xref), this function returns the actual ObjectId object for that database.

◆ database()

OdDbDatabase * OdDbObjectId::database ( ) const

Returns the database with which this ObjectId object is associated.

Remarks
Returns NULL if this ObjectId object is not associated with any database.

◆ getHandle()

const OdDbHandle & OdDbObjectId::getHandle ( ) const

Returns the database handle of the object referenced by this ObjectId object.

Remarks
Returns NULL if no database object is referenced by this ObjectId object.

If this ObjectId object has been redirected from another database (possibly an Xref), this function returns the handle for this database.

◆ getNonForwardedHandle()

const OdDbHandle & OdDbObjectId::getNonForwardedHandle ( ) const

Returns the database handle of the object referenced by this ObjectId object.

Remarks
Returns NULL if no database object is referenced by this ObjectgId object.

If this ObjectId object has been redirected from another database (possibly an Xref), this function returns the handle for the original database.

◆ isEffectivelyErased()

bool OdDbObjectId::isEffectivelyErased ( ) const

Returns true if and only if this object associated with this ObjectId object is erased, or any of its ownership hierarchy have been erased.

◆ isErased()

bool OdDbObjectId::isErased ( ) const

Returns true if and only if the object associated with this ObjectId object is erased.

◆ isNull()

bool OdDbObjectId::isNull ( ) const
inline

Returns true and only if this ObjectId object is null.

Definition at line 115 of file DbObjectId.h.

◆ isValid()

bool OdDbObjectId::isValid ( ) const

Returns true and only if this ObjectId object references a valid object.

◆ objectClass()

OdRxClass * OdDbObjectId::objectClass ( ) const

◆ objectLeftOnDisk()

bool OdDbObjectId::objectLeftOnDisk ( ) const

For internal use only.

DOM

◆ openObject() [1/2]

OdDbObjectPtr OdDbObjectId::openObject ( OdDb::OpenMode  openMode = OdDb::kForRead,
bool  openErasedOne = false 
) const

Opens the database object associated with this ObjectId object, in the specified mode.

Parameters
openMode[in] Mode in which to open the object.
openErasedOne[in] If and only if true, erased objects will be opened.
Returns
Returns a SmartPointer to the opened object if successful, otherwise a null SmartPointer.
Remarks
openMode must be one of the following:

Value Description OdDb::kForRead 0 Object is open for reading. OdDb::kForWrite 1 Object is open for reading and/or writing. OdDb::kForNotify 2 Object is open for notify.

◆ openObject() [2/2]

OdResult OdDbObjectId::openObject ( OdDbObjectPtr pObj,
OdDb::OpenMode  openMode = OdDb::kForRead,
bool  openErasedOne = false 
) const

Opens the database object associated with this ObjectId object, in the specified mode.

Parameters
pObj[out] Smart pointer to opened object
openMode[in] Mode in which to open the object.
openErasedOne[in] If and only if true, erased objects will be opened.
Returns
Returns eOk if successful, otherwise an Error Code.

openMode must be one of the following:

Value Description OdDb::kForRead 0 Object is open for reading. OdDb::kForWrite 1 Object is open for reading and/or writing. OdDb::kForNotify 2 Object is open for notify.

◆ operator OdDbStub *()

OdDbObjectId::operator OdDbStub * ( ) const
inline

For internal use only.

DOM

Definition at line 163 of file DbObjectId.h.

◆ operator!()

bool OdDbObjectId::operator! ( ) const
inline

Definition at line 156 of file DbObjectId.h.

◆ operator!=()

bool OdDbObjectId::operator!= ( const OdDbObjectId objectId) const

◆ operator->()

OdDbStubExt * OdDbObjectId::operator-> ( ) const
inline

For internal use only.

DOM

Definition at line 170 of file DbObjectId.h.

◆ operator<()

bool OdDbObjectId::operator< ( const OdDbObjectId objectId) const

◆ operator<=()

bool OdDbObjectId::operator<= ( const OdDbObjectId objectId) const

◆ operator=()

OdDbObjectId & OdDbObjectId::operator= ( OdDbStub objectId)
inline

DOM

Definition at line 135 of file DbObjectId.h.

◆ operator==()

bool OdDbObjectId::operator== ( const OdDbObjectId objectId) const

◆ operator>()

bool OdDbObjectId::operator> ( const OdDbObjectId objectId) const

◆ operator>=()

bool OdDbObjectId::operator>= ( const OdDbObjectId objectId) const

◆ originalDatabase()

OdDbDatabase * OdDbObjectId::originalDatabase ( ) const

Returns the original database with which this ObjectId object is associated.

Remarks
If the object associated with this ObjectId object has been redirected to a host database from an Xref database, this function returns a pointer to the Xref database.

Otherwise, it returns a pointer to the database with which this ObjectId object is associated.

◆ safeOpenObject()

OdDbObjectPtr OdDbObjectId::safeOpenObject ( OdDb::OpenMode  openMode = OdDb::kForRead,
bool  openErasedOne = false 
) const

Opens the database object associated with this ObjectId object, in the specified mode, or throws and exception if unsucessful.

Parameters
openMode[in] Mode in which to open the object.
openErasedOne[in] If and only if true, erased objects will be opened.
Returns
Returns a SmartPointer to the opened object.
Remarks
openMode must be one of the following:

Value Description OdDb::kForRead 0 Object is open for reading. OdDb::kForWrite 1 Object is open for reading and/or writing. OdDb::kForNotify 2 Object is open for notify.

Throws:

Cause eNullObjectId This ObjectId object is null. ePermanentlyErased Not opened and openErasedOne == 1 eWasErased Not opened and openErasedOne == 0

◆ setNull()

void OdDbObjectId::setNull ( )
inline

Sets this Object ID to null.

Definition at line 120 of file DbObjectId.h.

Friends And Related Function Documentation

◆ OdDbStub

friend class OdDbStub
friend

Definition at line 329 of file DbObjectId.h.

Member Data Documentation

◆ kNull

const OdCmTransparency const OdCmTransparency const OdCmColor const OdCmColor const OdCmColor const OdCmColor const OdCmTransparency const OdCmTransparency OdDbObjectId::kNull
static

The null ObjectId object.

Definition at line 110 of file DbObjectId.h.

◆ m_Id

OdDbStub* OdDbObjectId::m_Id
protected

Definition at line 330 of file DbObjectId.h.


The documentation for this class was generated from the following files: