AcPlObject.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. // DESCRIPTION: Base class for client instantiable plot objects
  12. //
  13. #ifndef ACPLOBJECT_H
  14. #define ACPLOBJECT_H
  15. #include "rxobject.h"
  16. #include "AcHeapOpers.h"
  17. #include "acpl.h"
  18. class AcPlObjectImp;
  19. class AcPlSystemInternals;
  20. class ADESK_NO_VTABLE AcPlObject : public AcRxObject, public AcHeapOperators
  21. {
  22. public:
  23. ACRX_DECLARE_MEMBERS(AcPlObject);
  24. ACPL_PORT virtual ~AcPlObject();
  25. protected:
  26. AcPlObject();
  27. AcPlObject(AcPlSystemInternals*);
  28. private:
  29. friend class AcPlSystemInternals;
  30. AcPlObjectImp* mpPlObjectImp;
  31. };
  32. // This macro is NOT intended for application-defined classes derived
  33. // from AcPlObject when declaring their class header. This macro declares
  34. // an internally used form of constructor, which takes the
  35. // AcPlSystemInternals* argument. Rx applications should not define
  36. // such constructors for their database object classes, but they should
  37. // be ignored by the system anyway.
  38. //
  39. // Application-defined classes are advised to use the ACRX_DECLARE_MEMBERS
  40. // macro instead, and to consult the documentation for related definitions.
  41. //
  42. #define ACPL_DECLARE_MEMBERS(CLASS_NAME) \
  43. private: \
  44. friend class AcPlSystemInternals; \
  45. protected: \
  46. CLASS_NAME(AcPlSystemInternals*); \
  47. public: \
  48. ACPL_PORT virtual AcRxClass* isA() const; \
  49. ACPL_PORT static AcRxClass* gpDesc; \
  50. ACPL_PORT static AcRxClass* desc(); \
  51. ACPL_PORT static CLASS_NAME* cast(const AcRxObject* inPtr) \
  52. { return ((inPtr == NULL) || !inPtr->isKindOf(CLASS_NAME::desc())) \
  53. ? NULL : (CLASS_NAME*)inPtr; }; \
  54. ACPL_PORT static void rxInit(); \
  55. ACPL_PORT static void rxInit(AppNameChangeFuncPtr);
  56. // Use this macro to define members of classes derived from AcPlObject
  57. #define ACPL_DEFINE_MEMBERS(CLASS_NAME, BASE_CLASS) \
  58. ACRX_NO_CONS_DEFINE_MEMBERS(CLASS_NAME, BASE_CLASS) \
  59. CLASS_NAME::CLASS_NAME(AcPlSystemInternals* pInternals) \
  60. : BASE_CLASS(pInternals) \
  61. { \
  62. }
  63. #endif // ACPLOBJECT_H