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.

181 lines
4.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // ATSCtsimpl.h :
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef ATSCTSIMPL_H
  5. #define ATSCTSIMPL_H
  6. #include "errsupp.h"
  7. #include "analogtvtsimpl.h"
  8. #include "ATSCChannelTuneRequest.h"
  9. namespace BDATuningModel {
  10. template<class T,
  11. class MostDerived = IATSCTuningSpace,
  12. LPCGUID iid = &__uuidof(MostDerived),
  13. LPCGUID LibID = &LIBID_TunerLib,
  14. WORD wMajor = 1,
  15. WORD wMinor = 0,
  16. class tihclass = CComTypeInfoHolder
  17. > class ATL_NO_VTABLE IATSCTSImpl :
  18. public IAnalogTVTSImpl<T, CATSCChannelTuneRequest, MostDerived, iid, LibID, wMajor, wMinor, tihclass>,
  19. public IMPEG2TuneRequestSupport
  20. {
  21. public:
  22. IATSCTSImpl() :
  23. m_MinMinorChannel(-1),
  24. m_MaxMinorChannel(-1),
  25. m_MinPhysicalChannel(-1),
  26. m_MaxPhysicalChannel(-1)
  27. {}
  28. virtual ~IATSCTSImpl() {}
  29. typedef IAnalogTVTSImpl<T, CATSCChannelTuneRequest, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  30. BEGIN_PROP_MAP(IATSCTSImpl)
  31. CHAIN_PROP_MAP(basetype)
  32. PROP_DATA_ENTRY("Min Minor Channel", m_MinMinorChannel, VT_I4)
  33. PROP_DATA_ENTRY("Max Minor Channel", m_MaxMinorChannel, VT_I4)
  34. PROP_DATA_ENTRY("Min Physical Channel", m_MinPhysicalChannel, VT_I4)
  35. PROP_DATA_ENTRY("Max Physical Channel", m_MaxPhysicalChannel, VT_I4)
  36. END_PROPERTY_MAP()
  37. long m_MinMinorChannel;
  38. long m_MaxMinorChannel;
  39. long m_MinPhysicalChannel;
  40. long m_MaxPhysicalChannel;
  41. // override standard ITuningSpaceImpl
  42. STDMETHOD(put_DefaultLocator)(ILocator *pLoc) {
  43. if (pLoc) {
  44. PQATSCLocator p(pLoc);
  45. if (!p) {
  46. return DISP_E_TYPEMISMATCH;
  47. }
  48. }
  49. return basetype::put_DefaultLocator(pLoc);
  50. }
  51. // IATSCTuningSpace
  52. STDMETHOD(get_MinMinorChannel)(long *pVal)
  53. {
  54. if (!pVal) {
  55. return E_POINTER;
  56. }
  57. ATL_LOCKT();
  58. *pVal = m_MinMinorChannel;
  59. return NOERROR;
  60. }
  61. STDMETHOD(put_MinMinorChannel)(long newVal)
  62. {
  63. ATL_LOCKT();
  64. if (newVal > m_MaxMinorChannel) {
  65. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IATSCTuningSpace), E_INVALIDARG);
  66. }
  67. m_MinMinorChannel = newVal;
  68. MARK_DIRTY(T);
  69. return NOERROR;
  70. }
  71. STDMETHOD(get_MaxMinorChannel)(long *pVal)
  72. {
  73. if (!pVal) {
  74. return E_POINTER;
  75. }
  76. ATL_LOCKT();
  77. *pVal = m_MaxMinorChannel;
  78. return NOERROR;
  79. }
  80. STDMETHOD(put_MaxMinorChannel)(long newVal)
  81. {
  82. ATL_LOCKT();
  83. if (newVal < m_MinMinorChannel) {
  84. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IATSCTuningSpace), E_INVALIDARG);
  85. }
  86. m_MaxMinorChannel = newVal;
  87. MARK_DIRTY(T);
  88. return NOERROR;
  89. }
  90. STDMETHOD(get_MinPhysicalChannel)(long *pVal)
  91. {
  92. if (!pVal) {
  93. return E_POINTER;
  94. }
  95. ATL_LOCKT();
  96. *pVal = m_MinPhysicalChannel;
  97. return NOERROR;
  98. }
  99. STDMETHOD(put_MinPhysicalChannel)(long newVal)
  100. {
  101. ATL_LOCKT();
  102. if (newVal > m_MaxPhysicalChannel) {
  103. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IATSCTuningSpace), E_INVALIDARG);
  104. }
  105. m_MinPhysicalChannel = newVal;
  106. MARK_DIRTY(T);
  107. return NOERROR;
  108. }
  109. STDMETHOD(get_MaxPhysicalChannel)(long *pVal)
  110. {
  111. if (!pVal) {
  112. return E_POINTER;
  113. }
  114. ATL_LOCKT();
  115. *pVal = m_MaxPhysicalChannel;
  116. return NOERROR;
  117. }
  118. STDMETHOD(put_MaxPhysicalChannel)(long newVal)
  119. {
  120. ATL_LOCKT();
  121. if (newVal < m_MinPhysicalChannel) {
  122. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IATSCTuningSpace), E_INVALIDARG);
  123. }
  124. m_MaxPhysicalChannel = newVal;
  125. MARK_DIRTY(T);
  126. return NOERROR;
  127. }
  128. STDMETHOD(Clone) (ITuningSpace **ppTS) {
  129. if (!ppTS) {
  130. return E_POINTER;
  131. }
  132. *ppTS = NULL;
  133. ATL_LOCKT();
  134. try {
  135. HRESULT hr = basetype::Clone(ppTS);
  136. if (FAILED(hr)) {
  137. return hr;
  138. }
  139. T* pt = static_cast<T*>(*ppTS);
  140. pt->m_MinMinorChannel = m_MinMinorChannel;
  141. pt->m_MaxMinorChannel = m_MaxMinorChannel;
  142. pt->m_MinPhysicalChannel = m_MinPhysicalChannel;
  143. pt->m_MaxPhysicalChannel = m_MaxPhysicalChannel;
  144. return NOERROR;
  145. } CATCHCOM_CLEANUP(if (*ppTS) {
  146. (*ppTS)->Release();
  147. *ppTS = NULL;
  148. }
  149. );
  150. }
  151. };
  152. }; // namespace
  153. #endif // ATSCTSIMPL_H
  154. // end of file -- ATSCtsimpl.h