CFx SDK Documentation  2023 SP0
Public Types | Public Member Functions | Protected Member Functions | List of all members
OdDbDictionary Class Reference

#include <DbDictionary.h>

Inheritance diagram for OdDbDictionary:
OdDbObject OdGiDrawable OdRxObject OdDbDictionaryWithDefault

Public Types

enum  { kMaxSuggestNameSize = 2049 }
 
- Public Types inherited from OdGiDrawable
enum  SetAttributesFlags {
  kDrawableNone = 0 , kDrawableIsAnEntity = 1 , kDrawableUsesNesting = 2 , kDrawableIsCompoundObject = 4 ,
  kDrawableViewIndependentViewportDraw = 8 , kDrawableIsInvisible = 16 , kDrawableHasAttributes = 32 , kDrawableRegenTypeDependantGeometry = 64 ,
  kDrawableIsDimension = (kDrawableIsAnEntity + kDrawableIsCompoundObject + 128) , kDrawableRegenDraw = 256 , kDrawableStandardDisplaySingleLOD = 512 , kDrawableShadedDisplaySingleLOD = 1024 ,
  kDrawableViewDependentViewportDraw = 2048 , kDrawableBlockDependentViewportDraw = 4096 , kDrawableIsExternalReference = 8192 , kDrawableNotPlottable = 16384 ,
  kLastFlag = kDrawableNotPlottable
}
 
enum  DrawableType {
  kGeometry = 0 , kDistantLight = 1 , kPointLight = 2 , kSpotLight = 3 ,
  kAmbientLight , kSolidBackground , kGradientBackground , kImageBackground ,
  kGroundPlaneBackground , kViewport , kWebLight , kSkyBackground ,
  kImageBasedLightingBackground
}
 

Public Member Functions

OdDbObjectPtr getAt (const OdString &name, OdDb::OpenMode mode) const
 
OdDbObjectId getAt (const OdString &name, OdResult *pStatus=0) const
 
OdString nameAt (const OdDbObjectId &objectId) const
 
bool has (const OdString &name) const
 
bool has (const OdDbObjectId &objectId) const
 
OdUInt32 numEntries () const
 
OdDbObjectId remove (const OdString &name)
 
void remove (const OdDbObjectId &objectId)
 
bool setName (const OdString &oldName, const OdString &newName)
 
OdDbObjectId setAt (const OdString &name, OdDbObject *newValue)
 
bool isTreatElementsAsHard () const
 
void setTreatElementsAsHard (bool doIt)
 
OdDbDictionaryIteratorPtr newIterator (OdRx::DictIterType iterType=OdRx::kDictCollated) const
 
OdString suggestName (const OdString &strFilePath, const int nMaxLength=kMaxSuggestNameSize) const
 
virtual OdResult dwgInFields (OdDbDwgFiler *pFiler)
 
virtual void dwgOutFields (OdDbDwgFiler *pFiler) const
 
virtual OdResult dxfInFields (OdDbDxfFiler *pFiler)
 
virtual void dxfOutFields (OdDbDxfFiler *pFiler) const
 
virtual OdDb::DuplicateRecordCloning mergeStyle () const
 
virtual void setMergeStyle (OdDb::DuplicateRecordCloning mergeStyle)
 
virtual void goodbye (const OdDbObject *pObject)
 
virtual void erased (const OdDbObject *pObject, bool erasing=true)
 
virtual OdResult subGetClassID (void *pClsid) const
 
virtual void applyPartialUndo (OdDbDwgFiler *pFiler, OdRxClass *pClass)
 
virtual void subClose ()
 
- Public Member Functions inherited from OdDbObject
 ODDB_DECLARE_MEMBERS (OdDbObject)
 
 ~OdDbObject ()
 
void addRef ()
 
void release ()
 
long numRefs () const
 
OdDbObjectId objectId () const
 
OdDbHandle getDbHandle () const
 
OdDbHandle handle () const
 
OdDbObjectId ownerId () const
 
virtual void setOwnerId (OdDbObjectId ownerId)
 
OdDbDatabasedatabase () const
 
void createExtensionDictionary ()
 
OdDbObjectId extensionDictionary () const
 
bool releaseExtensionDictionary ()
 
OdDbXrecordPtr createXrecord (const OdString &xrecordName, OdDb::DuplicateRecordCloning style=OdDb::kDrcIgnore)
 
void upgradeOpen ()
 
void downgradeOpen ()
 
void cancel ()
 
virtual OdResult subOpen (OdDb::OpenMode mode)
 
OdResult erase (bool eraseIt=true)
 
virtual OdResult subErase (bool erasing)
 
void handOverTo (OdDbObject *pNewObject, bool keepXData=true, bool keepExtDict=true)
 
virtual void subHandOverTo (OdDbObject *pNewObject)
 
void swapIdWith (OdDbObjectId otherId, bool swapXdata=false, bool swapExtDict=false)
 
virtual void subSwapIdWith (const OdDbObjectId &otherId, bool swapXdata=false, bool swapExtDict=false)
 
virtual void audit (OdDbAuditInfo *pAuditInfo)
 
void dwgIn (OdDbDwgFiler *pFiler)
 
void dwgOut (OdDbDwgFiler *pFiler) const
 
virtual OdResult dxfIn (OdDbDxfFiler *pFiler)
 
virtual void dxfOut (OdDbDxfFiler *pFiler) const
 
virtual OdResult dxfInFields_R12 (OdDbDxfFiler *pFiler)
 
virtual void dxfOutFields_R12 (OdDbDxfFiler *pFiler) const
 
virtual OdResBufPtr xData (const OdString &regappName=OdString::kEmpty) const
 
virtual void setXData (const OdResBuf *pRb)
 
bool isEraseStatusToggled () const
 
bool isErased () const
 
bool isReadEnabled () const
 
bool isWriteEnabled () const
 
bool isNotifyEnabled () const
 
bool isModified () const
 
bool isModifiedXData () const
 
bool isModifiedGraphics () const
 
bool isNewObject () const
 
bool isNotifying () const
 
bool isUndoing () const
 
bool isReallyClosing () const
 
bool isDBRO () const
 
void assertReadEnabled () const
 
void assertWriteEnabled (bool autoUndo=true, bool recordModified=true)
 
void assertNotifyEnabled () const
 
void disableUndoRecording (bool disable)
 
bool isUndoRecordingDisabled () const
 
OdDbDwgFilerundoFiler ()
 
void addReactor (OdDbObjectReactor *pReactor) const
 
void removeReactor (OdDbObjectReactor *pReactor) const
 
virtual void addPersistentReactor (const OdDbObjectId &objId)
 
virtual void removePersistentReactor (const OdDbObjectId &objId)
 
bool hasPersistentReactor (const OdDbObjectId &objId) const
 
OdDbObjectIdArray getPersistentReactors () const
 
OdDbObjectReactorArray getTransientReactors () const
 
virtual void recvPropagateModify (const OdDbObject *pSubObj)
 
virtual void xmitPropagateModify () const
 
ODRX_SEALED_VIRTUAL OdDbObjectPtr deepClone (OdDbIdMapping &ownerIdMap, OdDbObject *pOwner, bool bPrimary=true) const ODRX_SEALED
 
ODRX_SEALED_VIRTUAL OdDbObjectPtr wblockClone (OdDbIdMapping &ownerIdMap, OdDbObject *pOwner, bool bPrimary=true) const ODRX_SEALED
 
virtual void appendToOwner (OdDbIdPair &idPair, OdDbObject *pOwnerObject, OdDbIdMapping &ownerIdMap)
 
void setOdDbObjectIdsInFlux ()
 
bool isOdDbObjectIdsInFlux () const
 
virtual void copied (const OdDbObject *pObject, const OdDbObject *pNewObject)
 
virtual void openedForModify (const OdDbObject *pObject)
 
virtual void modified (const OdDbObject *pObject)
 
virtual void subObjModified (const OdDbObject *pObject, const OdDbObject *pSubObj)
 
virtual void modifyUndone (const OdDbObject *pObject)
 
virtual void modifiedXData (const OdDbObject *pObject)
 
virtual void unappended (const OdDbObject *pObject)
 
virtual void reappended (const OdDbObject *pObject)
 
bool isAProxy () const
 
virtual void objectClosed (const OdDbObjectId &objectId)
 
virtual void modifiedGraphics (const OdDbObject *pObject)
 
virtual void copyFrom (const OdRxObject *pSource)
 
bool hasSaveVersionOverride () const
 
void setHasSaveVersionOverride (bool hasSaveVersionOverride)
 
virtual OdDb::DwgVersion getObjectSaveVersion (const OdDbFiler *pFiler, OdDb::MaintReleaseVer *pMaintVer=0) const
 
virtual OdDbObjectPtr decomposeForSave (OdDb::DwgVersion ver, OdDbObjectId &replaceId, bool &exchangeXData)
 
virtual OdDbObjectPtr decomposeForSave (OdDb::SaveType format, OdDb::DwgVersion ver, OdDbObjectId &replaceId, bool &exchangeXData)
 
void convertForSave (OdDb::DwgVersion ver)
 
virtual void composeForLoad (OdDb::SaveType format, OdDb::DwgVersion version, OdDbAuditInfo *pAuditInfo)
 
virtual OdGiDrawabledrawable ()
 
virtual OdUInt32 subSetAttributes (OdGiDrawableTraits *pTraits) const
 
virtual bool subWorldDraw (OdGiWorldDraw *pWd) const
 
virtual void subViewportDraw (OdGiViewportDraw *pVd) const
 
virtual bool isPersistent () const
 
virtual OdDbStub * id () const
 
ODRX_SEALED_VIRTUAL OdResult getClassID (void *pClsid) const ODRX_SEALED
 
void setGsNode (OdGsCache *pNode)
 
OdGsCachegsNode () const
 
void xDataTransformBy (const OdGeMatrix3d &xfm)
 
bool hasFields () const
 
OdDbObjectId getField (const OdString &fieldName) const
 
OdDbObjectPtr getField (const OdString &fieldName, OdDb::OpenMode mode) const
 
virtual OdDbObjectId setField (const OdString &fieldName, OdDbField *pField)
 
virtual OdResult removeField (OdDbObjectId fieldId)
 
virtual OdDbObjectId removeField (const OdString &fieldName)
 
OdDbObjectId getFieldDictionary () const
 
OdDbObjectPtr getFieldDictionary (OdDb::OpenMode mode) const
 
virtual OdRxClasssaveAsClass (OdRxClass *pClass) const
 
- Public Member Functions inherited from OdGiDrawable
 ODRX_DECLARE_MEMBERS (OdGiDrawable)
 
virtual DrawableType drawableType () const
 
ODRX_SEALED_VIRTUAL OdUInt32 setAttributes (OdGiDrawableTraits *pTraits) const ODRX_SEALED
 
ODRX_SEALED_VIRTUAL bool worldDraw (OdGiWorldDraw *pWd) const ODRX_SEALED
 
ODRX_SEALED_VIRTUAL void viewportDraw (OdGiViewportDraw *pVd) const ODRX_SEALED
 
ODRX_SEALED_VIRTUAL OdUInt32 viewportDrawLogicalFlags (OdGiViewportDraw *pVd) const ODRX_SEALED
 
virtual OdResult getGeomExtents (OdGeExtents3d &extents) const
 
ODRX_SEALED_VIRTUAL OdUInt32 regenSupportFlags () const ODRX_SEALED
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Protected Member Functions

 OdDbDictionary ()
 
- Protected Member Functions inherited from OdDbObject
 OdDbObject ()
 
virtual OdDbObjectPtr subDeepClone (OdDbIdMapping &ownerIdMap, OdDbObject *pOwner, bool bPrimary) const
 
virtual OdDbObjectPtr subWblockClone (OdDbIdMapping &ownerIdMap, OdDbObject *pOwner, bool bPrimary) const
 
- Protected Member Functions inherited from OdGiDrawable
 OdGiDrawable ()
 
virtual OdUInt32 subViewportDrawLogicalFlags (OdGiViewportDraw *vd) const
 
virtual OdUInt32 subRegenSupportFlags () const
 

Additional Inherited Members

- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 
- Protected Attributes inherited from OdDbObject
OdDbObjectImplm_pImpl
 

Detailed Description

This class implements database -resident object dictionaries.

Remarks

Each instance of OdDbDictionary is a single container object, in which entries are searched, added, modified, and deleted.
Each OdDbDictionary entry associates a unique name (key) string with a unique OdDbObject. Anonymous names are signified by specifying a name starting with an asterisk; e.g., *U. A unique name (also starting with an asterisk) will be constructed for the entry. Entry names honor the rules of Symbol names: Names may be any length. Names are case-insensitve. Names may not contain any of the following characters: | * \ : ; < > ? " , equals.

See also
OdDbDictionaryIterator

Corresponding C++ library: TD_Db

<group OdDb_Classes>

Definition at line 134 of file DbDictionary.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kMaxSuggestNameSize 

Definition at line 299 of file DbDictionary.h.

Constructor & Destructor Documentation

◆ OdDbDictionary()

OdDbDictionary::OdDbDictionary ( )
protected

Member Function Documentation

◆ applyPartialUndo()

virtual void OdDbDictionary::applyPartialUndo ( OdDbDwgFiler pUndoFiler,
OdRxClass pClassObj 
)
virtual

Notification function called each time an Undo operation is performed this object is using partial Undo.

Parameters
pUndoFiler[in] A pointer to the undo filer with the partial undo information.
pClassObj[in] A pointer to the OdRxClass object for the class that will handle the Undo.
Remarks
An object indicates it's using the partial undo mechanism, if and only if it has set autoUndo false in all calls to assertWriteEnabled().

This member function must know which types of fields to scan, and must stop after reading what it it needs.

If the class type specified by pClassObj does not matches the class of this object, this member function must call the parent class's applyPartialUndo() and return whatever it returns.

If it does match the class of this object, this member function must use pUndoFiler to read the undo data, then typically use this object's set() method.

Throws:

Cause eNotThatKindOfClass pClassObj != OdDbObject::desc()

Reimplemented from OdDbObject.

◆ dwgInFields()

virtual OdResult OdDbDictionary::dwgInFields ( OdDbDwgFiler pFiler)
virtual

Reads the .dwg file data of this object.

Parameters
pFiler[in] Filer object from which data are read.
Returns
Returns the filer status.

This function is called by dwgIn() to allow the object to read its data.

When overriding this function:

1) Call assertWriteEnabled(). 2) Call the parent class's dwgInFields(pFiler). 3) If it returns eOK, continue; otherwise return whatever the parent's dwgInFields(pFiler) returned. 4) Call the OdDbDwgFiler(pFiler) methods to read each of the object's data items in the order they were written. 5) Return pFiler->filerStatus().

Reimplemented from OdDbObject.

Reimplemented in OdDbDictionaryWithDefault.

◆ dwgOutFields()

virtual void OdDbDictionary::dwgOutFields ( OdDbDwgFiler pFiler) const
virtual

Writes the .dwg file data of this object.

Parameters
pFiler[in] Pointer to the filer to which data are written.
Remarks

This function is called by dwgIn() to allow the object to write its data.

When overriding this function:

1) Call assertReadEnabled(). 2) Call the parent class's dwgOutFields(pFiler). 3) Call the OdDbDwgFiler(pFiler) methods to write each of the object's data items in the order they were written.

Reimplemented from OdDbObject.

Reimplemented in OdDbDictionaryWithDefault.

◆ dxfInFields()

virtual OdResult OdDbDictionary::dxfInFields ( OdDbDxfFiler pFiler)
virtual

Reads the DXF data of this object.

Parameters
pFiler[in] Pointer to the filer from which data are read.
Returns
Returns the filer status.

This function is called by dxfIn() to allow the object to read its data.

When overriding this function:

1) Call assertWriteEnabled(). 2) Call the parent class's dwgInFields(pFiler). 3) If it returns eOK, continue; otherwise return whatever the parent's dxfInFields(pFiler) returned. 4) Call the OdDbDxfFiler(pFiler) methods to read each of the object's data items in the order they were written. 5) Return pFiler->filerStatus().

Reimplemented from OdDbObject.

Reimplemented in OdDbDictionaryWithDefault.

◆ dxfOutFields()

virtual void OdDbDictionary::dxfOutFields ( OdDbDxfFiler pFiler) const
virtual

Writes the DXF data of this object.

Parameters
pFiler[in] Pointer to the filer to which data are to be written.
Remarks

This function is called by dxfOut() to allow the object to write its data.

When overriding this function:

1) Call assertReadEnabled(). 2) Call the parent class's dxfOutFields(pFiler). 4) Use pFiler to call the OdDbDxfFiler methods to write each of the object's data items in the order they were written.

Reimplemented from OdDbObject.

Reimplemented in OdDbDictionaryWithDefault.

◆ erased()

virtual void OdDbDictionary::erased ( const OdDbObject pObject,
bool  erasing = true 
)
virtual

Notification function called whenever an object has been erased or unerased.

Parameters
pObject[in] Pointer to the object that was erased/unerased.
erasing[in] True if and only if this object is being erased.
Remarks
The default implementation of this function does nothing. This function can be overridden in custom classes.

Reimplemented from OdDbObject.

◆ getAt() [1/2]

OdDbObjectPtr OdDbDictionary::getAt ( const OdString name,
OdDb::OpenMode  mode 
) const

Returns the OdDbObject associated with the specified name (key) in this Dictionary object.

Parameters
name[in] Entry name.
mode[in] Mode in which to open the object.
Remarks
Opens the associated OdDbObject in the specified mode.

Returns a null SmartPointer if the specified entry could not be opened.

◆ getAt() [2/2]

OdDbObjectId OdDbDictionary::getAt ( const OdString name,
OdResult pStatus = 0 
) const

Returns the OdDbObject associated with the specified name (key) in this Dictionary object.

Parameters
name[in] Entry name.
pStatus[out] Receives eOk if successful, or an appropriate error code if not.
Remarks
Opens the associated OdDbObject in the specified mode.

Returns a null Object ID if the specified entry could not be opened.

◆ goodbye()

virtual void OdDbDictionary::goodbye ( const OdDbObject pObject)
virtual

Notification function called just before an object is deleted from memory.

Parameters
pObject[in] Pointer to the object that is being deleted.
Remarks
An object is deleted when its reference count reaches 0.

The default implementation of this function does nothing. This function can be overridden in custom classes.

Reimplemented from OdDbObject.

◆ has() [1/2]

bool OdDbDictionary::has ( const OdDbObjectId objectId) const

Returns true if and only if this Dictionary object has an entry with the specified Object ID.

Parameters
objectId[in] Object ID.

◆ has() [2/2]

bool OdDbDictionary::has ( const OdString name) const

Returns true if and only if this Dictionary object has an entry with the specified name (key).

Parameters
name[in] Entry name.

◆ isTreatElementsAsHard()

bool OdDbDictionary::isTreatElementsAsHard ( ) const

Returns true if and only if this Dictionary object is the hard owner of its elements.

Remarks
Hard ownership protects the elements from purge. Soft ownership does not.

◆ mergeStyle()

virtual OdDb::DuplicateRecordCloning OdDbDictionary::mergeStyle ( ) const
virtual

Returns the merge style for this dictionary object.

Reimplemented from OdDbObject.

◆ nameAt()

OdString OdDbDictionary::nameAt ( const OdDbObjectId objectId) const

Returns the entry name (key) of the specified object in this Dictionary object.

Parameters
objectId[in] Object ID.
Remarks
Returns an empty string if objectId is not in this Dictionary object.

◆ newIterator()

OdDbDictionaryIteratorPtr OdDbDictionary::newIterator ( OdRx::DictIterType  iterType = OdRx::kDictCollated) const

Returns a new interator that can be used to traverse the entries in this Dictionary object.

Parameters
iterType[in] Type of Iterator.
Remarks
The Iterator type can be one of the following:

Description OdRx::kDictCollated Traverses the entries in the order they were added to the dictionary. OdRx::kDictSorted Traverses the entries in alphabetical order by key value.

◆ numEntries()

OdUInt32 OdDbDictionary::numEntries ( ) const

Returns the number of entries in this Dictionary object.

◆ remove() [1/2]

void OdDbDictionary::remove ( const OdDbObjectId objectId)

Removes the entry with the specified Object ID from this Dictionary object, and returns the Object ID of the removed entry.

Parameters
name[in] Entry name.
objectId[in] Object ID.
Remarks
Only the dictionary entry is removed; the associated object remains in the database without an owner. The dictionary is removed as a persistent reactor on the associated object.

◆ remove() [2/2]

OdDbObjectId OdDbDictionary::remove ( const OdString name)

Removes the entry with the specified name (key) from this Dictionary object, and returns the Object ID of the removed entry.

Parameters
name[in] Entry name.
Remarks
Only the dictionary entry is removed; the associated object remains in the database without an owner. The dictionary is removed as a persistent reactor on the associated object.

◆ setAt()

OdDbObjectId OdDbDictionary::setAt ( const OdString name,
OdDbObject newValue 
)

Sets the value for the specified entry in this Dictionary object.

Returns
Returns the Object ID of the newly added entry.

If an entry the specified name exists in the dictionary, it is erased, and a new entry created.

If an entry for this name does not exist in this dictionary, a new entry is created.

Parameters
name[in] Name of entry to be changed.
newValue[in] Database object to be added.

◆ setMergeStyle()

virtual void OdDbDictionary::setMergeStyle ( OdDb::DuplicateRecordCloning  mergeStyle)
virtual

Sets the merge style for this dictionary object.

Parameters
mergeStyle[in] Merge style.

◆ setName()

bool OdDbDictionary::setName ( const OdString oldName,
const OdString newName 
)

Changes the name (key) of the specified entry in this Dictionary object.

Parameters
oldName[in] Name of entry to change.
newName[in] New name for the entry.
Returns
Returns true and only if the entry name was successfully changed.

◆ setTreatElementsAsHard()

void OdDbDictionary::setTreatElementsAsHard ( bool  doIt)

Sets the hard ownership property for this Dictionary object.

Parameters
hard[in] Controls ownership.
Remarks
Hard ownership protects the elements from purge. Soft ownership does not.

◆ subClose()

virtual void OdDbDictionary::subClose ( )
virtual

Called as the first operation as this object is being closed, for database -resident objects only.

Remarks
This function is notified just before the current open operation is to be closed, giving this function the ability to perform necessary operatons.

When overriding this function:

1) If the OdDbObject's state is incorrect, throw exception.

2) Call parent class's subClose().

3) If other actions are required before close, do them.

The default implementation of this function does nothing. This function can be overridden in custom classes.

Reimplemented from OdDbObject.

◆ subGetClassID()

virtual OdResult OdDbDictionary::subGetClassID ( void pClsid) const
virtual

Reimplemented from OdDbObject.

◆ suggestName()

OdString OdDbDictionary::suggestName ( const OdString strFilePath,
const int  nMaxLength = kMaxSuggestNameSize 
) const

Returns a string suitable to be used as dictionary Key for this dictionary object. The string is unique for this dictionary object and is as close to file name as possible.

Parameters
strFilePath[in] File path.
nMaxLength[in] Maximum length of name generated.

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