AcDbAssocObjectPointer.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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. //
  12. // CREATED BY: Jiri Kripac September 2007
  13. //
  14. // DESCRIPTION:
  15. //
  16. // Template class AcDbAssocObjectPointer.
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. #include "dbobjptr2.h"
  20. #include "AcDbAssocActionBody.h"
  21. #include "AcDbAssocDependencyBody.h"
  22. #pragma pack (push, 8)
  23. /// <summary> <para>
  24. /// When an action is being evaluated and needs to use or modify an existing
  25. /// object it has a dependency on, the client code is given an option to control
  26. /// which object the action is actually going to use or modify. The client code
  27. /// can provide a substitute object instead of the original object by implementing
  28. /// the AcDbAssocEvaluationCallback::beginActionEvaluationUsingObject() callback
  29. /// method. This way the action evaluation can be redirected to use or modify
  30. /// another object (see the comments at the AcDbAssocEvaluationCallback class).
  31. /// </para> <para>
  32. /// The AcDbAssocObjectPointer template class, modelled after AcDbObjectPointer
  33. /// template class, simplifies the action evaluation code that needs to respect
  34. /// this possible redirection. The AcDbAssocObjectPointer constructor automatically
  35. /// calls the AcDbAssocEvaluationCallback::beginActionEvaluationUsingObject()
  36. /// method and the destructor calls the
  37. /// AcDbAssocEvaluationCallback::endActionEvaluationUsingObject() method.
  38. /// </para> <para>
  39. /// All the custom action evaluation code needs to do is to use this template
  40. /// class and then use the AcDbObject pointer this template class provides. The
  41. /// pointer will point either to the original database-resident object whose
  42. /// AcDbObjectId has been provided, or to a substitute object, if the evaluation
  43. /// is in progress and the client evaluation callback provided a substitute object.
  44. /// </para> <para>
  45. /// There are several overloaded constructors that simplify the usage of this
  46. /// class from an AcDbAssocAction, AcDbAssocActionBody, AcDbAssocDependency or
  47. /// AcDbAssocDependencyBody. The constuctor that does not take an action, action
  48. /// body, dependency or dependency body argument uses the currently evaluated
  49. /// action, if in the middle of evaluation. This is probably the most convenient
  50. /// constructor to use.
  51. /// </para> <para>
  52. /// There are also constructors that take ACDB_CLASS*. They can be used to pass
  53. /// the given ACDB_CLASS* object to the client callback code. The constructor
  54. /// calls AcDbAssocEvaluationCallback::beginActionEvaluationUsingObject()
  55. /// callback method, passing null AcDbObjectId and passing the given ACDB_CLASS*
  56. /// object as the pSubstituteObject argument. The callback method should then
  57. /// treat this argument as an input agrument, i.e. the it should not change it.
  58. /// The destructor calls AcDbAssocEvaluationCallback::endActionEvaluationUsingObject()
  59. /// callback method, passing null AcDbObjectId and passing the given ACDB_CLASS*
  60. /// object as the pObject argument.
  61. /// </para> </summary>
  62. ///
  63. template<class ACDB_CLASS> class AcDbAssocObjectPointer
  64. {
  65. public:
  66. /// <summary> Constructor. If in the middle of evaluation, uses the currently evaluated action. </summary>
  67. /// <param name="objectId"> AcDbObjectId of the object that should be opened. </param>
  68. /// <param name="openMode"> AcDb::kForRead, AcDb::kForWrite, AcDb::kForNotify. </param>
  69. /// <param name="openErased"> Opens the object even if it is erased. </param>
  70. /// <param name="openOnLockedLayer"> Opens the object even on the locked layer. </param>
  71. ///
  72. AcDbAssocObjectPointer(
  73. AcDbObjectId objectId,
  74. AcDb::OpenMode openMode,
  75. bool openErased = false,
  76. bool openOnLockedLayer = false);
  77. /// <summary> Constructor. </summary>
  78. /// <param name="pActionBeingEvaluated"> The action that is just being evaluated. </param>
  79. /// <param name="objectId"> AcDbObjectId of the object that should be opened. </param>
  80. /// <param name="openMode"> AcDb::kForRead, AcDb::kForWrite, AcDb::kForNotify. </param>
  81. /// <param name="openErased"> Opens the object even if it is erased. </param>
  82. /// <param name="openOnLockedLayer"> Opens the object even on the locked layer. </param>
  83. ///
  84. AcDbAssocObjectPointer(
  85. AcDbAssocAction* pActionBeingEvaluated,
  86. AcDbObjectId objectId,
  87. AcDb::OpenMode openMode,
  88. bool openErased = false,
  89. bool openOnLockedLayer = false);
  90. /// <summary> Constructor. </summary>
  91. /// <param name="pActionBodyBeingEvaluated"> The body of action that is just being evaluated. </param>
  92. /// <param name="objectId"> AcDbObjectId of the object that should be opened. </param>
  93. /// <param name="openMode"> AcDb::kForRead, AcDb::kForWrite, AcDb::kForNotify. </param>
  94. /// <param name="openErased"> Opens the object even if it is erased. </param>
  95. /// <param name="openOnLockedLayer"> Opens the object even on the locked layer. </param>
  96. ///
  97. AcDbAssocObjectPointer(
  98. const AcDbAssocActionBody* pActionBodyBeingEvaluated,
  99. AcDbObjectId objectId,
  100. AcDb::OpenMode openMode,
  101. bool openErased = false,
  102. bool openOnLockedLayer = false);
  103. /// <summary> Constructor. </summary>
  104. /// <param name="pDependencyBeingEvaluated"> The dependency whose action is just being evaluated. </param>
  105. /// <param name="objectId"> AcDbObjectId of the object that should be opened. </param>
  106. /// <param name="openMode"> AcDb::kForRead, AcDb::kForWrite, AcDb::kForNotify. </param>
  107. /// <param name="openErased"> Opens the object even if it is erased. </param>
  108. /// <param name="openOnLockedLayer"> Opens the object even on the locked layer. </param>
  109. ///
  110. AcDbAssocObjectPointer(
  111. const AcDbAssocDependency* pDependencyBeingEvaluated,
  112. AcDbObjectId objectId,
  113. AcDb::OpenMode openMode,
  114. bool openErased = false,
  115. bool openOnLockedLayer = false);
  116. /// <summary> Constructor. </summary>
  117. /// <param name="pDependencyBodyBeingEvaluated"> The body of dependency whose action is just being evaluated. </param>
  118. /// <param name="objectId"> AcDbObjectId of the object that should be opened. </param>
  119. /// <param name="openMode"> AcDb::kForRead, AcDb::kForWrite, AcDb::kForNotify. </param>
  120. /// <param name="openErased"> Opens the object even if it is erased. </param>
  121. /// <param name="openOnLockedLayer"> Opens the object even on the locked layer. </param>
  122. ///
  123. AcDbAssocObjectPointer(
  124. const AcDbAssocDependencyBody* pDependencyBodyBeingEvaluated,
  125. AcDbObjectId objectId,
  126. AcDb::OpenMode openMode,
  127. bool openErased = false,
  128. bool openOnLockedLayer = false);
  129. /// <summary> Constructor. </summary>
  130. /// <param name="pActionBeingEvaluated"> The action that is just being evaluated. </param>
  131. /// <param name="pObject"> Existing AcDbObject that is passed as input argument
  132. /// to the client callback code. See the class summary for more details. </param>
  133. ///
  134. AcDbAssocObjectPointer(
  135. AcDbAssocAction* pActionBeingEvaluated,
  136. ACDB_CLASS* pObject);
  137. /// <summary> Constructor. </summary>
  138. /// <param name="pActionBodyBeingEvaluated"> The body of action that is just being evaluated. </param>
  139. /// <param name="pObject"> Existing AcDbObject that is passed as input argument
  140. /// to the client callback code. See the class summary for more details. </param>
  141. ///
  142. AcDbAssocObjectPointer(
  143. const AcDbAssocActionBody* pActionBodyBeingEvaluated,
  144. ACDB_CLASS* pObject);
  145. /// <summary> Destructor. </summary>
  146. ///
  147. ~AcDbAssocObjectPointer();
  148. /// <summary> Gets the open status of the associated object. </summary>
  149. /// <returns> Returns the open status of the associated object. </returns>
  150. ///
  151. Acad::ErrorStatus openStatus() const;
  152. /// <summary> Gets whether there is a substitute object. </summary>
  153. /// <returns> Returns true if the substitute object exists. </returns>
  154. ///
  155. bool isSubstituteObject() const { return mpSubstituteObject != NULL; }
  156. /// <summary> Gets the constant pointer of the associated object. </summary>
  157. /// <returns> Returns the constant pointer of the associated object. </returns>
  158. ///
  159. const ACDB_CLASS* operator->() const { return mpObject; }
  160. /// <summary> Gets the pointer of the associated object. </summary>
  161. /// <returns> Returns the pointer of the associated object. </returns>
  162. ///
  163. ACDB_CLASS* operator->() { return mpObject; }
  164. /// <summary> Gets the constant pointer of the associated object. </summary>
  165. ///
  166. operator const ACDB_CLASS*() const { return mpObject; }
  167. /// <summary> Gets the pointer of the associated object. </summary>
  168. ///
  169. operator ACDB_CLASS*() { return mpObject; }
  170. private:
  171. AcDbAssocAction* const mpActionBeingEvaluated;
  172. const AcDbAssocActionBody* const mpActionBodyBeingEvaluated;
  173. const AcDbAssocDependency* const mpDependencyBeingEvaluated;
  174. const AcDbAssocDependencyBody* const mpDependencyBodyBeingEvaluated;
  175. const AcDbObjectId mObjectId;
  176. AcDbSmartObjectPointer<ACDB_CLASS> mObjectPtr;
  177. ACDB_CLASS* mpObject;
  178. AcDbObject* mpSubstituteObject;
  179. Acad::ErrorStatus mSubstituteObjectErrorStatus;
  180. private:
  181. /// <summary> set up the associated object. </summary>
  182. ///
  183. void setup(AcDbAssocAction* pActionBeingEvaluated,
  184. AcDb::OpenMode openMode,
  185. bool openErased,
  186. bool openOnLockedLayer);
  187. /// <summary> Constructor. Disabled </summary>
  188. ///
  189. AcDbAssocObjectPointer();
  190. /// <summary> Constructor. Disabled </summary>
  191. ///
  192. AcDbAssocObjectPointer(const AcDbAssocObjectPointer&);
  193. /// <summary> Overrides the operator = . Disabled </summary>
  194. ///
  195. AcDbAssocObjectPointer& operator = (const AcDbAssocObjectPointer&);
  196. }; // template class AcDbAssocObjectPointer
  197. ACDB_PORT AcDbAssocAction* acdbAssocGetCurrentlyEvaluatedActionPointer(const AcDbDatabase*);
  198. template<class ACDB_CLASS> inline
  199. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  200. AcDbObjectId objectId,
  201. AcDb::OpenMode openMode,
  202. bool openErased ,
  203. bool openOnLockedLayer)
  204. : mpActionBeingEvaluated (acdbAssocGetCurrentlyEvaluatedActionPointer(objectId.database())),
  205. mpActionBodyBeingEvaluated (NULL),
  206. mpDependencyBeingEvaluated (NULL),
  207. mpDependencyBodyBeingEvaluated(NULL),
  208. mObjectId (objectId),
  209. mpObject (NULL),
  210. mpSubstituteObject (NULL),
  211. mSubstituteObjectErrorStatus (Acad::eNullObjectId)
  212. {
  213. setup(mpActionBeingEvaluated, openMode, openErased, openOnLockedLayer);
  214. }
  215. template<class ACDB_CLASS> inline
  216. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  217. AcDbAssocAction* pActionBeingEvaluated,
  218. AcDbObjectId objectId,
  219. AcDb::OpenMode openMode,
  220. bool openErased ,
  221. bool openOnLockedLayer)
  222. : mpActionBeingEvaluated (pActionBeingEvaluated),
  223. mpActionBodyBeingEvaluated (NULL),
  224. mpDependencyBeingEvaluated (NULL),
  225. mpDependencyBodyBeingEvaluated(NULL),
  226. mObjectId (objectId),
  227. mpObject (NULL),
  228. mpSubstituteObject (NULL),
  229. mSubstituteObjectErrorStatus (Acad::eNullObjectId)
  230. {
  231. setup(pActionBeingEvaluated, openMode, openErased, openOnLockedLayer);
  232. }
  233. template<class ACDB_CLASS> inline
  234. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  235. const AcDbAssocActionBody* pActionBodyBeingEvaluated,
  236. AcDbObjectId objectId,
  237. AcDb::OpenMode openMode,
  238. bool openErased ,
  239. bool openOnLockedLayer )
  240. : mpActionBeingEvaluated (NULL),
  241. mpActionBodyBeingEvaluated (pActionBodyBeingEvaluated),
  242. mpDependencyBeingEvaluated (NULL),
  243. mpDependencyBodyBeingEvaluated(NULL),
  244. mObjectId (objectId),
  245. mpObject (NULL),
  246. mpSubstituteObject (NULL),
  247. mSubstituteObjectErrorStatus (Acad::eNullObjectId)
  248. {
  249. #ifdef ASSERT
  250. ASSERT(mpActionBodyBeingEvaluated != NULL);
  251. #endif
  252. AcDbSmartObjectPointer<AcDbAssocAction> pActionBeingEvaluated;
  253. if (mpActionBodyBeingEvaluated != NULL)
  254. {
  255. pActionBeingEvaluated.open(mpActionBodyBeingEvaluated->parentAction(), AcDb::kForRead, true);
  256. }
  257. setup(pActionBeingEvaluated, openMode, openErased, openOnLockedLayer);
  258. }
  259. template<class ACDB_CLASS> inline
  260. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  261. const AcDbAssocDependency* pDependencyBeingEvaluated,
  262. AcDbObjectId objectId,
  263. AcDb::OpenMode openMode,
  264. bool openErased ,
  265. bool openOnLockedLayer )
  266. : mpActionBeingEvaluated (NULL),
  267. mpActionBodyBeingEvaluated (NULL),
  268. mpDependencyBeingEvaluated (pDependencyBeingEvaluated),
  269. mpDependencyBodyBeingEvaluated(NULL),
  270. mObjectId (objectId),
  271. mpObject (NULL),
  272. mpSubstituteObject (NULL),
  273. mSubstituteObjectErrorStatus (Acad::eNullObjectId)
  274. {
  275. #ifdef ASSERT
  276. ASSERT(mpDependencyBeingEvaluated != NULL);
  277. #endif
  278. AcDbSmartObjectPointer<AcDbAssocAction> pActionBeingEvaluated;
  279. if (mpDependencyBeingEvaluated != NULL)
  280. {
  281. pActionBeingEvaluated.open(mpDependencyBeingEvaluated->owningAction(), AcDb::kForRead, true);
  282. }
  283. setup(pActionBeingEvaluated, openMode, openErased, openOnLockedLayer);
  284. }
  285. template<class ACDB_CLASS> inline
  286. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  287. const AcDbAssocDependencyBody* pDependencyBodyBeingEvaluated,
  288. AcDbObjectId objectId,
  289. AcDb::OpenMode openMode,
  290. bool openErased ,
  291. bool openOnLockedLayer)
  292. : mpActionBeingEvaluated (NULL),
  293. mpActionBodyBeingEvaluated (NULL),
  294. mpDependencyBeingEvaluated (NULL),
  295. mpDependencyBodyBeingEvaluated(pDependencyBodyBeingEvaluated),
  296. mObjectId (objectId),
  297. mpObject (NULL),
  298. mpSubstituteObject (NULL),
  299. mSubstituteObjectErrorStatus (Acad::eNullObjectId)
  300. {
  301. #ifdef ASSERT
  302. ASSERT(mpDependencyBodyBeingEvaluated != NULL);
  303. #endif
  304. AcDbSmartObjectPointer<AcDbAssocAction> pActionBeingEvaluated;
  305. if (mpDependencyBodyBeingEvaluated != NULL)
  306. {
  307. AcDbSmartObjectPointer<AcDbAssocDependency>
  308. pDependencyBeingEvaluated(mpDependencyBodyBeingEvaluated->parentDependency(), AcDb::kForRead, true);
  309. if (pDependencyBeingEvaluated.openStatus() == Acad::eOk)
  310. {
  311. pActionBeingEvaluated.open(pDependencyBeingEvaluated->owningAction(), AcDb::kForRead, true);
  312. }
  313. }
  314. setup(pActionBeingEvaluated, openMode, openErased, openOnLockedLayer);
  315. }
  316. template<class ACDB_CLASS> inline
  317. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  318. AcDbAssocAction* pActionBeingEvaluated,
  319. ACDB_CLASS* pObject)
  320. : mpActionBeingEvaluated (pActionBeingEvaluated),
  321. mpActionBodyBeingEvaluated (NULL),
  322. mpDependencyBeingEvaluated (NULL),
  323. mpDependencyBodyBeingEvaluated(NULL),
  324. mObjectId (AcDbObjectId::kNull),
  325. mpObject (pObject),
  326. mpSubstituteObject (pObject),
  327. mSubstituteObjectErrorStatus (pObject != NULL ? Acad::eOk : Acad::eNullObjectId)
  328. {
  329. #ifdef ASSERT
  330. ASSERT(mpActionBeingEvaluated != NULL);
  331. #endif
  332. if (pActionBeingEvaluated != NULL)
  333. {
  334. AcDbAssocEvaluationCallback* const pCallback
  335. = pActionBeingEvaluated->currentEvaluationCallback();
  336. if (pCallback != NULL)
  337. {
  338. AcDbObject* pInputObject = pObject;
  339. pCallback->beginActionEvaluationUsingObject(pActionBeingEvaluated,
  340. AcDbObjectId::kNull,
  341. true,
  342. true,
  343. pInputObject);
  344. // If the passed-in objectId is null, the callback should treat
  345. // its pSubstituteObject argument as an input argument and should
  346. // not change its value
  347. //
  348. #ifdef ASSERT
  349. ASSERT(pInputObject == pObject);
  350. #endif
  351. }
  352. }
  353. }
  354. template<class ACDB_CLASS> inline
  355. AcDbAssocObjectPointer<ACDB_CLASS>::AcDbAssocObjectPointer(
  356. const AcDbAssocActionBody* pActionBodyBeingEvaluated,
  357. ACDB_CLASS* pObject)
  358. : mpActionBeingEvaluated (NULL),
  359. mpActionBodyBeingEvaluated (pActionBodyBeingEvaluated),
  360. mpDependencyBeingEvaluated (NULL),
  361. mpDependencyBodyBeingEvaluated(NULL),
  362. mObjectId (AcDbObjectId::kNull),
  363. mpObject (pObject),
  364. mpSubstituteObject (pObject),
  365. mSubstituteObjectErrorStatus (pObject != NULL ? Acad::eOk : Acad::eNullObjectId)
  366. {
  367. #ifdef ASSERT
  368. ASSERT(mpActionBodyBeingEvaluated != NULL);
  369. #endif
  370. if (mpActionBodyBeingEvaluated != NULL)
  371. {
  372. AcDbSmartObjectPointer<AcDbAssocAction>
  373. pActionBeingEvaluated(mpActionBodyBeingEvaluated->parentAction(),
  374. AcDb::kForRead, true);
  375. if (pActionBeingEvaluated != NULL)
  376. {
  377. AcDbAssocEvaluationCallback* const pCallback
  378. = pActionBeingEvaluated->currentEvaluationCallback();
  379. if (pCallback != NULL)
  380. {
  381. AcDbObject* pInputObject = pObject;
  382. pCallback->beginActionEvaluationUsingObject(pActionBeingEvaluated,
  383. AcDbObjectId::kNull,
  384. true,
  385. true,
  386. pInputObject);
  387. // If the passed-in objectId is null, the callback should treat
  388. // its pSubstituteObject argument as an input argument and should
  389. // not change its value
  390. //
  391. #ifdef ASSERT
  392. ASSERT(pInputObject == pObject);
  393. #endif
  394. }
  395. }
  396. }
  397. }
  398. template<class ACDB_CLASS> inline
  399. void AcDbAssocObjectPointer<ACDB_CLASS>::setup(
  400. AcDbAssocAction* pActionBeingEvaluated,
  401. AcDb::OpenMode openMode,
  402. bool openErased,
  403. bool openOnLockedLayer)
  404. {
  405. mpObject = NULL;
  406. mpSubstituteObject = NULL;
  407. mSubstituteObjectErrorStatus = Acad::eNullObjectId;
  408. if (mObjectId.isNull())
  409. return;
  410. if (pActionBeingEvaluated != NULL)
  411. {
  412. AcDbAssocEvaluationCallback* const pCallback
  413. = pActionBeingEvaluated->currentEvaluationCallback();
  414. if (pCallback != NULL)
  415. {
  416. pCallback->beginActionEvaluationUsingObject(pActionBeingEvaluated,
  417. mObjectId,
  418. true,
  419. openMode == AcDb::kForWrite,
  420. mpSubstituteObject);
  421. if (mpSubstituteObject != NULL)
  422. {
  423. mpObject = ACDB_CLASS::cast(mpSubstituteObject);
  424. mSubstituteObjectErrorStatus = mpObject != NULL ? Acad::eOk : Acad::eNotThatKindOfClass;
  425. }
  426. }
  427. }
  428. if (mpSubstituteObject == NULL)
  429. {
  430. if (mObjectPtr.open(mObjectId, openMode, openErased, openOnLockedLayer) == Acad::eOk)
  431. {
  432. mpObject = mObjectPtr;
  433. #ifdef ASSERT
  434. ASSERT(mpObject != NULL);
  435. #endif
  436. }
  437. }
  438. }
  439. template<class ACDB_CLASS> inline
  440. AcDbAssocObjectPointer<ACDB_CLASS>::~AcDbAssocObjectPointer()
  441. {
  442. if (mObjectId.isNull() && mpSubstituteObject == NULL)
  443. return; // There is no referenced object
  444. if (mpActionBeingEvaluated != NULL)
  445. {
  446. AcDbAssocEvaluationCallback* const pCallback
  447. = mpActionBeingEvaluated->currentEvaluationCallback();
  448. if (pCallback != NULL)
  449. {
  450. pCallback->endActionEvaluationUsingObject(mpActionBeingEvaluated, mObjectId, mpObject);
  451. }
  452. }
  453. else
  454. {
  455. AcDbSmartObjectPointer<AcDbAssocAction> pActionBeingEvaluated;
  456. if (mpActionBodyBeingEvaluated != NULL)
  457. {
  458. pActionBeingEvaluated.open(mpActionBodyBeingEvaluated->parentAction(), AcDb::kForRead, true);
  459. }
  460. else if (mpDependencyBeingEvaluated != NULL)
  461. {
  462. pActionBeingEvaluated.open(mpDependencyBeingEvaluated->owningAction(), AcDb::kForRead, true);
  463. }
  464. else if (mpDependencyBodyBeingEvaluated != NULL)
  465. {
  466. AcDbSmartObjectPointer<AcDbAssocDependency>
  467. pDependencyBeingEvaluated(mpDependencyBodyBeingEvaluated->parentDependency(), AcDb::kForRead, true);
  468. if (pDependencyBeingEvaluated.openStatus() == Acad::eOk)
  469. {
  470. pActionBeingEvaluated.open(pDependencyBeingEvaluated->owningAction(), AcDb::kForRead, true);
  471. }
  472. }
  473. if (pActionBeingEvaluated.openStatus() == Acad::eOk)
  474. {
  475. AcDbAssocEvaluationCallback* const pCallback
  476. = pActionBeingEvaluated->currentEvaluationCallback();
  477. if (pCallback != NULL)
  478. {
  479. pCallback->endActionEvaluationUsingObject(pActionBeingEvaluated, mObjectId, mpObject);
  480. }
  481. }
  482. }
  483. }
  484. template<class ACDB_CLASS> inline
  485. Acad::ErrorStatus AcDbAssocObjectPointer<ACDB_CLASS>::openStatus() const
  486. {
  487. return mpSubstituteObject != NULL ? mSubstituteObjectErrorStatus : mObjectPtr.openStatus();
  488. }
  489. #pragma pack (pop)