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.

77 lines
1.8 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. TWOPROPNODE.INL
  5. Abstract:
  6. Two Prop Node Inlines
  7. History:
  8. --*/
  9. // inline support for templates for TwoPropNode
  10. // silly warning about performance hits when converting an int to a bool
  11. #pragma warning(disable: 4800)
  12. // evaluate data in ObjInfo, decide which node (branch) should be evaluated next
  13. template<class TPropType>
  14. HRESULT TTwoScalarPropNode<TPropType>::Evaluate(CObjectInfo& ObjInfo,
  15. INTERNAL CEvalNode** ppNext)
  16. {
  17. HRESULT herslut = WBEM_S_NO_ERROR;
  18. _IWmiObject* pLeftObj;
  19. _IWmiObject* pRightObj;
  20. if(SUCCEEDED(herslut = GetContainerObject(ObjInfo, &pLeftObj))
  21. &&
  22. SUCCEEDED(herslut = GetRightContainerObject(ObjInfo, &pRightObj)))
  23. {
  24. long lRead;
  25. TPropType lValue, rValue;
  26. // ugly compare: "if we get both properties"
  27. if (SUCCEEDED(herslut = pLeftObj->ReadPropertyValue(m_lPropHandle, sizeof(TPropType), &lRead, (BYTE*)&lValue))
  28. &&
  29. SUCCEEDED(herslut = pRightObj->ReadPropertyValue(m_lRightPropHandle, sizeof(TPropType), &lRead, (BYTE*)&rValue)))
  30. {
  31. herslut = WBEM_S_NO_ERROR;
  32. if (lValue < rValue)
  33. *ppNext = m_apBranches[LT];
  34. else if (lValue > rValue)
  35. *ppNext = m_apBranches[GT];
  36. else
  37. *ppNext = m_apBranches[EQ];
  38. }
  39. }
  40. return herslut;
  41. }
  42. template<class TPropType>
  43. CEvalNode* TTwoScalarPropNode<TPropType>::Clone() const
  44. {
  45. return (CBranchingNode*) new TTwoScalarPropNode<TPropType>(*this, true);
  46. }
  47. template<class TPropType>
  48. CTwoPropNode* TTwoScalarPropNode<TPropType>::CloneSelfWithoutChildren() const
  49. {
  50. return (CTwoPropNode*) new TTwoScalarPropNode<TPropType>(*this, false);
  51. }
  52. template<class TPropType>
  53. long TTwoScalarPropNode<TPropType>::GetSubType()
  54. {
  55. return EVAL_NODE_TYPE_TWO_SCALARS;
  56. }
  57. #pragma warning(default: 4800)