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.

62 lines
1.2 KiB

  1. // TreeChecker.h
  2. #ifndef __TREE_CHECKER_H
  3. #define __TREE_CHECKER_H
  4. #ifdef CHECK_TREES
  5. class CEvalTree;
  6. class CEvalNode;
  7. #include <map>
  8. #include <sync.h>
  9. typedef std::map< CEvalTree*,
  10. BOOL,
  11. std::less<CEvalTree*>,
  12. wbem_allocator< BOOL > > CTreeMap;
  13. typedef CTreeMap::iterator CTreeMapItor;
  14. typedef std::map< CEvalNode*,
  15. BOOL,
  16. std::less< CEvalNode* >,
  17. wbem_allocator< BOOL > > CNodeMap;
  18. typedef CNodeMap::iterator CNodeMapItor;
  19. class CTreeChecker
  20. {
  21. public:
  22. CCritSec m_cs;
  23. // Called by the tree ctor.
  24. void AddTree(CEvalTree *pTree);
  25. // Called by the tree dtor.
  26. void RemoveTree(CEvalTree *pTree);
  27. // Called by the node ctor.
  28. void AddNode(CEvalNode *pNode);
  29. // Called by the node dtor.
  30. void RemoveNode(CEvalNode *pNode);
  31. // Called by nodes during a CheckTrees() call to indicate
  32. // a node is accounted for.
  33. void CheckoffNode(CEvalNode *pNode);
  34. // Used to check the validity of all trees.
  35. BOOL CheckTreeNodes();
  36. protected:
  37. CTreeMap m_mapTrees;
  38. CNodeMap m_mapNodes,
  39. *m_pmapNodesTemp;
  40. };
  41. extern CTreeChecker g_treeChecker;
  42. #define CheckTrees() g_treeChecker.CheckTreeNodes();
  43. #endif
  44. #endif