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.

144 lines
3.4 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // analogradiotsimpl.h :
  3. // Copyright (c) Microsoft Corporation 1999.
  4. #ifndef ANALOGRADIOTSIMPL_H
  5. #define ANALOGRADIOTSIMPL_H
  6. #include "tuningspaceimpl.h"
  7. namespace BDATuningModel {
  8. template<class T,
  9. class MostDerived = IAnalogRadioTuningSpace,
  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 IAnalogRadioTSImpl :
  16. public ITuningSpaceImpl<T, CChannelTuneRequest, MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  17. {
  18. public:
  19. IAnalogRadioTSImpl() : m_MinFreq(BDA_UNDEFINED_CHANNEL), m_MaxFreq(BDA_UNDEFINED_CHANNEL), m_Step(0) {}
  20. virtual ~IAnalogRadioTSImpl() {}
  21. typedef ITuningSpaceImpl<T, CChannelTuneRequest, MostDerived, iid, LibID, wMajor, wMinor, tihclass> basetype;
  22. BEGIN_PROP_MAP(IAnalogRadioTSImpl)
  23. CHAIN_PROP_MAP(basetype)
  24. PROP_DATA_ENTRY("MinFrequency", m_MinFreq, VT_I4)
  25. PROP_DATA_ENTRY("MaxFrequency", m_MaxFreq, VT_I4)
  26. PROP_DATA_ENTRY("Step", m_Step, VT_I4)
  27. END_PROPERTY_MAP()
  28. long m_MinFreq;
  29. long m_MaxFreq;
  30. long m_Step;
  31. // IAnalogRadioTS
  32. STDMETHOD(get_MinFrequency)(long *pVal)
  33. {
  34. try {
  35. if (!pVal) {
  36. return E_POINTER;
  37. }
  38. ATL_LOCKT();
  39. *pVal = m_MinFreq;
  40. } catch (...) {
  41. return E_POINTER;
  42. }
  43. return NOERROR;
  44. }
  45. STDMETHOD(put_MinFrequency)(long newVal)
  46. {
  47. ATL_LOCKT();
  48. if (newVal > m_MaxFreq) {
  49. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IAnalogRadioTuningSpace), E_INVALIDARG);
  50. }
  51. m_MinFreq = newVal;
  52. MARK_DIRTY(T);
  53. return NOERROR;
  54. }
  55. STDMETHOD(get_MaxFrequency)(long *pVal)
  56. {
  57. try {
  58. if (!pVal) {
  59. return E_POINTER;
  60. }
  61. ATL_LOCKT();
  62. *pVal = m_MaxFreq;
  63. } catch (...) {
  64. return E_POINTER;
  65. }
  66. return NOERROR;
  67. }
  68. STDMETHOD(put_MaxFrequency)(long newVal)
  69. {
  70. if (newVal < m_MinFreq) {
  71. return ImplReportError(__uuidof(T), IDS_E_INVALIDARG, __uuidof(IAnalogRadioTuningSpace), E_INVALIDARG);
  72. }
  73. ATL_LOCKT();
  74. m_MaxFreq = newVal;
  75. MARK_DIRTY(T);
  76. return NOERROR;
  77. }
  78. STDMETHOD(get_Step)(long* pVal)
  79. {
  80. try {
  81. if (!pVal) {
  82. return E_POINTER;
  83. }
  84. ATL_LOCKT();
  85. *pVal = m_Step;
  86. } catch (...) {
  87. return E_POINTER;
  88. }
  89. return NOERROR;
  90. }
  91. STDMETHOD(put_Step)(long newVal)
  92. {
  93. ATL_LOCKT();
  94. m_Step = newVal;
  95. MARK_DIRTY(T);
  96. return NOERROR;
  97. }
  98. STDMETHOD(Clone) (ITuningSpace **ppTS) {
  99. try {
  100. if (!ppTS) {
  101. return E_POINTER;
  102. }
  103. ATL_LOCKT();
  104. HRESULT hr = basetype::Clone(ppTS);
  105. if (FAILED(hr)) {
  106. return hr;
  107. }
  108. T* pt = static_cast<T*>(*ppTS);
  109. pt->m_MinFreq = m_MinFreq;
  110. pt->m_MaxFreq = m_MaxFreq;
  111. pt->m_Step = m_Step;
  112. return NOERROR;
  113. } catch (HRESULT h) {
  114. return h;
  115. } catch (...) {
  116. return E_POINTER;
  117. }
  118. }
  119. };
  120. }; // namespace
  121. #endif // ANALOGRADIOTSIMPL_H
  122. // end of file -- analogradiotsimpl.h