Source code of Windows XP (NT5)
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.

68 lines
2.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright(C) 2000 Microsoft Corporation all rights reserved.
  4. //
  5. // Module: ProxyServerGroupCollection.cpp
  6. //
  7. // Project: Windows 2000 IAS
  8. //
  9. // Description: Implementation of CProxyServerGroupCollection
  10. //
  11. // Author: tperraut
  12. //
  13. // Revision 02/24/2000 created
  14. //
  15. /////////////////////////////////////////////////////////////////////////////
  16. #include "stdafx.h"
  17. #include "ProxyServerGroupCollection.h"
  18. CProxyServerGroupCollection CProxyServerGroupCollection::_instance;
  19. CProxyServerGroupCollection& CProxyServerGroupCollection::Instance()
  20. {
  21. return _instance;
  22. }
  23. //////////////////////////////////////////////////////////////////////////////
  24. // Add
  25. //////////////////////////////////////////////////////////////////////////////
  26. CProxyServersGroupHelper* CProxyServerGroupCollection::Add(
  27. CProxyServersGroupHelper& ServerGroup
  28. )
  29. {
  30. _bstr_t GroupName = ServerGroup.GetName();
  31. // try to find if the group already exists
  32. ServerGroupMap::iterator MapIterator = m_ServerGroupMap.find(GroupName);
  33. if ( MapIterator != m_ServerGroupMap.end() )
  34. {
  35. // found in the map. Return it
  36. return &(MapIterator->second);
  37. }
  38. else
  39. {
  40. // insert and return it
  41. m_ServerGroupMap.insert(ServerGroupMap::value_type(
  42. GroupName,
  43. ServerGroup
  44. ));
  45. // get the newly inserted servergroup (i.e. it was copied)
  46. MapIterator = m_ServerGroupMap.find(GroupName);
  47. return &(MapIterator->second);
  48. }
  49. }
  50. //////////////////////////////////////////////////////////////////////////////
  51. // Persist
  52. //////////////////////////////////////////////////////////////////////////////
  53. void CProxyServerGroupCollection::Persist()
  54. {
  55. // for each serversgroup
  56. ServerGroupMap::iterator MapIterator = m_ServerGroupMap.begin();
  57. while (MapIterator != m_ServerGroupMap.end())
  58. {
  59. MapIterator->second.Persist();
  60. ++MapIterator;
  61. }
  62. }