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.

289 lines
8.2 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. TWOPROPNODE.H
  5. Abstract:
  6. Two Prop Node
  7. History:
  8. --*/
  9. // classes to support a two-property node for the eval tree
  10. // this will be much like the CPropertyNode defined in EvalTree.h
  11. // but it will compare a property against another property
  12. // rather than a property to a constant
  13. #ifndef _WBEM_TWOPROPNODE_H_
  14. #define _WBEM_TWOPROPNODE_H_
  15. #include "EvalTree.h"
  16. // virtual base class, good stuff derives from this
  17. class CTwoPropNode : public CPropertyNode
  18. {
  19. public:
  20. // various methods to create a new thingie.
  21. CTwoPropNode() : m_lRightPropHandle(-1), m_pRightInfo(NULL)
  22. {}
  23. CTwoPropNode(const CTwoPropNode& Other, BOOL bChildren = TRUE)
  24. : CPropertyNode(Other, bChildren), m_lRightPropHandle(Other.m_lRightPropHandle)
  25. {
  26. if (Other.m_pRightInfo)
  27. m_pRightInfo = new CEmbeddingInfo(*(Other.m_pRightInfo));
  28. else
  29. m_pRightInfo = NULL;
  30. }
  31. virtual CTwoPropNode* CloneSelfWithoutChildren() const =0;
  32. // evaluate
  33. virtual int SubCompare(CEvalNode* pNode);
  34. // integrating and combining into tree structure
  35. void SetRightPropertyInfo(LPCWSTR wszRightPropName, long lRightPropHandle);
  36. virtual int ComparePrecedence(CBranchingNode* pOther);
  37. HRESULT OptimizeSelf(void);
  38. HRESULT SetTest(VARIANT& v);
  39. // Right-side embedding info access
  40. void SetRightEmbeddingInfo(const CEmbeddingInfo* pInfo);
  41. HRESULT GetRightContainerObject(CObjectInfo& ObjInfo,
  42. INTERNAL _IWmiObject** ppInst);
  43. HRESULT CompileRightEmbeddingPortion(CContextMetaData* pNamespace,
  44. CImplicationList& Implications,
  45. _IWmiObject** ppResultClass);
  46. void SetRightEmbeddedObjPropName(CPropertyName& Name);
  47. void MixInJumpsRightObj(const CEmbeddingInfo* pParent);
  48. CPropertyName* GetRightEmbeddedObjPropName();
  49. // any or all embedding info
  50. HRESULT AdjustCompile(CContextMetaData* pNamespace,
  51. CImplicationList& Implications);
  52. // debugging
  53. virtual void Dump(FILE* f, int nOffset);
  54. // property access
  55. CVar* GetPropVariant(_IWmiObject* pObj, long lHandle, CIMTYPE* pct);
  56. protected:
  57. // order is important: must match the way the branches array is constructed
  58. enum Operations {LT, EQ, GT, NOperations};
  59. // the right hand property we hold onto,
  60. // we inherit the left hand prop from CPropertyNode
  61. // we will assume that we always can write something akin to:
  62. // Prop < RightProp
  63. // at merge time, must take a RightProp < Prop
  64. // and turn it into: Prop >= RightProp
  65. long m_lRightPropHandle;
  66. CEmbeddingInfo* m_pRightInfo;
  67. virtual HRESULT CombineBranchesWith(CBranchingNode* pArg2, int nOp,
  68. CContextMetaData* pNamespace,
  69. CImplicationList& Implications,
  70. bool bDeleteThis, bool bDeleteArg2,
  71. CEvalNode** ppRes);
  72. private:
  73. };
  74. template<class TPropType>
  75. class TTwoScalarPropNode : public CTwoPropNode
  76. {
  77. public:
  78. TTwoScalarPropNode() {}
  79. TTwoScalarPropNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  80. CTwoPropNode(Other, bChildren)
  81. {}
  82. virtual CEvalNode* Clone() const;
  83. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  84. virtual HRESULT Evaluate(CObjectInfo& ObjInfo,
  85. INTERNAL CEvalNode** ppNext);
  86. // type identification
  87. virtual long GetSubType();
  88. };
  89. class CTwoStringPropNode : public CTwoPropNode
  90. {
  91. public:
  92. CTwoStringPropNode() {}
  93. CTwoStringPropNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  94. CTwoPropNode(Other, bChildren)
  95. {}
  96. virtual CEvalNode* Clone() const;
  97. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  98. // type identification
  99. virtual long GetSubType();
  100. virtual HRESULT Evaluate(CObjectInfo& ObjInfo,
  101. INTERNAL CEvalNode** ppNext);
  102. };
  103. class CTwoMismatchedPropNode : public CTwoPropNode
  104. {
  105. public:
  106. CTwoMismatchedPropNode() {}
  107. CTwoMismatchedPropNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  108. CTwoPropNode(Other, bChildren)
  109. {}
  110. virtual HRESULT Evaluate(CObjectInfo& ObjInfo, INTERNAL CEvalNode** ppNext);
  111. protected:
  112. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext) = 0;
  113. };
  114. class CTwoMismatchedIntNode : public CTwoMismatchedPropNode
  115. {
  116. public:
  117. CTwoMismatchedIntNode() {}
  118. CTwoMismatchedIntNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  119. CTwoMismatchedPropNode(Other, bChildren)
  120. {}
  121. virtual CEvalNode* Clone() const;
  122. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  123. // type identification
  124. virtual long GetSubType();
  125. protected:
  126. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext);
  127. };
  128. // TODO: when COM catches up with us, support INT64's as numeric types
  129. // right now, we store & m anipulate them as strings
  130. class CTwoMismatchedInt64Node : public CTwoMismatchedPropNode
  131. {
  132. public:
  133. CTwoMismatchedInt64Node() {}
  134. CTwoMismatchedInt64Node(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  135. CTwoMismatchedPropNode(Other, bChildren)
  136. {}
  137. virtual CEvalNode* Clone() const;
  138. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  139. // type identification
  140. virtual long GetSubType();
  141. protected:
  142. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext);
  143. };
  144. class CTwoMismatchedFloatNode : public CTwoMismatchedPropNode
  145. {
  146. public:
  147. CTwoMismatchedFloatNode() {}
  148. CTwoMismatchedFloatNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  149. CTwoMismatchedPropNode(Other, bChildren)
  150. {}
  151. virtual CEvalNode* Clone() const;
  152. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  153. // type identification
  154. virtual long GetSubType();
  155. protected:
  156. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext);
  157. };
  158. class CTwoMismatchedUIntNode : public CTwoMismatchedPropNode
  159. {
  160. public:
  161. CTwoMismatchedUIntNode() {}
  162. CTwoMismatchedUIntNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  163. CTwoMismatchedPropNode(Other, bChildren)
  164. {}
  165. virtual CEvalNode* Clone() const;
  166. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  167. // type identification
  168. virtual long GetSubType();
  169. protected:
  170. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext);
  171. };
  172. // TODO: when COM catches up with us, support INT64's as numeric types
  173. // right now, we store & manipulate them as strings
  174. class CTwoMismatchedUInt64Node : public CTwoMismatchedPropNode
  175. {
  176. public:
  177. CTwoMismatchedUInt64Node() {}
  178. CTwoMismatchedUInt64Node(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  179. CTwoMismatchedPropNode(Other, bChildren)
  180. {}
  181. virtual CEvalNode* Clone() const;
  182. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  183. // type identification
  184. virtual long GetSubType();
  185. protected:
  186. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext);
  187. };
  188. class CTwoMismatchedStringNode : public CTwoMismatchedPropNode
  189. {
  190. public:
  191. CTwoMismatchedStringNode() {}
  192. CTwoMismatchedStringNode(const CTwoPropNode& Other, BOOL bChildren = TRUE) :
  193. CTwoMismatchedPropNode(Other, bChildren)
  194. {}
  195. virtual CEvalNode* Clone() const;
  196. virtual CTwoPropNode* CloneSelfWithoutChildren() const;
  197. // type identification
  198. virtual long GetSubType();
  199. protected:
  200. virtual HRESULT Evaluate(CVar *pLeftVar, CVar *pRightVar, INTERNAL CEvalNode** ppNext);
  201. };
  202. #include "TwoPropNode.inl"
  203. #endif _WBEM_TWOPROPNODE_H_