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.

112 lines
2.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // ATSCChannelTuneRequestimpl.h : implementation helper template for component type interface
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef ATSCCHANNELTUNEREQUESTIMPL_H
  5. #define ATSCCHANNELTUNEREQUESTIMPL_H
  6. #include "channeltunerequestimpl.h"
  7. #include "atsclocator.h"
  8. namespace BDATuningModel {
  9. template<class T,
  10. class MostDerived = IATSCChannelTuneRequest,
  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 IATSCChannelTuneRequestImpl :
  17. public IChannelTuneRequestImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  18. {
  19. // IATSCChannelTuneRequest
  20. public:
  21. typedef IChannelTuneRequestImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  22. virtual ~IATSCChannelTuneRequestImpl() {}
  23. IATSCChannelTuneRequestImpl() : m_MinorChannel(-1){}
  24. BEGIN_PROP_MAP(IATSCChannelTuneRequestImpl)
  25. CHAIN_PROP_MAP(basetype)
  26. PROP_DATA_ENTRY("Minor Channel", m_MinorChannel, VT_I4)
  27. END_PROP_MAP()
  28. long m_MinorChannel;
  29. STDMETHOD(get_MinorChannel)(long *pVal)
  30. {
  31. try {
  32. if (!pVal) {
  33. return E_POINTER;
  34. }
  35. ATL_LOCKT();
  36. *pVal = m_MinorChannel;
  37. } catch (...) {
  38. return E_POINTER;
  39. }
  40. return NOERROR;
  41. }
  42. STDMETHOD(put_MinorChannel)(long newVal)
  43. {
  44. ATL_LOCKT();
  45. TNATSCTuningSpace ts(m_TS);
  46. if (!m_TS) {
  47. return E_UNEXPECTED;
  48. }
  49. if (newVal != BDA_UNDEFINED_CHANNEL) {
  50. if (newVal < ts.MinMinorChannel()) {
  51. newVal = ts.MaxMinorChannel();
  52. } else if (newVal > ts.MaxMinorChannel()) {
  53. newVal = ts.MinMinorChannel();
  54. }
  55. }
  56. m_MinorChannel = newVal;
  57. MARK_DIRTY(T);
  58. return NOERROR;
  59. }
  60. STDMETHOD(Clone) (ITuneRequest **ppTR) {
  61. try {
  62. if (!ppTR) {
  63. return E_POINTER;
  64. }
  65. ATL_LOCKT();
  66. HRESULT hr = basetype::Clone(ppTR);
  67. if (FAILED(hr)) {
  68. return hr;
  69. }
  70. T* pt = static_cast<T*>(*ppTR);
  71. pt->m_MinorChannel = m_MinorChannel;
  72. return NOERROR;
  73. } catch (HRESULT h) {
  74. return h;
  75. } catch (...) {
  76. return E_POINTER;
  77. }
  78. }
  79. STDMETHOD(put_Locator)(ILocator *pLocator)
  80. {
  81. try {
  82. if (pLocator) {
  83. PQATSCLocator pL(pLocator);
  84. if (!pL) {
  85. return DISP_E_TYPEMISMATCH;
  86. }
  87. }
  88. return basetype::put_Locator(pLocator);
  89. } catch (...) {
  90. return E_POINTER;
  91. }
  92. }
  93. };
  94. }; // namespace
  95. #endif // ATSCCHANNELTUNEREQUESTIMPL_H
  96. // end of file -- atschchanneltunerequestimpl.h