Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // MPEG2TuneRequestimpl.h : implementation helper template for component type interface
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef MPEG2TUNEREQUESTIMPL_H
  5. #define MPEG2TUNEREQUESTIMPL_H
  6. #include <tune.h>
  7. #include "tunerequestimpl.h"
  8. namespace BDATuningModel {
  9. template<class T,
  10. class MostDerived = IMPEG2TuneRequest,
  11. LPCGUID iid = &__uuidof(MostDerived),
  12. LPCGUID LibID = &LIBID_TunerLib,
  13. WORD wMajor = 1,
  14. WORD wMinor = 0,
  15. class tihclass = CComTypeInfoHolder
  16. > class ATL_NO_VTABLE IMPEG2TuneRequestImpl :
  17. public ITuneRequestImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  18. {
  19. // IMPEG2TuneRequest
  20. public:
  21. typedef ITuneRequestImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  22. IMPEG2TuneRequestImpl() : m_TSID(-1), m_ProgNo(-1) {}
  23. virtual ~IMPEG2TuneRequestImpl() {}
  24. BEGIN_PROP_MAP(IMPEG2TuneRequestImpl)
  25. CHAIN_PROP_MAP(basetype)
  26. PROP_DATA_ENTRY("TSID", m_TSID, VT_I4)
  27. PROP_DATA_ENTRY("ProgNo", m_ProgNo, VT_I4)
  28. END_PROP_MAP()
  29. long m_TSID;
  30. long m_ProgNo;
  31. STDMETHOD(get_TSID)(long *pVal)
  32. {
  33. try {
  34. if (!pVal) {
  35. return E_POINTER;
  36. }
  37. ATL_LOCKT();
  38. *pVal = m_TSID;
  39. } catch (...) {
  40. return E_POINTER;
  41. }
  42. return NOERROR;
  43. }
  44. STDMETHOD(put_TSID)(long newVal)
  45. {
  46. ATL_LOCKT();
  47. if (!m_TS) {
  48. return E_UNEXPECTED;
  49. }
  50. m_TSID = newVal;
  51. MARK_DIRTY(T);
  52. return NOERROR;
  53. }
  54. STDMETHOD(get_ProgNo)(long *pVal)
  55. {
  56. try {
  57. if (!pVal) {
  58. return E_POINTER;
  59. }
  60. ATL_LOCKT();
  61. *pVal = m_ProgNo;
  62. } catch (...) {
  63. return E_POINTER;
  64. }
  65. return NOERROR;
  66. }
  67. STDMETHOD(put_ProgNo)(long newVal)
  68. {
  69. ATL_LOCKT();
  70. if (!m_TS) {
  71. return E_UNEXPECTED;
  72. }
  73. m_ProgNo = newVal;
  74. MARK_DIRTY(T);
  75. return NOERROR;
  76. }
  77. STDMETHOD(Clone) (ITuneRequest **ppTR) {
  78. try {
  79. if (!ppTR) {
  80. return E_POINTER;
  81. }
  82. ATL_LOCKT();
  83. HRESULT hr = basetype::Clone(ppTR);
  84. if (FAILED(hr)) {
  85. return hr;
  86. }
  87. T* pt = static_cast<T*>(*ppTR);
  88. pt->m_TSID = m_TSID;
  89. pt->m_ProgNo = m_ProgNo;
  90. return NOERROR;
  91. } catch (HRESULT h) {
  92. return h;
  93. } catch (...) {
  94. return E_POINTER;
  95. }
  96. }
  97. };
  98. typedef CComQIPtr<IMPEG2TuneRequest> PQMPEG2TuneRequest;
  99. }; // namespace
  100. #endif // MPEG2TUNEREQUESTIMPL_H
  101. // end of file -- MPEG2tunerequestimpl.h