lngtrans.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // DESCRIPTION: Header for Long Transaction Manager.
  12. //
  13. //////////////////////////////////////////////////////////////////////////////
  14. #ifndef _LTRANSMAN_H
  15. #define _LTRANSMAN_H
  16. #include "rxnames.h"
  17. #include "dbidar.h"
  18. #pragma pack (push, 8)
  19. class AcDbLongTransaction;
  20. class AcDbDatabase;
  21. class AcDbIdMapping;
  22. class AcApDocument;
  23. #define AC_LONG_TRANSACTION_MANAGER_OBJ _T("AcApLongTransactionManager")
  24. class AcApLongTransactionReactor: public AcRxObject
  25. {
  26. public:
  27. ACRX_DECLARE_MEMBERS(AcApLongTransactionReactor);
  28. // To identify and connect this notification with the deepClone
  29. // notifications, AcDbLongTransactionWorkSet::activeIdMap()
  30. // will return the cloning idMap. CheckOut and CheckIn, for
  31. // the same transaction, will use different maps.
  32. //
  33. virtual void beginCheckOut (AcDbLongTransaction& ,
  34. AcDbObjectIdArray& originList);
  35. virtual void endCheckOut (AcDbLongTransaction& );
  36. virtual void beginCheckIn (AcDbLongTransaction& );
  37. virtual void endCheckIn (AcDbLongTransaction& );
  38. virtual void abortLongTransaction (AcDbLongTransaction& );
  39. protected:
  40. Acad::ErrorStatus veto (); // beginCheckOut() can be vetoed
  41. private:
  42. Adesk::UInt8 mVeto;
  43. friend class AcApImpLongTransactionManager;
  44. };
  45. class AcApLongTransactionManager: public AcRxObject
  46. {
  47. public:
  48. ACRX_DECLARE_MEMBERS(AcApLongTransactionManager);
  49. virtual Acad::ErrorStatus checkOut(
  50. AcDbObjectId& transId,
  51. AcDbObjectIdArray& objList,
  52. AcDbObjectId toBlock,
  53. AcDbIdMapping& errorMap,
  54. AcDbObjectId lockBlkRef =
  55. AcDbObjectId::kNull) = 0;
  56. virtual Acad::ErrorStatus checkIn (
  57. AcDbObjectId transId,
  58. AcDbIdMapping& errorMap,
  59. bool keepObjs = false) = 0;
  60. virtual Acad::ErrorStatus abortLongTransaction(
  61. AcDbObjectId transId,
  62. bool keepObjs = false) = 0;
  63. virtual AcDbObjectId currentLongTransactionFor(
  64. const AcApDocument* pDoc) const = 0;
  65. virtual void addReactor(AcApLongTransactionReactor*) = 0;
  66. virtual void removeReactor(AcApLongTransactionReactor*) = 0;
  67. // For filtering classes out of Long Transactions
  68. //
  69. virtual Acad::ErrorStatus addClassFilter (AcRxClass* ) = 0;
  70. virtual bool isFiltered (AcRxClass* ) const = 0;
  71. };
  72. extern AcApLongTransactionManager* acapLongTransactionManagerPtr();
  73. #define acapLongTransactionManager acapLongTransactionManagerPtr()
  74. #pragma pack (pop)
  75. #endif // !_LTRANSMAN_H