AcDbAssocValueDependency.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. // CREATED BY: Jiri Kripac April 2007
  13. //
  14. // DESCRIPTION:
  15. //
  16. // AcDbAssocValueDependency concrete class.
  17. //
  18. //////////////////////////////////////////////////////////////////////////////
  19. #pragma once
  20. #include "AcDbAssocDependency.h"
  21. #pragma pack (push, 8)
  22. /// <summary>
  23. /// A concrete dependency class that represents a dependency on a scalar value,
  24. /// such as on a numerical variable. The dependent-on object needs to expose
  25. /// AcDbAssocValueProviderPE protocol extension class that is used to obtain the
  26. /// value from the object. It is possible to specify the name of the value in
  27. /// case the object provides more than one value.
  28. /// </summary>
  29. ///
  30. class ACDB_PORT AcDbAssocValueDependency : public AcDbAssocDependency
  31. {
  32. public:
  33. ACRX_DECLARE_MEMBERS(AcDbAssocValueDependency);
  34. /// <summary> Default constructor. </summary>
  35. /// <param name="createImpObject"> See AcDbAssocCreateImpObject. </param>
  36. ///
  37. explicit AcDbAssocValueDependency(AcDbAssocCreateImpObject createImpObject = kAcDbAssocCreateImpObject);
  38. /// <summary>
  39. /// Returns the name of the referenced value or an empty string if the value
  40. /// name is not needed because the referenced object exposes only a single
  41. /// value (it is a common case, such as for AcDbAssocVariable objects).
  42. /// </summary>
  43. /// <returns> Name of the referenced value or an empty string. </returns>
  44. ///
  45. const AcString& valueName() const;
  46. /// <summary>
  47. /// Sets the name of the referenced value or an empty string if the value
  48. /// name is not needed because the referenced object exposes only a single
  49. /// value (it is a common case, such as for AcDbAssocVariable objects).
  50. /// </summary>
  51. /// <param name="newValueName"> Name of a different referenced value (empty string allowed). </param>
  52. /// <returns> Acad::ErrorStatus. </returns>
  53. ///
  54. Acad::ErrorStatus setValueName(const AcString& newValueName);
  55. /// <summary>
  56. /// Returns true iff the dependency currently holds the cached value.
  57. /// </summary>
  58. /// <returns>
  59. /// Returns true iff the dependency holds the cached value.
  60. /// </returns>
  61. ///
  62. /// bool hasCachedValue() const;
  63. /// <summary>
  64. /// Queries the dependent-on object and returns its value. If the object cannot
  65. /// be opened, but the dependency holds the cached value of the object (its
  66. /// hasCachedValue() predicate returns true), it returns this cached value
  67. /// and Acad::eOk Acad::ErrorStatus.
  68. /// </summary>
  69. /// <param name="objectValue"> The value of the dependent-on object. </param>
  70. /// <returns> Acad::ErrorStatus. </returns>
  71. ///
  72. Acad::ErrorStatus getDependentOnObjectValue(AcDbEvalVariant& objectValue) const;
  73. /// <summary>
  74. /// Sets the value in the dependent-on object and updates the cached value.
  75. /// </summary>
  76. /// <param name="newObjectValue"> The new value to be set on the dependent-on object. </param>
  77. /// <returns> Acad::ErrorStatus. </returns>
  78. ///
  79. Acad::ErrorStatus setDependentOnObjectValue(const AcDbEvalVariant& newObjectValue);
  80. /// <summary>
  81. /// Checks whether the value cached in this dependency is the same as the
  82. /// value provided by the referenced object via its AcDbAssocValueProviderPE
  83. /// protocol extension. Returns true if they are different, false otherwise.
  84. /// </summary>
  85. /// <returns>
  86. /// True iff cached value is different from the value provided by the referened object.
  87. /// </returns>
  88. ///
  89. /// bool isRelevantChange() const;
  90. /// <summary>
  91. /// Returns true if both this and the other dependency depend on the same
  92. /// object and on the same named value in the object.
  93. /// </summary>
  94. /// <param name="otherDepepndencyId"> The other AcDbAssocValueDependency, open at least for read. </param>
  95. /// <returns>
  96. /// True iff oth dependencies depend on exactly the same named value of the same object.
  97. /// </returns>
  98. ///
  99. /// bool isDependentOnTheSameThingAs(const AcDbAssocDependency* pOtherDependency) const;
  100. /// <summary>
  101. /// Sets the value cached in this dependency from the current named value of the
  102. /// dependent-on object. Resets the dependency status to kIsUpToDateAssocStatus.
  103. /// </summary>
  104. ///
  105. /// void evaluate();
  106. }; // class AcDbAssocValueDependency
  107. #pragma pack (pop)