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.

129 lines
3.5 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // ATSCLocatorimpl.h : implementation helper template for ATSClocator interface
  3. // Copyright (c) Microsoft Corporation 2000.
  4. #ifndef ATSCLOCATORIMPL_H
  5. #define ATSCLOCATORIMPL_H
  6. #include <locatorimpl.h>
  7. namespace BDATuningModel {
  8. template<class T,
  9. class MostDerived = IATSCLocator,
  10. LPCGUID iid = &__uuidof(MostDerived),
  11. LPCGUID LibID = &LIBID_TunerLib,
  12. WORD wMajor = 1,
  13. WORD wMinor = 0,
  14. class tihclass = CComTypeInfoHolder
  15. > class ATL_NO_VTABLE IATSCLocatorImpl :
  16. public ILocatorImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  17. {
  18. // IATSCLocator
  19. public:
  20. typedef ILocatorImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  21. typedef IATSCLocatorImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> thistype;
  22. long m_PhysicalChannel;
  23. long m_TSID;
  24. long m_ProgramNumber;
  25. IATSCLocatorImpl() : m_PhysicalChannel(BDA_UNDEFINED_CHANNEL),
  26. m_TSID(-1),
  27. m_ProgramNumber(-1) {}
  28. virtual ~IATSCLocatorImpl() {}
  29. BEGIN_PROP_MAP(thistype)
  30. CHAIN_PROP_MAP(basetype)
  31. PROP_DATA_ENTRY("Physical Channel", m_PhysicalChannel, VT_I4)
  32. PROP_DATA_ENTRY("Transport Stream ID", m_TSID, VT_I4)
  33. PROP_DATA_ENTRY("Program Number", m_ProgramNumber, VT_I4)
  34. END_PROP_MAP()
  35. // IATSCLocator
  36. public:
  37. STDMETHOD(get_PhysicalChannel)(/*[out, retval]*/ long *pPhysicalChannel) {
  38. try {
  39. if (!pPhysicalChannel) {
  40. return E_POINTER;
  41. }
  42. ATL_LOCKT();
  43. *pPhysicalChannel = m_PhysicalChannel;
  44. return NOERROR;
  45. } catch (...) {
  46. return E_POINTER;
  47. }
  48. }
  49. STDMETHOD(put_PhysicalChannel)(/*[in]*/ long NewPhysicalChannel) {
  50. ATL_LOCKT();
  51. m_PhysicalChannel = NewPhysicalChannel;
  52. MARK_DIRTY(T);
  53. return NOERROR;
  54. }
  55. STDMETHOD(get_TSID)(/*[out, retval]*/ long *pTSID) {
  56. try {
  57. if (!pTSID) {
  58. return E_POINTER;
  59. }
  60. ATL_LOCKT();
  61. *pTSID = m_TSID;
  62. return NOERROR;
  63. } catch (...) {
  64. return E_POINTER;
  65. }
  66. }
  67. STDMETHOD(put_TSID)(/*[in]*/ long NewTSID) {
  68. ATL_LOCKT();
  69. m_TSID = NewTSID;
  70. MARK_DIRTY(T);
  71. return NOERROR;
  72. }
  73. STDMETHOD(get_ProgramNumber)(/*[out, retval]*/ long *pProgramNumber) {
  74. try {
  75. if (!pProgramNumber) {
  76. return E_POINTER;
  77. }
  78. ATL_LOCKT();
  79. *pProgramNumber = m_ProgramNumber;
  80. return NOERROR;
  81. } catch (...) {
  82. return E_POINTER;
  83. }
  84. }
  85. STDMETHOD(put_ProgramNumber)(/*[in]*/ long NewProgramNumber) {
  86. ATL_LOCKT();
  87. m_ProgramNumber = NewProgramNumber;
  88. MARK_DIRTY(T);
  89. return NOERROR;
  90. }
  91. STDMETHOD(Clone) (ILocator **ppNew) {
  92. try {
  93. if (!ppNew) {
  94. return E_POINTER;
  95. }
  96. ATL_LOCKT();
  97. HRESULT hr = basetype::Clone(ppNew);
  98. if (FAILED(hr)) {
  99. return hr;
  100. }
  101. T* pt = static_cast<T*>(*ppNew);
  102. pt->m_PhysicalChannel = m_PhysicalChannel;
  103. pt->m_TSID = m_TSID;
  104. pt->m_ProgramNumber = m_ProgramNumber;
  105. return NOERROR;
  106. } catch (HRESULT h) {
  107. return h;
  108. } catch (...) {
  109. return E_POINTER;
  110. }
  111. }
  112. };
  113. typedef CComQIPtr<IATSCLocator> PQATSCLocator;
  114. }; // namespace
  115. #endif // ATSCLOCATORIMPL_H
  116. // end of file -- ATSClocatorimpl.h