dbObjectContextManager.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. // DESCRIPTION: Object context manager class. This class manages collections
  13. // of object contexts for a particular database.
  14. #ifndef ACDB_OBJECTCONTEXTMANAGER_H
  15. #define ACDB_OBJECTCONTEXTMANAGER_H
  16. #pragma once
  17. #include "acdb.h"
  18. #include "dbmain.h"
  19. #include "AcString.h"
  20. class AcDbObjectContextCollection;
  21. class AcDbObjectContext;
  22. class AcDbImpObjectContextManager;
  23. #pragma pack (push, 8)
  24. ////////////////////////////////////////////////////////////////////////
  25. // class AcDbObjectContextManager
  26. ////////////////////////////////////////////////////////////////////////
  27. /// <summary>
  28. /// Exposes the collection of context types supported by the drawing.
  29. /// </summary>
  30. ///
  31. /// <remarks>
  32. /// Each AcDbDatabase exposes an AcDbObjectContextManager which can be used
  33. /// to register, unregister, and enumerate custom context collections.
  34. /// </remarks>
  35. ///
  36. class AcDbObjectContextManager: public AcRxObject
  37. {
  38. public:
  39. ACRX_DECLARE_MEMBERS(AcDbObjectContextManager);
  40. /// <summary>
  41. /// Default constructor.
  42. /// </summary>
  43. ///
  44. /// <remarks>
  45. /// For internal use only.
  46. /// </remarks>
  47. ///
  48. AcDbObjectContextManager();
  49. /// <summary>
  50. /// Destructor.
  51. /// </summary>
  52. ///
  53. virtual ~AcDbObjectContextManager();
  54. /// <summary>
  55. /// Registers a context collection with the context manager.
  56. /// </summary>
  57. ///
  58. /// <param name="collectionName">
  59. /// The name of the collection to register with the manager.
  60. /// </param>
  61. ///
  62. /// <param name="pCollection">
  63. /// A pointer to the collection to register with the manager.
  64. /// </param>
  65. ///
  66. /// <returns>
  67. /// Returns Acad::eOk if successful.
  68. /// </returns>
  69. ///
  70. /// <remarks>
  71. /// Applications are responsible for allocating and freeing the object
  72. /// context collection object. Before an application unloads it should
  73. /// unregister all instances of the collection and free any resources.
  74. /// </remarks>
  75. ///
  76. Acad::ErrorStatus registerContextCollection(
  77. const AcString& collectionName,
  78. AcDbObjectContextCollection* pCollection);
  79. /// <summary>
  80. /// Unregisters a context collection with the context manager.
  81. /// </summary>
  82. ///
  83. /// <param name="collectionName">
  84. /// The name of the collection to unregister with the manager.
  85. /// </param>
  86. ///
  87. /// <returns>
  88. /// Returns Acad::eOk if successful. Applications are responsible for
  89. /// freeing any memory allocated for a collection, simply unregistering the
  90. /// collection with the manager does not free any resources.
  91. /// </returns>
  92. Acad::ErrorStatus unregisterContextCollection(
  93. const AcString& collectionName);
  94. /// <summary>
  95. /// Returns a registered context collection by name
  96. /// </summary>
  97. ///
  98. /// <param name="collectionName">
  99. /// The name of the desired collection.
  100. /// </param>
  101. ///
  102. /// <returns>
  103. /// Returns a const pointer to the collection registered if one exists with
  104. /// the specified name, or NULL if no such collection is registered.
  105. /// </returns>
  106. ///
  107. /// <remarks>
  108. /// Applications should not delete the returned pointer.
  109. /// </remarks>
  110. ///
  111. AcDbObjectContextCollection* const contextCollection(
  112. const AcString& collectionName) const;
  113. private:
  114. AcDbImpObjectContextManager* mpImp;
  115. friend class AcDbContextDataSubManager;
  116. };
  117. #pragma pack (pop)
  118. #endif