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.

110 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FaxInboundRoutingMethods.h
  5. Abstract:
  6. Declaration of the CFaxInboundRoutingMethods class.
  7. Author:
  8. Iv Garber (IvG) Jun, 2000
  9. Revision History:
  10. --*/
  11. #ifndef __FAXINBOUNDROUTINGMETHODS_H_
  12. #define __FAXINBOUNDROUTINGMETHODS_H_
  13. #include "resource.h" // main symbols
  14. #include <vector>
  15. #include "VCUE_Copy.h"
  16. #include "FaxCommon.h"
  17. namespace MethodsNamespace
  18. {
  19. //
  20. // Method Objects are stored in Vector of STL.
  21. // When initialized, they got ALL their data, and Fax Server Ptr.
  22. // They do not depend on Methods Collection, only on Fax Server.
  23. // So, they implemented as usual COM Objects.
  24. // They inherit from CFaxInitInnerAddRef class, which means they make AddRef()
  25. // on Fax Server ( at Init() ).
  26. // By doing this, the objects prevent the death of the Fax Server prematurely.
  27. // So, if the User frees all its references to the Fax Server, but holds its
  28. // reference to the Method Object, the Method Object will continue to work,
  29. // because Fax Server Object actually did not died.
  30. // The Collection stores Ptrs to them, and makes ONE AddRef().
  31. // Each time User asks for an Object from the Collection, an additional AddRef() happens.
  32. // When killed, Collection calls Release() on all its Method Objects.
  33. // Those that were not requested by the User, dies.
  34. // Those, that have User's AddRef() - remains alive, untill User frees its Reference on them.
  35. // Fax Server remains alive untill all the Methods Collections and all Method Objects are killed.
  36. // At their death, they Release() the Fax Server.
  37. //
  38. typedef std::vector<IFaxInboundRoutingMethod*> ContainerType;
  39. // Use IEnumVARIANT as the enumerator for VB compatibility
  40. typedef VARIANT EnumExposedType;
  41. typedef IEnumVARIANT EnumIfc;
  42. // Copy Classes
  43. typedef VCUE::CopyIfc2Variant<ContainerType::value_type> EnumCopyType;
  44. typedef VCUE::CopyIfc<ContainerType::value_type> CollectionCopyType;
  45. typedef CComEnumOnSTL< EnumIfc, &__uuidof(EnumIfc), EnumExposedType, EnumCopyType,
  46. ContainerType > EnumType;
  47. typedef ICollectionOnSTLImpl< IFaxInboundRoutingMethods, ContainerType, ContainerType::value_type,
  48. CollectionCopyType, EnumType > CollectionType;
  49. };
  50. using namespace MethodsNamespace;
  51. //
  52. //================= FAX INBOUND ROUTING METHODS ============================================
  53. //
  54. class ATL_NO_VTABLE CFaxInboundRoutingMethods :
  55. public CComObjectRootEx<CComSingleThreadModel>,
  56. public ISupportErrorInfo,
  57. public IDispatchImpl<MethodsNamespace::CollectionType, &IID_IFaxInboundRoutingMethods, &LIBID_FAXCOMEXLib>,
  58. public CFaxInitInner // for Debug + Creation thru CObjectHandler
  59. {
  60. public:
  61. CFaxInboundRoutingMethods() : CFaxInitInner(_T("FAX INBOUND ROUTING METHODS"))
  62. {
  63. }
  64. ~CFaxInboundRoutingMethods()
  65. {
  66. CCollectionKiller<MethodsNamespace::ContainerType> CKiller;
  67. CKiller.EmptyObjectCollection(&m_coll);
  68. }
  69. DECLARE_REGISTRY_RESOURCEID(IDR_FAXINBOUNDROUTINGMETHODS)
  70. DECLARE_NOT_AGGREGATABLE(CFaxInboundRoutingMethods)
  71. DECLARE_PROTECT_FINAL_CONSTRUCT()
  72. BEGIN_COM_MAP(CFaxInboundRoutingMethods)
  73. COM_INTERFACE_ENTRY(IFaxInboundRoutingMethods)
  74. COM_INTERFACE_ENTRY(IDispatch)
  75. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  76. COM_INTERFACE_ENTRY(IFaxInitInner)
  77. END_COM_MAP()
  78. // Interfaces
  79. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  80. STDMETHOD(get_Item)(/*[in]*/ VARIANT vIndex, /*[out, retval]*/ IFaxInboundRoutingMethod **ppMethod);
  81. // Internal Use
  82. static HRESULT Create(IFaxInboundRoutingMethods **ppMethods);
  83. STDMETHOD(Init)(IFaxServerInner *pServer);
  84. };
  85. #endif //__FAXINBOUNDROUTINGMETHODS_H_