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.

217 lines
6.1 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // Locatorimpl.h : implementation helper template for locator interface
  3. // Copyright (c) Microsoft Corporation 2000.
  4. #ifndef LOCATORIMPL_H
  5. #define LOCATORIMPL_H
  6. namespace BDATuningModel {
  7. template<class T,
  8. class MostDerived = ILocator,
  9. LPCGUID iid = &__uuidof(MostDerived),
  10. LPCGUID LibID = &LIBID_TunerLib,
  11. WORD wMajor = 1,
  12. WORD wMinor = 0,
  13. class tihclass = CComTypeInfoHolder
  14. > class ATL_NO_VTABLE ILocatorImpl :
  15. public IPersistPropertyBagImpl<T>,
  16. public IDispatchImpl<MostDerived, iid, LibID, wMajor, wMinor, tihclass>
  17. {
  18. // ILocator
  19. public:
  20. long m_Frequency;
  21. FECMethod m_InnerFECMethod;
  22. BinaryConvolutionCodeRate m_InnerFECRate;
  23. FECMethod m_OuterFECMethod;
  24. BinaryConvolutionCodeRate m_OuterFECRate;
  25. ModulationType m_Modulation;
  26. long m_SymbolRate;
  27. ILocatorImpl() : m_Frequency(-1),
  28. m_InnerFECMethod(BDA_FEC_METHOD_NOT_SET),
  29. m_InnerFECRate(BDA_BCC_RATE_NOT_SET),
  30. m_OuterFECMethod(BDA_FEC_METHOD_NOT_SET),
  31. m_OuterFECRate(BDA_BCC_RATE_NOT_SET),
  32. m_SymbolRate(-1),
  33. m_Modulation(BDA_MOD_NOT_SET) {}
  34. virtual ~ILocatorImpl() {}
  35. typedef ILocatorImpl<T, MostDerived, iid, LibID, wMajor, wMinor, tihclass> thistype;
  36. BEGIN_PROP_MAP(thistype)
  37. PROP_DATA_ENTRY("Frequency", m_Frequency, VT_I4)
  38. PROP_DATA_ENTRY("InnerFECMethod", m_InnerFECMethod, VT_I4)
  39. PROP_DATA_ENTRY("InnerFECRate", m_InnerFECRate, VT_I4)
  40. PROP_DATA_ENTRY("OuterFECMethod", m_OuterFECMethod, VT_I4)
  41. PROP_DATA_ENTRY("OuterFECRate", m_OuterFECRate, VT_I4)
  42. PROP_DATA_ENTRY("ModulationType", m_Modulation, VT_I4)
  43. PROP_DATA_ENTRY("SymbolRate", m_SymbolRate, VT_I4)
  44. END_PROP_MAP()
  45. // ILocator
  46. public:
  47. STDMETHOD(get_CarrierFrequency)(/*[out, retval]*/ long *pFrequency) {
  48. try {
  49. if (!pFrequency) {
  50. return E_POINTER;
  51. }
  52. ATL_LOCKT();
  53. *pFrequency = m_Frequency;
  54. return NOERROR;
  55. } catch (...) {
  56. return E_POINTER;
  57. }
  58. }
  59. STDMETHOD(put_CarrierFrequency)(/*[in]*/ long NewFrequency) {
  60. ATL_LOCKT();
  61. m_Frequency = NewFrequency;
  62. MARK_DIRTY(T);
  63. return NOERROR;
  64. }
  65. STDMETHOD(get_InnerFEC)(/*[out, retval]*/ FECMethod *pFEC) {
  66. try {
  67. if (!pFEC) {
  68. return E_POINTER;
  69. }
  70. ATL_LOCKT();
  71. *pFEC = m_InnerFECMethod;
  72. return NOERROR;
  73. } catch (...) {
  74. return E_POINTER;
  75. }
  76. }
  77. STDMETHOD(put_InnerFEC)(/*[in]*/ FECMethod NewFEC) {
  78. ATL_LOCKT();
  79. m_InnerFECMethod = NewFEC;
  80. MARK_DIRTY(T);
  81. return NOERROR;
  82. }
  83. STDMETHOD(get_InnerFECRate)(/*[out, retval]*/ BinaryConvolutionCodeRate *pFECRate) {
  84. try {
  85. if (!pFECRate) {
  86. return E_POINTER;
  87. }
  88. ATL_LOCKT();
  89. *pFECRate = m_InnerFECRate;
  90. return NOERROR;
  91. } catch (...) {
  92. return E_POINTER;
  93. }
  94. }
  95. STDMETHOD(put_InnerFECRate)(/*[in]*/ BinaryConvolutionCodeRate NewFECRate) {
  96. ATL_LOCKT();
  97. m_InnerFECRate = NewFECRate;
  98. MARK_DIRTY(T);
  99. return NOERROR;
  100. }
  101. STDMETHOD(get_OuterFEC)(/*[out, retval]*/ FECMethod *pFEC) {
  102. try {
  103. if (!pFEC) {
  104. return E_POINTER;
  105. }
  106. ATL_LOCKT();
  107. *pFEC = m_OuterFECMethod;
  108. return NOERROR;
  109. } catch (...) {
  110. return E_POINTER;
  111. }
  112. }
  113. STDMETHOD(put_OuterFEC)(/*[in]*/ FECMethod NewFEC) {
  114. ATL_LOCKT();
  115. m_OuterFECMethod = NewFEC;
  116. MARK_DIRTY(T);
  117. return NOERROR;
  118. }
  119. STDMETHOD(get_OuterFECRate)(/*[out, retval]*/ BinaryConvolutionCodeRate *pFECRate) {
  120. try {
  121. if (!pFECRate) {
  122. return E_POINTER;
  123. }
  124. ATL_LOCKT();
  125. *pFECRate = m_OuterFECRate;
  126. return NOERROR;
  127. } catch (...) {
  128. return E_POINTER;
  129. }
  130. }
  131. STDMETHOD(put_OuterFECRate)(/*[in]*/ BinaryConvolutionCodeRate NewFECRate) {
  132. ATL_LOCKT();
  133. m_OuterFECRate = NewFECRate;
  134. MARK_DIRTY(T);
  135. return NOERROR;
  136. }
  137. STDMETHOD(get_Modulation)(/*[out, retval]*/ ModulationType* pModulation) {
  138. try {
  139. if (!pModulation) {
  140. return E_POINTER;
  141. }
  142. ATL_LOCKT();
  143. *pModulation = m_Modulation;
  144. return NOERROR;
  145. } catch (...) {
  146. return E_POINTER;
  147. }
  148. }
  149. STDMETHOD(put_Modulation)(/*[in]*/ ModulationType NewModulation) {
  150. ATL_LOCKT();
  151. m_Modulation = NewModulation;
  152. MARK_DIRTY(T);
  153. return NOERROR;
  154. }
  155. STDMETHOD(get_SymbolRate)(/*[out, retval]*/ long* pSymbolRate) {
  156. try {
  157. if (!pSymbolRate) {
  158. return E_POINTER;
  159. }
  160. ATL_LOCKT();
  161. *pSymbolRate = m_SymbolRate;
  162. return NOERROR;
  163. } catch (...) {
  164. return E_POINTER;
  165. }
  166. }
  167. STDMETHOD(put_SymbolRate)(/*[in]*/ long NewSymbolRate) {
  168. ATL_LOCKT();
  169. m_SymbolRate = NewSymbolRate;
  170. MARK_DIRTY(T);
  171. return NOERROR;
  172. }
  173. STDMETHOD(Clone) (ILocator **ppL) {
  174. try {
  175. if (!ppL) {
  176. return E_POINTER;
  177. }
  178. ATL_LOCKT();
  179. T* pt = static_cast<T*>(new CComObject<T>);
  180. if (!pt) {
  181. return E_OUTOFMEMORY;
  182. }
  183. pt->m_Frequency = m_Frequency;
  184. pt->m_InnerFECMethod = m_InnerFECMethod;
  185. pt->m_InnerFECRate = m_InnerFECRate;
  186. pt->m_OuterFECMethod = m_OuterFECMethod;
  187. pt->m_OuterFECRate = m_OuterFECRate;
  188. pt->m_Modulation = m_Modulation;
  189. pt->m_SymbolRate = m_SymbolRate;
  190. pt->m_bRequiresSave = true;
  191. pt->AddRef();
  192. *ppL = pt;
  193. return NOERROR;
  194. } catch (HRESULT h) {
  195. return h;
  196. } catch (...) {
  197. return E_POINTER;
  198. }
  199. }
  200. };
  201. }; // namespace
  202. #endif // LOCATORIMPL_H
  203. // end of file -- locatorimpl.h