dbsubeid.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. #ifndef GEOMENT_DBSUBEID_H
  12. #define GEOMENT_DBSUBEID_H
  13. #include "acdb.h"
  14. #include "dbidar.h"
  15. #pragma pack (push, 8)
  16. class AcDbSubentId
  17. {
  18. public:
  19. AcDbSubentId();
  20. AcDbSubentId(AcDb::SubentType type, Adesk::GsMarker index);
  21. AcDbSubentId(AcRxClass* pTypeClass, Adesk::GsMarker index);
  22. #ifdef __clang__
  23. ~AcDbSubentId() {};
  24. #endif
  25. bool operator ==(const AcDbSubentId& id) const;
  26. bool operator !=(const AcDbSubentId& id) const;
  27. AcDb::SubentType type () const;
  28. void setType(AcDb::SubentType);
  29. AcRxClass* typeClass () const;
  30. void setTypeClass(AcRxClass* pClass);
  31. Adesk::GsMarker index() const;
  32. void setIndex(Adesk::GsMarker);
  33. private:
  34. AcDb::SubentType mType;
  35. Adesk::GsMarker mIndex;
  36. AcRxClass* mpTypeClass;
  37. };
  38. const Adesk::GsMarker kNullSubentIndex = 0;
  39. __declspec(selectany) extern const AcDbSubentId kNullSubentId(AcDb::kNullSubentType,
  40. kNullSubentIndex);
  41. class AcDbFullSubentPath
  42. {
  43. public:
  44. AcDbFullSubentPath();
  45. AcDbFullSubentPath(AcDb::SubentType type, Adesk::GsMarker index);
  46. AcDbFullSubentPath(AcDbObjectId entId, AcDb::SubentType type, Adesk::GsMarker index);
  47. AcDbFullSubentPath(AcDbObjectId entId, AcDbSubentId subId);
  48. AcDbFullSubentPath(AcDbObjectIdArray objectIds, AcDbSubentId subId);
  49. AcDbFullSubentPath(const AcDbFullSubentPath&);
  50. ~AcDbFullSubentPath();
  51. AcDbFullSubentPath& operator = (const AcDbFullSubentPath&);
  52. bool operator ==(const AcDbFullSubentPath& id) const;
  53. bool operator !=(const AcDbFullSubentPath& id) const;
  54. void objectIds(AcDbObjectIdArray& objectIds) const;
  55. AcDbObjectIdArray& objectIds();
  56. const AcDbObjectIdArray& objectIds() const;
  57. const AcDbSubentId subentId () const;
  58. AcDbSubentId& subentId ();
  59. void* userAppData() const;
  60. void setUserAppData(void* pData);
  61. private:
  62. AcDbObjectIdArray mObjectIds;
  63. AcDbSubentId mSubentId;
  64. void* mpUserAppData;
  65. };
  66. // inlines
  67. inline AcDb::SubentType
  68. AcDbSubentId::type () const
  69. {
  70. return mType;
  71. }
  72. inline void
  73. AcDbSubentId::setType(AcDb::SubentType type)
  74. {
  75. mType = type;
  76. if (mType != AcDb::kClassSubentType)
  77. mpTypeClass = nullptr;
  78. }
  79. inline Adesk::GsMarker
  80. AcDbSubentId::index() const
  81. {
  82. return mIndex;
  83. }
  84. inline void
  85. AcDbSubentId::setIndex(Adesk::GsMarker index)
  86. {
  87. mIndex = index;
  88. }
  89. inline AcRxClass*
  90. AcDbSubentId::typeClass() const
  91. {
  92. return mpTypeClass;
  93. }
  94. inline void
  95. AcDbSubentId::setTypeClass(AcRxClass* pTypeClass)
  96. {
  97. mpTypeClass = pTypeClass;
  98. if (mpTypeClass != nullptr)
  99. mType = AcDb::kClassSubentType;
  100. }
  101. inline
  102. AcDbSubentId::AcDbSubentId()
  103. : mType(AcDb::kNullSubentType), mIndex(kNullSubentIndex), mpTypeClass(nullptr)
  104. {
  105. }
  106. inline
  107. AcDbSubentId::AcDbSubentId(AcDb::SubentType t, Adesk::GsMarker i)
  108. : mType(t), mIndex(i), mpTypeClass(nullptr)
  109. {
  110. }
  111. inline
  112. AcDbSubentId::AcDbSubentId(AcRxClass* pTypeClass, Adesk::GsMarker i)
  113. : mType(AcDb::kClassSubentType), mIndex(i), mpTypeClass(pTypeClass)
  114. {
  115. }
  116. inline bool
  117. AcDbSubentId::operator ==(const AcDbSubentId& id) const
  118. {
  119. return ((mIndex == id.mIndex)
  120. && (mType == id.mType)
  121. && (mpTypeClass == id.mpTypeClass));
  122. }
  123. inline bool
  124. AcDbSubentId::operator !=(const AcDbSubentId& id) const
  125. {
  126. return ((mIndex != id.mIndex)
  127. || (mType != id.mType)
  128. || (mpTypeClass != id.mpTypeClass));
  129. }
  130. inline
  131. AcDbFullSubentPath::AcDbFullSubentPath()
  132. {
  133. }
  134. inline
  135. AcDbFullSubentPath::AcDbFullSubentPath(AcDb::SubentType type,
  136. Adesk::GsMarker index)
  137. : mSubentId(type, index)
  138. {
  139. }
  140. inline void
  141. AcDbFullSubentPath::objectIds(AcDbObjectIdArray& objectIds) const
  142. {
  143. objectIds = mObjectIds;
  144. }
  145. inline AcDbObjectIdArray&
  146. AcDbFullSubentPath::objectIds()
  147. {
  148. return mObjectIds;
  149. }
  150. inline const AcDbObjectIdArray&
  151. AcDbFullSubentPath::objectIds() const
  152. {
  153. return mObjectIds;
  154. }
  155. inline const AcDbSubentId
  156. AcDbFullSubentPath::subentId () const
  157. {
  158. return mSubentId;
  159. }
  160. inline AcDbSubentId&
  161. AcDbFullSubentPath::subentId ()
  162. {
  163. return mSubentId;
  164. }
  165. inline void*
  166. AcDbFullSubentPath::userAppData() const
  167. {
  168. return mpUserAppData;
  169. }
  170. inline void
  171. AcDbFullSubentPath::setUserAppData(void* pData)
  172. {
  173. mpUserAppData = pData;
  174. }
  175. #pragma pack (pop)
  176. #endif