/////////////////////////////////////////////////////////////////////////////// // 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 _DG_LONG_TRANSACTION_MANAGER_H_INCLUDED_ #define _DG_LONG_TRANSACTION_MANAGER_H_INCLUDED_ #include "RxObject.h" #include "DgElementIdArray.h" #include "TD_PackPush.h" class OdDgLongTransaction; class OdDgDatabase; class OdDgIdMapping; /** \details This class is used to access callbacks for long transactions. */ class TG_EXPORT OdDgApLongTransactionReactor : public OdRxObject { public: ODRX_DECLARE_MEMBERS(OdDgApLongTransactionReactor); OdDgApLongTransactionReactor(); /** \details This notification is fired at the start of OdDgApLongTransactionManager::checkOut(). \param lt [in] Long transaction that this notification refers to. \param originList [in, out] List of elements passed to OdDgApLongTransactionManager::checkOut(). Can be modified. */ virtual void beginCheckOut(OdDgLongTransaction& lt, OdDgElementIdArray& originList); /** \details This notification is fired at the end of OdDgApLongTransactionManager::checkOut(). */ virtual void endCheckOut(OdDgLongTransaction& lt); /** \details This notification is fired at the start of OdDgApLongTransactionManager::checkIn(). */ virtual void beginCheckIn(OdDgLongTransaction& lt); /** \details This notification is fired at the end of OdDgApLongTransactionManager::checkIn(). */ virtual void endCheckIn(OdDgLongTransaction& lt); /** \details This notification is fired before long transaction is aborted in case of any errors. */ virtual void abortLongTransaction(OdDgLongTransaction& lt); protected: /** \details You may call veto() from beginCheckOut() to abort transaction. */ OdResult veto(); private: bool m_Veto; friend class OdDgApLongTransactionManagerImpl; }; /** \details This class controls long transactions. \remarks There is one OdDgApLongTransactionManager object per application session. */ class ODRX_ABSTRACT TG_EXPORT OdDgApLongTransactionManager : public OdRxObject { public: ODRX_DECLARE_MEMBERS(OdDgApLongTransactionManager); /** \details Generates a new long transaction and clones elements from the specified list. \param transID [out] Receives the element ID of the new long transaction. \param elementList [in] List/array of elements (in the same block) to check out. \param toModel [in] Element ID of the model to which the elements will be cloned. \param errorMap [out] Receives an empty mapping object. \param idLockBlkRefPath [in] Element ID path to the block reference (reference attachment or shared cell reference). \param uViewNumber [in] Number of view to apply level mask to reference attachment. */ virtual OdResult checkOut(OdDgElementId& transId, OdDgElementIdArray& elementList, OdDgElementId toModel, OdDgIdMapping& errorMap, const OdDgElementIdArray& idLockBlkRefPath, const OdDgElementId& idBaseView) = 0; /** \details Checks in a long transaction that was previously checked out. \param transID [in] Element ID of the long transaction. \param errorMap [out] Receives an empty mapping object. \param keepObjs [in] Boolean value indicating whether to keep workset elements. */ virtual OdResult checkIn(OdDgElementId transId, OdDgIdMapping& errorMap, bool keepObjs = false) = 0; /** \details Terminates a long transaction during or in between checkin and checkout. \param transID [in] Element ID of the long transaction. \param keepObjs [in] Boolean value indicating whether to keep cloned elements. */ virtual OdResult abortLongTransaction(OdDgElementId transId, bool keepObjs = false) = 0; virtual OdDgElementId currentLongTransactionFor(const OdDgDatabase* pDb) const = 0; /** \details Adds the specified reactor to this element's reactor list. */ virtual void addReactor(OdDgApLongTransactionReactor* pReactor) = 0; /** \details Deletes the specified reactor from this element's reactor list. */ virtual void removeReactor(OdDgApLongTransactionReactor* pReactor) = 0; /** \details Adds the class of the specified OdRxClass object to the class filter. */ virtual OdResult addClassFilter (OdRxClass* pCls) = 0; /** \details Returns True if the class of the specified OdRxClass object is in the class filter. */ virtual bool isFiltered (OdRxClass* pCls) const = 0; }; extern TG_EXPORT OdDgApLongTransactionManager* getOdDgApLongTransactionManager(); #include "TD_PackPop.h" #endif // _DG_LONG_TRANSACTION_MANAGER_H_INCLUDED_