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.

71 lines
2.3 KiB

  1. // CounterMgr.h: interface for the CCounterMgr classes.
  2. //
  3. // MODULE: COUNTERMGR.H
  4. //
  5. // PUTPOSE: Global pool of pointers to status counters
  6. // These pointers can be accessed through name (string, like "Topic imsetup"
  7. // or "Thread 1") and counted event identifier (long).
  8. // There is only one instance of this class in the programm.
  9. // Manipulation with members of this class should be thread safe.
  10. //
  11. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  12. //
  13. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  14. //
  15. // AUTHOR: Oleg Kalosha
  16. //
  17. // ORIGINAL DATE: 10-20-98
  18. //
  19. // NOTES:
  20. //
  21. // Version Date By Comments
  22. //--------------------------------------------------------------------
  23. // V3.0 10-20-98 OK Original
  24. //
  25. //////////////////////////////////////////////////////////////////////
  26. #if !defined(AFX_COUNTERMGR_H__14CDE7A4_6844_11D2_8C42_00C04F949D33__INCLUDED_)
  27. #define AFX_COUNTERMGR_H__14CDE7A4_6844_11D2_8C42_00C04F949D33__INCLUDED_
  28. #if _MSC_VER >= 1000
  29. #pragma once
  30. #endif // _MSC_VER >= 1000
  31. #include "Stateless.h"
  32. #include "Counter.h"
  33. #include <vector>
  34. using namespace std;
  35. class CCounterMgr; // forward declaration
  36. CCounterMgr* Get_g_CounterMgr(); // Singleton to obtain g_CounterMgr global variable
  37. ////////////////////////////////////////////////////////////////////////////////////
  38. // CCounterMgr declaration
  39. ////////////////////////////////////////////////////////////////////////////////////
  40. class CCounterMgr : public CStateless
  41. {
  42. vector<CAbstractCounter*> m_arrCounterPool;
  43. public:
  44. CCounterMgr() {}
  45. virtual ~CCounterMgr() {}
  46. protected:
  47. CAbstractCounter* Exists(const CCounterLocation&) const;
  48. bool RemoveLocation(const CCounterLocation&);
  49. public:
  50. // adds counter with unique location
  51. // if counter with such location alredy exists, does nothing, returns false
  52. bool Add(const CAbstractCounter&);
  53. // adds counter with unique location
  54. // if counter with such location alredy exists, it is substituted with new counter
  55. void AddSubstitute(const CAbstractCounter&);
  56. // removes this particular counter
  57. // if the counter is not stored in the pool, returns false
  58. bool Remove(const CAbstractCounter&);
  59. CAbstractCounter* Get(const CCounterLocation&) const;
  60. };
  61. #endif // !defined(AFX_COUNTERMGR_H__14CDE7A4_6844_11D2_8C42_00C04F949D33__INCLUDED_)