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.

94 lines
2.1 KiB

  1. /*++
  2. Copyright (C) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. WBEMDNF.H
  5. Abstract:
  6. WBEM Evaluation Tree
  7. History:
  8. --*/
  9. #ifndef __WBEM_DNF__H_
  10. #define __WBEM_DNF__H_
  11. #include "esscpol.h"
  12. #include <parmdefs.h>
  13. #include <ql.h>
  14. #include <wbemcomn.h>
  15. #include <sync.h>
  16. #include <newnew.h>
  17. class CTokenFilter
  18. {
  19. public:
  20. CTokenFilter(){}
  21. virtual ~CTokenFilter(){}
  22. virtual BOOL IsRelevant(QL_LEVEL_1_TOKEN* pToken) = 0;
  23. };
  24. class CConjunction
  25. {
  26. protected:
  27. CUniquePointerArray<QL_LEVEL_1_TOKEN> m_apTokens;
  28. static CReuseMemoryManager mstatic_Manager;
  29. public:
  30. CConjunction();
  31. CConjunction(QL_LEVEL_1_TOKEN& Token, BOOL bNegate);
  32. CConjunction(CConjunction& Other);
  33. CConjunction(CConjunction& Other1, CConjunction& Other2);
  34. long GetNumTokens() {return m_apTokens.GetSize();}
  35. INTERNAL QL_LEVEL_1_TOKEN* GetTokenAt(int nIndex)
  36. {return m_apTokens[nIndex];}
  37. BOOL AddToken(ACQUIRE QL_LEVEL_1_TOKEN* pNew)
  38. { return m_apTokens.Add(pNew); }
  39. void Sort();
  40. HRESULT GetNecessaryProjection( CTokenFilter* pFilter,
  41. CConjunction** ppResult);
  42. static int NegateOperator(int nOperator);
  43. void *operator new(size_t nBlock);
  44. void operator delete(void* p);
  45. };
  46. class CDNFExpression
  47. {
  48. protected:
  49. CUniquePointerArray<CConjunction> m_apTerms;
  50. protected:
  51. BOOL CreateFromToken(QL_LEVEL_1_TOKEN& Token, BOOL bNegate);
  52. HRESULT CreateOr(CDNFExpression& Arg1, CDNFExpression& Arg2,
  53. long& lMaxTokens);
  54. HRESULT CreateAnd(CDNFExpression& Arg1, CDNFExpression& Arg2,
  55. long& lMaxTokens);
  56. public:
  57. long GetNumTerms() {return m_apTerms.GetSize();}
  58. INTERNAL CConjunction* GetTermAt(int nIndex)
  59. {return m_apTerms[nIndex];}
  60. void AddTerm(ACQUIRE CConjunction* pNew)
  61. {m_apTerms.Add(pNew);}
  62. HRESULT CreateFromTokens(QL_LEVEL_1_TOKEN*& pLastToken, BOOL bNegate,
  63. long& lMaxTokens);
  64. void Sort();
  65. public:
  66. HRESULT GetNecessaryProjection(CTokenFilter* pFilter,
  67. CDNFExpression** ppResult);
  68. };
  69. #endif