Share

AcDbAssocObjectPointer Template

Class Hierarchy

AcDbAssocObjectPointer

C++

template <class ACDB_CLASS>
class AcDbAssocObjectPointer;

File

AcDbAssocObjectPointer.h

Description

When an action is being evaluated and needs to use or modify an existing object it has a dependency on, the client code is given an option to control which object the action is actually going to use or modify. The client code can provide a substitute object instead of the original object by implementing the AcDbAssocEvaluationCallback::beginActionEvaluationUsingObject() callback method. This way the action evaluation can be redirected to use or modify another object (see the comments at the AcDbAssocEvaluationCallback class).

The AcDbAssocObjectPointer template class, modeled after the AcDbObjectPointer template class, simplifies the client action evaluation code that needs to respect this possible redirection. The AcDbAssocObjectPointer constructor automatically calls the AcDbAssocEvaluationCallback::beginActionEvaluationUsingObject() method and the destructor calls the AcDbAssocEvaluationCallback::endActionEvaluationUsingObject() method.

All the client code needs to do is to use this template class and then use the AcDbObject pointer this template class provides. The pointer will point either to the original database-resident object whose AcDbObjectId has been provided, or to a substitute object, if the evaluation is in progress and the client evaluation callback provided a substitute object.

There are several overloaded constructors that simplify the usage of this class from an AcDbAssocAction, AcDbAssocActionBody, AcDbAssocDependency or

AcDbAssocDependencyBody.

There are also constructors that take ACDB_CLASS*. They can be used to pass the given ACDB_CLASS* object to the client callback code. The constructor calls AcDbAssocEvaluationCallback::beginActionEvaluationUsingObject() callback method, passing null AcDbObjectId and passing the given ACDB_CLASS* object as the pSubstituteObject argument. The callback method should then treat this argument as an input agrument, i.e., it should not change it. The destructor calls the AcDbAssocEvaluationCallback::endActionEvaluationUsingObject() callback method, passing NULL for AcDbObjectId and passing the given ACDB_CLASS* object as the pObject argument.

Links

AcDbAssocObjectPointer Constructor, AcDbAssocObjectPointer Methods, AcDbAssocObjectPointer Operators

Was this information helpful?