AGCOrientation.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /////////////////////////////////////////////////////////////////////////////
  2. // AGCOrientation.h : Declaration of the CAGCOrientation
  3. //
  4. #ifndef __AGCOrientation_H_
  5. #define __AGCOrientation_H_
  6. #include <AGC.h>
  7. #include <..\TCLib\ObjectLock.h>
  8. #include "resource.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CAGCOrientation
  11. class ATL_NO_VTABLE CAGCOrientation :
  12. public IDispatchImpl<IAGCOrientation, &IID_IAGCOrientation, &LIBID_AGCLib>,
  13. public IAGCOrientationPrivate,
  14. public ISupportErrorInfo,
  15. public IPersistStreamInit,
  16. public AGCObjectSafetyImpl<CAGCOrientation>,
  17. public CComObjectRootEx<CComMultiThreadModel>,
  18. public CComCoClass<CAGCOrientation, &CLSID_AGCOrientation>
  19. {
  20. // Declarations
  21. public:
  22. DECLARE_REGISTRY_RESOURCEID(IDR_AGCOrientation)
  23. DECLARE_PROTECT_FINAL_CONSTRUCT()
  24. DECLARE_GET_CONTROLLING_UNKNOWN()
  25. // Interface Map
  26. public:
  27. BEGIN_COM_MAP(CAGCOrientation)
  28. COM_INTERFACE_ENTRY(IAGCOrientation)
  29. COM_INTERFACE_ENTRY(IAGCOrientationPrivate)
  30. COM_INTERFACE_ENTRY(IDispatch)
  31. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  32. COM_INTERFACE_ENTRY(IPersistStreamInit)
  33. COM_INTERFACE_ENTRY2(IPersistStream, IPersistStreamInit)
  34. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  35. COM_INTERFACE_ENTRY_AUTOAGGREGATE(IID_IMarshal, m_punkMBV.p,
  36. CLSID_TCMarshalByValue)
  37. COM_INTERFACE_ENTRY(IObjectSafety)
  38. END_COM_MAP()
  39. // Category Map
  40. public:
  41. BEGIN_CATEGORY_MAP(CAGCOrientation)
  42. IMPLEMENTED_CATEGORY(CATID_AGC)
  43. IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
  44. IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
  45. END_CATEGORY_MAP()
  46. // Construction
  47. public:
  48. CAGCOrientation() :
  49. m_bDirty(false)
  50. {
  51. }
  52. // Implemenatation
  53. protected:
  54. static HRESULT GetRawOrientation(IAGCOrientation* pOrientation,
  55. Orientation* pOrientationRaw);
  56. static HRESULT CreateResultVector(const Vector* pVectorRaw,
  57. IAGCVector** ppResult);
  58. // ISupportsErrorInfo Interface Methods
  59. public:
  60. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  61. // IAGCOrientation Interface Methods
  62. public:
  63. STDMETHODIMP InitCopy(IAGCOrientation* pOrientation);
  64. STDMETHODIMP get_Forward(IAGCVector** ppVector);
  65. STDMETHODIMP get_Backward(IAGCVector** ppVector);
  66. STDMETHODIMP get_Up(IAGCVector** ppVector);
  67. STDMETHODIMP get_Right(IAGCVector** ppVector);
  68. STDMETHODIMP get_IsEqual(IAGCOrientation* pOrientation,
  69. VARIANT_BOOL* pbIsEqual);
  70. STDMETHODIMP get_IsRoughlyEqual(IAGCOrientation* pOrientation,
  71. VARIANT_BOOL* pbIsEqual);
  72. // IAGCOrientationPrivate Interface Methods
  73. public:
  74. STDMETHODIMP InitFromOrientation(const void* pvOrientation);
  75. STDMETHODIMP CopyOrientationTo(void* pvOrientation);
  76. // IPersist Interface Methods
  77. public:
  78. STDMETHODIMP GetClassID(CLSID* pClassID);
  79. // IPersistStreamInit Interface Methods
  80. public:
  81. STDMETHODIMP IsDirty();
  82. STDMETHODIMP Load(LPSTREAM pStm);
  83. STDMETHODIMP Save(LPSTREAM pStm, BOOL fClearDirty);
  84. STDMETHODIMP GetSizeMax(ULARGE_INTEGER* pCbSize);
  85. STDMETHODIMP InitNew(void);
  86. // Enumerations
  87. protected:
  88. enum {DIMENSIONS = 9};
  89. // Types
  90. protected:
  91. typedef TCObjectLock<CAGCOrientation> XLock;
  92. // Data Members
  93. private:
  94. Orientation m_orientation; // the actual orientation data goes here!
  95. bool m_bDirty;
  96. public:
  97. CComPtr<IUnknown> m_punkMBV;
  98. };
  99. /////////////////////////////////////////////////////////////////////////////
  100. #endif //__AGCOrientation_H_