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.

118 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FaxOutboundRoutingGroups.h
  5. Abstract:
  6. Declaration of the CFaxOutboundRoutingGroups class.
  7. Author:
  8. Iv Garber (IvG) Jun, 2000
  9. Revision History:
  10. --*/
  11. #ifndef __FAXOUTBOUNDROUTINGGROUPS_H_
  12. #define __FAXOUTBOUNDROUTINGGROUPS_H_
  13. #include "resource.h" // main symbols
  14. #include <vector>
  15. #include "VCUE_Copy.h"
  16. #include "FaxCommon.h"
  17. namespace GroupsNamespace
  18. {
  19. //
  20. // Group Objects are stored in Vector of STL.
  21. //
  22. // When initialized, they got ALL their data, and Fax Server Ptr.
  23. // They do NOT depend on Groups Collection, and NOT on the Fax Server Object.
  24. //
  25. // The Collection makes ONE AddRef() for each Group Object, to prevent its death.
  26. // When killed, Collection calls Release() on all its Group Objects.
  27. //
  28. typedef std::vector<IFaxOutboundRoutingGroup*> ContainerType;
  29. // Use IEnumVARIANT as the enumerator for VB compatibility
  30. typedef VARIANT EnumExposedType;
  31. typedef IEnumVARIANT EnumIfc;
  32. // Copy Classes
  33. typedef VCUE::CopyIfc2Variant<ContainerType::value_type> EnumCopyType;
  34. typedef VCUE::CopyIfc<ContainerType::value_type> CollectionCopyType;
  35. typedef CComEnumOnSTL< EnumIfc, &__uuidof(EnumIfc), EnumExposedType, EnumCopyType,
  36. ContainerType > EnumType;
  37. typedef ICollectionOnSTLImpl< IFaxOutboundRoutingGroups, ContainerType,
  38. ContainerType::value_type, CollectionCopyType, EnumType > CollectionType;
  39. };
  40. using namespace GroupsNamespace;
  41. //
  42. //==================== FAX OUTBOUND ROUTING GROUPS ===================================
  43. //
  44. // FaxOutboundRoutingGroups creates a collection of all its Group Objects at Init.
  45. // It needs Ptr to the Fax Server Object, for Add and Remove operations.
  46. // To prevent the death of the Fax Server before its own death, the Collection
  47. // makes AddRef() on Server. To do this, it inherits from CFaxInitInnerAddRef.
  48. //
  49. // When creating Group Objects, the Collection passes Ptr to the Fax Server Object
  50. // to them, and from this moment, the Objects are not dependent on the Collection.
  51. // They live their own lifes. Collection makes one AddRef() on them, to prevent their
  52. // death before its own death, exactly as in the case with the Fax Server Object.
  53. //
  54. // The Group Object itself does NOT need Ptr to the Fax Server Object.
  55. //
  56. class ATL_NO_VTABLE CFaxOutboundRoutingGroups :
  57. public CComObjectRootEx<CComSingleThreadModel>,
  58. public ISupportErrorInfo,
  59. public IDispatchImpl<GroupsNamespace::CollectionType, &IID_IFaxOutboundRoutingGroups, &LIBID_FAXCOMEXLib>,
  60. public CFaxInitInnerAddRef
  61. {
  62. public:
  63. CFaxOutboundRoutingGroups() : CFaxInitInnerAddRef(_T("FAX OUTBOUND ROUTING GROUPS"))
  64. {
  65. }
  66. ~CFaxOutboundRoutingGroups()
  67. {
  68. CCollectionKiller<GroupsNamespace::ContainerType> CKiller;
  69. CKiller.EmptyObjectCollection(&m_coll);
  70. }
  71. DECLARE_REGISTRY_RESOURCEID(IDR_FAXOUTBOUNDROUTINGGROUPS)
  72. DECLARE_NOT_AGGREGATABLE(CFaxOutboundRoutingGroups)
  73. DECLARE_PROTECT_FINAL_CONSTRUCT()
  74. BEGIN_COM_MAP(CFaxOutboundRoutingGroups)
  75. COM_INTERFACE_ENTRY(IFaxOutboundRoutingGroups)
  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]*/ IFaxOutboundRoutingGroup **ppGroup);
  83. STDMETHOD(Remove)(/*[in]*/ VARIANT vIndex);
  84. STDMETHOD(Add)(/*[in]*/ BSTR bstrName, /*[out, retval]*/ IFaxOutboundRoutingGroup **ppGroup);
  85. // Internal Use
  86. static HRESULT Create(IFaxOutboundRoutingGroups **ppGroups);
  87. STDMETHOD(Init)(IFaxServerInner *pServer);
  88. private:
  89. STDMETHOD(AddGroup)(/*[in]*/ FAX_OUTBOUND_ROUTING_GROUP *pInfo, IFaxOutboundRoutingGroup **ppNewGroup = NULL);
  90. STDMETHOD(FindGroup)(/*[in]*/ VARIANT vIndex, /*[out]*/ GroupsNamespace::ContainerType::iterator &it);
  91. };
  92. #endif //__FAXOUTBOUNDROUTINGGROUPS_H_