dbAuditRecreate.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. //
  13. #ifndef _AD_DBAUDITRECREATE_H
  14. #define _AD_DBAUDITRECREATE_H 1
  15. #include "acdb.h"
  16. /// <summary>
  17. /// AcDbAuditRecreatePE
  18. ///
  19. /// Defines Runtime Extension Protocol for audit-time object recreation
  20. ///
  21. /// The contract is rather simple, although the implementation may
  22. /// be less so. All 3 member functions are invoked from the AcDb
  23. /// library, in the context of RECOVER and/or AUDIT. The contract is:
  24. ///
  25. /// When an object of a given class is requested via
  26. /// AcDbAuditInfo::fetchObject, and is not valid, then
  27. /// first, the PE object's replace(...) member is invoked.
  28. /// if it returns eOk and a new instance of a class, then that
  29. /// instance is place in the original object id, and the repair is
  30. /// finished.
  31. ///
  32. /// If that fails, then the PE object's redirect(...) member
  33. /// is invoked. If it returns
  34. /// true, and then the new object id is entered into the
  35. /// indirect object lookup table.
  36. ///
  37. /// if redirect(...) returns false, then the object reference
  38. /// is no longer valid, and "NULL" is returned for a new object is.
  39. ///
  40. /// Instances of this class will be invoked from the Audit complex when
  41. /// an instance of a given class is to "recreated" because an original
  42. /// one is missing.
  43. /// </summary>
  44. class AcDbAuditRecreatePE : public AcRxObject
  45. {
  46. public:
  47. ACRX_DECLARE_MEMBERS(AcDbAuditRecreatePE);
  48. /// <summary>
  49. /// replace is invoked as the first step to create a
  50. /// replacement object for a missing or corrupted object.
  51. /// </summary>
  52. ///
  53. /// <param name="pNewObj">
  54. /// Reference to an AcDbObject pointer which, when true is
  55. /// returned, should represent a valid instance of the
  56. /// requested class, which will end up being bound to originalObjId.
  57. /// </param>
  58. ///
  59. /// <param name="originalObjId">
  60. /// The object id of the corrupted or missing object.
  61. /// </param>
  62. ///
  63. /// <param name="pObjClass">
  64. /// The anticipated class of the missing/corrupted object.
  65. /// </param>
  66. ///
  67. /// <param name="pDb">
  68. /// The database being recovered or audited.
  69. /// </param>
  70. ///
  71. /// <param name="pAuditInfo">
  72. /// The current audit state, including the entire indirect object
  73. /// table.
  74. /// </param>
  75. ///
  76. /// <returns>
  77. /// If it returns true, then pNewObj
  78. /// should be pointing to a valid object which will be bound to
  79. /// the input object id.
  80. /// If false is returned, then pNewObj should be ignored.
  81. /// </returns>
  82. ///
  83. /// <remarks>
  84. /// If false is returned, then the redirect member is invoked
  85. /// next.
  86. /// </remarks>
  87. ///
  88. virtual bool replace(AcDbObject*& pNewObj,
  89. AcDbObjectId originalObjId,
  90. AcRxClass* pObjClass,
  91. AcDbDatabase* pDb,
  92. AcDbAuditInfo* pAuditInfo)
  93. {
  94. UNREFERENCED_PARAMETER(pNewObj); UNREFERENCED_PARAMETER(originalObjId);
  95. UNREFERENCED_PARAMETER(pObjClass); UNREFERENCED_PARAMETER(pDb);
  96. UNREFERENCED_PARAMETER(pAuditInfo);
  97. return false;
  98. };
  99. /// <summary>
  100. /// redirect is invoked as the second attempt to establish a
  101. /// replacement object for a missing or corrupted object.
  102. /// It returns the object id of an existing object
  103. /// </summary>
  104. ///
  105. /// <param name="newObjId">
  106. /// The object Id that references to "original ObjId" should be
  107. /// mapped to. newObjId can either be an existing object in
  108. /// the database (such as Layer "0") or a newly created object.
  109. /// </param>
  110. ///
  111. /// <param name="originalObjId">
  112. /// The object id of the corrupted or missing object.
  113. /// </param>
  114. ///
  115. /// <param name="pObjClass">
  116. /// The anticipated class of the missing/corrupted object.
  117. /// </param>
  118. ///
  119. /// <param name="pDb">
  120. /// The database being recovered or audited.
  121. /// </param>
  122. ///
  123. /// <param name="pAuditInfo">
  124. /// The current audit state, including the indirect object
  125. /// lookup table.
  126. /// </param>
  127. ///
  128. /// <returns>
  129. /// If it returns true, then newObjId should represent a valid
  130. /// object in pDb which can replace references to originalObjId.
  131. /// If false is returned, then newObjId should be ignored.
  132. /// </returns>
  133. ///
  134. /// <remarks>
  135. /// This member is invoked if and only if the replace member returns
  136. /// false.
  137. /// if false is returned, then object recreation fails.
  138. /// </remarks>
  139. ///
  140. virtual bool redirect(AcDbObjectId& newObjId,
  141. AcDbObjectId originalObjId,
  142. AcRxClass* pObjClass,
  143. AcDbDatabase* pDb,
  144. AcDbAuditInfo* pAuditInfo)
  145. {
  146. UNREFERENCED_PARAMETER(newObjId); UNREFERENCED_PARAMETER(originalObjId);
  147. UNREFERENCED_PARAMETER(pObjClass); UNREFERENCED_PARAMETER(pDb);
  148. UNREFERENCED_PARAMETER(pAuditInfo);
  149. return false;
  150. };
  151. };
  152. #endif /* _AD_DBAUDITRECREATE_H */