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.

113 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FaxDeviceProviders.h
  5. Abstract:
  6. Declaration of the CFaxDeviceProviders Class.
  7. Author:
  8. Iv Garber (IvG) Jun, 2000
  9. Revision History:
  10. --*/
  11. #ifndef __FAXDEVICEPROVIDERS_H_
  12. #define __FAXDEVICEPROVIDERS_H_
  13. #include "resource.h" // main symbols
  14. #include "FaxCommon.h"
  15. #include <vector>
  16. #include "VCUE_Copy.h"
  17. #include "FaxDeviceProvider.h"
  18. namespace DeviceProvidersNamespace
  19. {
  20. //
  21. // Device Provider Objects are stored in Vector of STL.
  22. // When initialized, they got ALL their data.
  23. // They never call Fax Server.
  24. // They do not depend neither on Fax Server nor on Device Providers Collection
  25. // after they are created and initialized.
  26. // So, they implemented as usual COM Objects.
  27. // The Collection stores Ptrs to them, and makes ONE AddRef().
  28. // Each time User asks for an Object from the Collection, an additional AddRef() happens.
  29. // When killed, Collection calls Release() on all its Device Provider Objects.
  30. // Those that are not asked by User, dies.
  31. // Those, that have User's AddRef() - remains alive, untill User free its Reference on them.
  32. // The Device Provider Object can continue to live after all objects are freed,
  33. // including Fax Server and all its Descendants.
  34. // THIS IS BECAUSE Device Provider Object and their Collection is Snap-Shot
  35. // of the situation on the Server. They are not updatable, but a read-only objects.
  36. // To get the updated data, User must ask new Collection from the Server.
  37. //
  38. typedef std::vector<IFaxDeviceProvider*> 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. // Enumeration Type, shortcut for next typedef
  46. typedef CComEnumOnSTL< EnumIfc, &__uuidof(EnumIfc), EnumExposedType, EnumCopyType, ContainerType >
  47. EnumType;
  48. // Collection Type, real ancestor of the DeviceProvider Collection
  49. typedef ICollectionOnSTLImpl< IFaxDeviceProviders, ContainerType, ContainerType::value_type,
  50. CollectionCopyType, EnumType > CollectionType;
  51. };
  52. using namespace DeviceProvidersNamespace;
  53. //
  54. //==================== FAX DEVICE PROVIDERS ===========================================
  55. //
  56. class ATL_NO_VTABLE CFaxDeviceProviders :
  57. public CComObjectRootEx<CComSingleThreadModel>,
  58. public ISupportErrorInfo,
  59. public IDispatchImpl<DeviceProvidersNamespace::CollectionType, &IID_IFaxDeviceProviders,
  60. &LIBID_FAXCOMEXLib>,
  61. public CFaxInitInner
  62. {
  63. public:
  64. CFaxDeviceProviders() : CFaxInitInner(_T("FAX DEVICE PROVIDERS"))
  65. {}
  66. ~CFaxDeviceProviders()
  67. {
  68. CCollectionKiller<DeviceProvidersNamespace::ContainerType> CKiller;
  69. CKiller.EmptyObjectCollection(&m_coll);
  70. }
  71. DECLARE_REGISTRY_RESOURCEID(IDR_FAXDEVICEPROVIDERS)
  72. DECLARE_NOT_AGGREGATABLE(CFaxDeviceProviders)
  73. DECLARE_PROTECT_FINAL_CONSTRUCT()
  74. BEGIN_COM_MAP(CFaxDeviceProviders)
  75. COM_INTERFACE_ENTRY(IFaxDeviceProviders)
  76. COM_INTERFACE_ENTRY(IDispatch)
  77. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  78. COM_INTERFACE_ENTRY(IFaxInitInner)
  79. END_COM_MAP()
  80. // Interfaces
  81. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  82. STDMETHOD(get_Item)(/*[in]*/ VARIANT vIndex, /*[out, retval]*/ IFaxDeviceProvider **ppDeviceProvider);
  83. // Internal Use
  84. STDMETHOD(Init)(IFaxServerInner *pServerInner);
  85. static HRESULT Create(IFaxDeviceProviders **ppDeviceProviders);
  86. };
  87. #endif //__FAXDEVICEPROVIDERS_H_