Class Hierarchy
WritableAcDbObject
C++
class WritableAcDbObject;
File
dbobjptr2.h
Description
This class organizes matching calls to accessAcDbObjectForWrite and revertAcDbObjectFromWrite to ease their use. All the caller supplies is a reference to an AcDbObject pointer. If the pointer is non-null after the constructor, then it can be used for writing, and the object open state is reverted is closed when the instance destructor is invoked. enableNow can be used to defer write enabled status.
While existing internal callers are free to continue using this class, new callers are strongly encouraged to use AcDbSmartObjectPointer only.
Notes
The fundamental requirement for using AcDbSmartObjectPointer, ReadableAcDbObject, and WritableAcDbObject is that the open state cannot be different at the point when these classes initiate access to the object and terminate the access, usually in the constructors and destructors. Intervening logic can open the object, as long as it also closes it. Instances of AcDbSmartObjectPointer and/or ReadableAcDbObject and WritableAcDbObject can be nested arbitrarily, as long as the nested instances release the object in reverse order of acquiring it. Failure to adhere to this requirement will result in program error.
As long as the constructor/destructor or open/close calls on these classes are exclusively used, i.e. access management is automated, multiple instances of AcDbSmartObjectPointer, ReadableAcDbObject, and WritableAcDbObject that point to a common object id X are designed to have stacking lifespans of object access, i.e. the instance last created (or to open an object) MUST be the first one destroyed (or close the object or overwrite it with an acquire()-based member). This occurs naturally when they are declared in nested code or function blocks; which is how they are intended to be used.
Links
WritableAcDbObject Constructor, WritableAcDbObject Methods, WritableAcDbObject Operators
See Also
AcDbSmartObjectPointer, ReadableAcDbObject
History
AutoCAD 2023
Removed the "For Internal Use Only" disclaimer.