Public Member Functions | List of all members
ElementRefBase Struct Referenceabstract

Interface that provides direct and efficient access to element data. More...

#include <ElementRefBase.h>

Inheritance diagram for ElementRefBase:
PersistentElementRef

Public Member Functions

DGNPLATFORM_EXPORT ElementRefP GetParentElementRef ()
 Get the immediate parent of this ElementRefP. Will return NULL for non-complex elements. More...
 
DGNPLATFORM_EXPORT DgnModelP GetDgnModelP ()
 Get the DgnModel holding this ElementRefP. More...
 
DGNPLATFORM_EXPORT DependentElm * GetFirstDependent ()
 Get the first dependent of this ElementRefP, or NULL if there are no dependent elements. More...
 
DGNPLATFORM_EXPORT int GetDependents (ElementRefP *depRefs, int maxDependents)
 Get a list of all dependents of this ElementRefP. More...
 
DGNPLATFORM_EXPORT bool IsDependent (ElementRefP isThisDependent, bool recurse)
 Determine whether another ElementRefP is dependent on this ElementRefP (or, optionally, on any elements that are dependent on this ElementRefP.) More...
 
DGNPLATFORM_EXPORT ElementId GetElementId () const
 Get the ElementId of the element held by this ElementRefP. More...
 
DGNPLATFORM_EXPORT int GetElementType () const
 Get the element type of the element held by this ElementRefP. More...
 
DGNPLATFORM_EXPORT UInt32 GetLevel () const
 Get the level of the element held by this ElementRefP. More...
 
DGNPLATFORM_EXPORT T_Adouble GetLastModified () const
 Get the last modified time of the element held by this ElementRefP. More...
 
DGNPLATFORM_EXPORT bool IsComplexComponent () const
 Determine whether the element held by this ElementRefP is a complex component. More...
 
DGNPLATFORM_EXPORT bool IsGraphics () const
 Determine whether the element held by this ElementRefP is a Graphic element. More...
 
DGNPLATFORM_EXPORT ElementRefP ValidateElementRef ()
 Determine whether this ElementRefP is still valid and, if not, attempt to return the valid ElementRefP for the element. More...
 
ElementRefAppData Management
DGNPLATFORM_EXPORT HeapZoneR GetHeapZone ()
 Get the HeapZone for the DgnModel holding this ElementRefP. More...
 
DGNPLATFORM_EXPORT StatusInt AddAppData (ElementRefAppData::Key const &key, ElementRefAppData *appData, HeapZoneR heapZone, bool allowOnDeleted=false)
 Add Application Data to this ElementRefP. More...
 
DGNPLATFORM_EXPORT StatusInt DropAppData (ElementRefAppData::Key const &key)
 Drop Application data from this ElementRefP. More...
 
DGNPLATFORM_EXPORT
ElementRefAppData
FindAppData (ElementRefAppData::Key const &key)
 Find ElementRefAppData on this ElementRefP by key. More...
 

Detailed Description

Interface that provides direct and efficient access to element data.

ElementRefP's are unique-within-a-session references (pointers) to the read-only element data that holds the current state of an element. Normally refers to a persistent element in a DgnModel, but can also be used to refer to a temporary element or transient.

Remarks
Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib

Member Function Documentation

DGNPLATFORM_EXPORT StatusInt AddAppData ( ElementRefAppData::Key const &  key,
ElementRefAppData appData,
HeapZoneR  heapZone,
bool  allowOnDeleted = false 
)

Add Application Data to this ElementRefP.

Parameters
[in]keyThe AppData's key. If an ElementRefAppData with this key already exists on this ElementRefP, it is dropped and replaced with appData.
[in]appDataThe appData object to attach to this ElementRefP.
[in]heapZoneHeapZone for this ElementRefP. Must be the HeapZone returned by GetHeapZone.
[in]allowOnDeletedif false (the default), this method will reject adds if the ElementRef is deleted.
DGNPLATFORM_EXPORT StatusInt DropAppData ( ElementRefAppData::Key const &  key)

Drop Application data from this ElementRefP.

Parameters
[in]keythe key for the ElementRefAppData to drop.
Returns
SUCCESS if an entry with key is found and dropped.

Find ElementRefAppData on this ElementRefP by key.

Parameters
[in]keyThe key for the ElementRefAppData of interest.
Returns
the ElementRefAppData for key key, or NULL.
DGNPLATFORM_EXPORT int GetDependents ( ElementRefP depRefs,
int  maxDependents 
)

Get a list of all dependents of this ElementRefP.

Parameters
[out]depRefsarray of dependent ElementRefs.
[in]maxDependentsmaximum number of entries to return in depRef.
Returns
The actual number of dependents retuned in depRefs.
DGNPLATFORM_EXPORT DgnModelP GetDgnModelP ( )

Get the DgnModel holding this ElementRefP.

Note
Some types of ElementRefs are not in any DgnModel, and this function will return NULL.
DGNPLATFORM_EXPORT ElementId GetElementId ( ) const

Get the ElementId of the element held by this ElementRefP.

DGNPLATFORM_EXPORT int GetElementType ( ) const

Get the element type of the element held by this ElementRefP.

DGNPLATFORM_EXPORT DependentElm* GetFirstDependent ( )

Get the first dependent of this ElementRefP, or NULL if there are no dependent elements.

DGNPLATFORM_EXPORT HeapZoneR GetHeapZone ( )

Get the HeapZone for the DgnModel holding this ElementRefP.

DGNPLATFORM_EXPORT T_Adouble GetLastModified ( ) const

Get the last modified time of the element held by this ElementRefP.

DGNPLATFORM_EXPORT UInt32 GetLevel ( ) const

Get the level of the element held by this ElementRefP.

DGNPLATFORM_EXPORT ElementRefP GetParentElementRef ( )

Get the immediate parent of this ElementRefP. Will return NULL for non-complex elements.

DGNPLATFORM_EXPORT bool IsComplexComponent ( ) const

Determine whether the element held by this ElementRefP is a complex component.

DGNPLATFORM_EXPORT bool IsDependent ( ElementRefP  isThisDependent,
bool  recurse 
)

Determine whether another ElementRefP is dependent on this ElementRefP (or, optionally, on any elements that are dependent on this ElementRefP.)

Parameters
[in]isThisDependentOther element to test.
[in]recurseIf true, test whether isThisDependent is directly or indirectly depenent on this ElementRefP.
DGNPLATFORM_EXPORT bool IsGraphics ( ) const

Determine whether the element held by this ElementRefP is a Graphic element.

DGNPLATFORM_EXPORT ElementRefP ValidateElementRef ( )

Determine whether this ElementRefP is still valid and, if not, attempt to return the valid ElementRefP for the element.

In certain (fairly rare) cases when elements are rewritten to their DgnModel, their ElementRefP can change. In that case, the old ElementRefP remains in the DgnModel, but becomes "invalid". [N.B. The reason the old ElementRefP remains is that if the transaction is reversed (undone), the old ElementRefP becomes valid again.] Call this method to get the "current" valid ElementRefP for a known previously-valid ElementRefP. If the element has moved, it uses the ElementId to find the valid ElementRefP.

Returns
The valid ElementRefP for this element. In the common case where the element has not been moved to a new ElementRefP, this method will return itself. If the element or DgnModel has been deleted, this method will return NULL.
Note
It can be somewhat tricky to hold ElementRefs across undo/redo boundaries. You must be aware that for newly created elements, ElementRefs can be abandoned and/or reused after the transaction in which they were born is reversed (undone) and then not immediately reinstated (redone).

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

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.