/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef DbAssocActionBody_INCLUDED_ #define DbAssocActionBody_INCLUDED_ /*!DOM*/ #include "DbConstraintsExports.h" #include "DbObject.h" #include "DbAssocAction.h" #include "DbAssocDependency.h" #include "DbEntity.h" #include "PersSubentIdTypes.h" #include "TD_PackPush.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4100) #endif /** \details This class is abstract base class for deriving custom action body. Library: Source code provided. */ class DBCONSTRAINTS_EXPORT ODRX_ABSTRACT OdDbAssocActionBody : public OdDbObject { public: ODRX_DECLARE_MEMBERS(OdDbAssocActionBody); /** \details Constructor creates an instance of this class. */ OdDbAssocActionBody(); //explicit AcDbAssocActionBody(AcDbAssocCreateImpObject createImpObject = kAcDbAssocCreateImpObject); /** \details Destructor destroys an instance of this class. */ virtual ~OdDbAssocActionBody(); /** \details Returns an object ID of the parent action. */ OdDbObjectId parentAction() const { return ownerId(); } /** \details Returns the current status of this action. */ OdDbAssocStatus status() const; /** \details Sets the status for this action. */ OdResult setStatus(OdDbAssocStatus newStatus, bool notifyOwningNetwork = true, bool setInOwnedActions = false); /** \details Returns the logically owning association network, or kNull if it is the topmost. */ OdDbObjectId owningNetwork() const; /** \details Gets the dependencies of this action. The default implementation obtains all dependencies owned by the base action class. */ OdResult getDependencies(bool readDependenciesWanted, bool writeDependenciesWanted, OdDbObjectIdArray& dependencyIds) const; /** \details Adds a dependency for this action. The default implementation calls the corresponding method of the parent class that owns this action. */ OdResult addDependency(const OdDbObjectId& dependencyId, bool setThisActionAsOwningAction = true); /** \details Adds a dependency for this action. \param pCreateDepClass [in] dependency type to create. NULL means to create OdDbAssocDependency \param pCreateDepBodyClass [in] dependency body type to create. NULL means do not create dependency body \param read [in] set read type to dependency. \param write [in] set write type to dependency. \param order [in] order of the dependency. \param dependencyId [out] added dependency returned object id. */ OdResult addDependency(OdRxClass* pDependencyClass, OdRxClass* pDependencyBodyClass, bool isReadDep, bool isWriteDep, int order, OdDbObjectId& dependencyId); /** \details Removes a dependency from this action. */ OdResult removeDependency(const OdDbObjectId& dependencyId, bool alsoEraseIt); /** \details Clears all dependencies from this action. */ OdResult removeAllDependencies(bool alsoEraseThem); /** \details Evaluates those dependencies of the action that need to be evaluated by calling OdDbAssocDependency::evaluate(). Just a shortcut to OdDbAssocAction method. */ OdResult evaluateDependencies(); /** \details \returns true if the action has any dependency whose status is kErasedAssocStatus or whose dependent-on object cannot be opened. \remarks OdDbAssocValueDependency objects are ignored. */ bool hasAnyErasedOrBrokenDependencies() const; /** \details Checks whether the system is evaluating an action or a network of actions. */ bool isActionEvaluationInProgress() const; /** \details Returns the current association evaluation callback set instance, or NULL if no action evaluation is in progress. */ OdDbAssocEvaluationCallback* currentEvaluationCallback() const; /** \details Creates ODDbAssocAction and ODDbAssocActionBody of the required class, makes the action own the action body and posts both to the database of the given objectId. */ static OdResult createActionAndActionBodyAndPostToDatabase( OdRxClass* pActionBodyClass, const OdDbObjectId& objectId, OdDbObjectId& createdActionId, OdDbObjectId& createdActionBodyId); public: /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::evaluate() method). */ virtual void evaluateOverride() = 0; /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::getDependencies() method). \remarks Not implemented */ OdResult getDependenciesOverride(bool readDependenciesWanted, bool writeDependenciesWanted, OdDbObjectIdArray& dependencyIds) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::getDependentObjects() method). \remarks Not implemented */ OdResult getDependentObjectsOverride(bool readDependenciesWanted, bool writeDependenciesWanted, OdDbObjectIdArray& objectIds) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::removeAllDependencies() method). \remarks Not implemented */ virtual OdResult removeAllDependenciesOverride(bool alsoEraseThem) { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::isOwnedDependency() method). \remarks Not implemented */ virtual OdResult isOwnedDependencyOverride(const OdDbAssocDependency* pDependency, bool& isOwnedDependency) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::isExternalDependency() method). \remarks Not implemented */ virtual OdResult isExternalDependencyOverride(const OdDbAssocDependency* pDependency, bool& isExternalDependency) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::hasDependencyCachedValue() method). \remarks Not implemented */ virtual OdResult hasDependencyCachedValueOverride(const OdDbAssocDependency* pDependency, bool& hasDepCachedValue) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::isRelevantDependencyChange() method). \remarks Not implemented */ virtual OdResult isRelevantDependencyChangeOverride(const OdDbAssocDependency* pDependency, bool& isRelevantDepChange) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::areDependenciesOnTheSameThing() method). \remarks Not implemented */ virtual OdResult areDependenciesOnTheSameThingOverride(const OdDbAssocDependency* pDependency1, const OdDbAssocDependency* pDependency2, bool& areDependentOnSameThing) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::areDependenciesEqual() method). \remarks Not implemented */ virtual OdResult areDependenciesEqualOverride(const OdDbAssocDependency* pDependency1, const OdDbAssocDependency* pDependency2, bool& areEqual) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::evaluateDependency() method). \remarks Not implemented */ virtual OdResult evaluateDependencyOverride(OdDbAssocDependency* pDependency) { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::dependentObjectCloned() method). \remarks Not implemented */ virtual OdResult dependentObjectClonedOverride(const OdDbAssocDependency* pDependency, const OdDbObject* pDbObj, const OdDbObject* pNewObj); /** \details Method is called by the corresponding method of the parent action which owns this action body. \remarks Not implemented \sa */ virtual OdResult addMoreObjectsToDeepCloneOverride(OdDbIdMapping& idMap, OdDbObjectIdArray& additionalObjectsToClone) const; /** \details Method is called by the corresponding method of the parent action which owns this action body. \sa \remarks Not implemented */ virtual OdResult postProcessAfterDeepCloneOverride(OdDbIdMapping& idMap) { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::postProcessAfterDeepCloneCancel() method). \remarks Not implemented */ virtual OdResult postProcessAfterDeepCloneCancelOverride(OdDbIdMapping& idMap) { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::ownedDependencyStatusChanged() method). \remarks Not implemented */ virtual OdResult ownedDependencyStatusChangedOverride(OdDbAssocDependency* pOwnedDependency, OdDbAssocStatus previousStatus) { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::isEqualTo() method). \remarks Not implemented */ virtual OdResult isEqualToOverride(const OdDbAssocAction* pOtherAction, bool& isEqual) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::evaluationPriority() method). \remarks Not implemented */ virtual OdResult evaluationPriorityOverride(OdDbAssocEvaluationPriority& priority) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::getDependentActionsToEvaluate() method). \remarks Not implemented */ virtual OdResult getDependentActionsToEvaluateOverride(OdDbActionsToEvaluateCallback* pActionsToEvaluateCallback) const { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::transformActionBy() method). \remarks Not implemented */ virtual OdResult transformActionByOverride(const OdGeMatrix3d&) { return eNotImplemented; } /** \details Method is called by the corresponding method of the parent action which owns this action (see OdDbAssocAction::dragStatus() method). \remarks Not implemented */ virtual OdResult dragStatusOverride(const OdDb::DragStat status) { return eNotImplemented; } /** \details Reads the .dwg file data of this object. \param pFiler [in] Filer object from which data are read. \remarks Returns the filer status. */ virtual OdResult dwgInFields(OdDbDwgFiler* pFiler); /** \details Writes the .dwg file data of this object. \param pFiler [in] Pointer to the filer to which data are written. */ virtual void dwgOutFields(OdDbDwgFiler* pFiler) const; /** \details Reads the .dxf file data of this object. \param pFiler [in] Filer object from which data are read. \remarks Returns the filer status. */ virtual OdResult dxfInFields(OdDbDxfFiler* pFiler); /** \details Writes the .dxf file data of this object. \param pFiler [in] Pointer to the filer to which data are written. */ virtual void dxfOutFields(OdDbDxfFiler* pFiler) const; /** \details Just a shortcut to OdDbAssocAction method. */ OdResult getValueParam( const OdString& paramName, OdDbEvalVariant& value, OdString& expression, OdString& evaluatorId, int valueIndex = 0) const; /** \details Just a shortcut to OdDbAssocAction method. */ OdResult setValueParam( const OdString& paramName, const OdDbEvalVariant& value, const OdString& expression, const OdString& evaluatorId, OdString& errorMessage, bool silentMode, int valueIndex = 0); /** \details Just a shortcut to OdDbAssocAction method. */ OdDbObjectId paramAtName(const OdString& paramName, int index = 0) const; /** \details Just a shortcut to OdDbAssocAction method. */ OdValue::UnitType valueParamUnitType(const OdString& paramName) const; /** \details Just a shortcut to OdDbAssocAction method. */ OdResult setValueParamUnitType(const OdString& paramName, OdValue::UnitType unitType); /** \details Just a shortcut to OdDbAssocAction method. */ OdResult getValueParamArray(const OdString& paramName, OdArray& values, OdArray& expressions, OdArray& evaluatorIds) const; /** \details Just a shortcut to OdDbAssocAction method. */ OdResult setValueParamArray(const OdString& paramName, const OdArray& values, const OdStringArray& expressions, const OdStringArray& evaluatorIds, OdStringArray& errorMessages, bool silentMode = false); /** \details Just a shortcut to OdDbAssocAction method. */ OdResult addParam( const OdString& paramName, OdRxClass* pParamClass, OdDbObjectId& paramId, int& paramIndex); /** \details Just a shortcut to OdDbAssocAction method. */ OdResult addParam(const OdDbObjectId& paramId, int& paramIndex); /** \details Just a shortcut to OdDbAssocAction method. */ void ownedValueParamNames(OdStringArray& paramNames) const; virtual OdStringArray compareWith(const OdDbObjectId bodyIDToCompare, OdDb::DwgVersion filerVersion = OdDb::kDHL_CURRENT) const; /** details \param pObj [in] A pointer to object . bIgnoreInternalActions [in] A bIgnoreInternalActions flag. Not implemented. bIgnoreSuppressedActions [in] A bIgnoreSuppressedActions flag. Ignore suppressed actions. pWriteOnlyActionBodyId [in] An array of action bodies that have a write-only type. pReadWriteActionBodyIds [in] An array of action bodies that have a read and write type. pReadOnlyActionBodyIds [in] An array of action bodies that have a read-only type. \returns eOk - if successfull eNullObjectPointer - if pObj is a NULL pointer. \remarks Utility static method that returns all action bodies of all actions that have the requested type of dependencies on the given object. Notice that There may be no more than a single action that has a write-only dependency on the object, that is why the pWriteOnlyActionBodyId is a pointer to a single AcDbObjectId, not to an AcDbObjectIdArray. If any of the pointers are NULL, the type of action bodies are not returned. */ static OdResult getActionBodiesOnObject(const OdDbObject* pObj, bool bIgnoreInternalActions, bool bIgnoreSuppressedActions, OdDbObjectId* pWriteOnlyActionBodyId, OdDbObjectIdArray* pReadWriteActionBodyIds, OdDbObjectIdArray* pReadOnlyActionBodyIds = NULL); /** \details Audits the associative data callback. \param parentActionHandling [out] custom implementation may request parent action erasing by setting this parametr to kErasedAssocStatus or request parent action evaluation by setting it to kChangedDirectlyAssocStatus. \notes This callback function is called after drawing file open and may be overridden in custom implementation to handle broken associativity in some certain scenarious when the associative data may need to be audited and fixed. Custom code may also initialize internal cache that was not saved to drawing file, and/or do some other work at this time. System performs all overall general checks like a dependency depending on a non-existent object, checks that network, action, action body, action parameters and dependencies are properly linked between each-other, etc., so the custom code do not need to perform these general checks. An example of such scenario when associativity data need auditing is when dependent-on object was erased effectively and didn't send erase notification or notification from erased object was not processed because custom libriary was not loaded and this object was a proxy. Base implementation just delegates to impl class. */ virtual void auditAssociativeDataOverride(OdDbAssocStatus& parentActionHandling); /*!DOM*/ virtual void collectPersSubentNamingDataOverride(OdDbPersStepIdArray& stepIds, OdDbPersSubentIdArray& persSubentIds) const; /*!DOM*/ virtual void clonePersSubentNamingDataOverride(class OdDbAssocPersSubentManagerCloner* apsmc); protected: /*!DOM*/ void composeForLoad(OdDb::SaveType format, OdDb::DwgVersion version, OdDbAuditInfo* pAuditInfo); /*!DOM*/ friend class OdDbImpAssocAction; /*!DOM*/ friend class OdDbImpAssocArrayActionBody; /*!DOM*/ class OdDbImpAssocActionBody* m_pImpObj; }; #ifdef _MSC_VER #pragma warning (pop) #endif /** \details The typified smart pointer. This template class is specialization of the OdSmartPtr class for the OdDbAssocActionBody class. \sa */ typedef OdSmartPtr OdDbAssocActionBodyPtr; #include "TD_PackPop.h" #endif