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.

162 lines
3.8 KiB

  1. //=================================================================
  2. //
  3. // assoc.h -- Generic association class
  4. //
  5. // Copyright (c) 2000-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #pragma once
  9. _COM_SMARTPTR_TYPEDEF(CInstance, __uuidof(CInstance));
  10. class CAssociation : public Provider
  11. {
  12. public:
  13. CAssociation(
  14. LPCWSTR pwszClassName,
  15. LPCWSTR pwszNamespaceName,
  16. LPCWSTR pwszLeftClassName,
  17. LPCWSTR pwszRightClassName,
  18. LPCWSTR pwszLeftPropertyName,
  19. LPCWSTR pwszRightPropertyName
  20. );
  21. virtual ~CAssociation();
  22. HRESULT ExecQuery(
  23. MethodContext* pMethodContext,
  24. CFrameworkQuery &pQuery,
  25. long lFlags
  26. );
  27. HRESULT GetObject(
  28. CInstance* pInstance,
  29. long lFlags,
  30. CFrameworkQuery &pQuery
  31. );
  32. HRESULT EnumerateInstances(
  33. MethodContext *pMethodContext,
  34. long lFlags /*= 0L*/
  35. );
  36. protected:
  37. bool IsInstance(const CInstance *pInstance);
  38. static HRESULT WINAPI StaticEnumerationCallback(
  39. Provider* pThat,
  40. CInstance* pInstance,
  41. MethodContext* pContext,
  42. void* pUserData
  43. );
  44. virtual HRESULT RetrieveLeftInstance(
  45. LPCWSTR lpwszObjPath,
  46. CInstance **ppInstance,
  47. MethodContext *pMethodContext
  48. );
  49. virtual HRESULT RetrieveRightInstance(
  50. LPCWSTR lpwszObjPath,
  51. CInstance **ppInstance,
  52. MethodContext *pMethodContext
  53. );
  54. virtual HRESULT EnumerationCallback(
  55. CInstance *pRight,
  56. MethodContext *pMethodContext,
  57. void *pUserData
  58. );
  59. virtual HRESULT ValidateLeftObjectPaths(
  60. MethodContext *pMethodContext,
  61. const CHStringArray &sPaths,
  62. TRefPointerCollection<CInstance> &lefts
  63. );
  64. virtual HRESULT ValidateRightObjectPaths(
  65. MethodContext *pMethodContext,
  66. const CHStringArray &sPaths,
  67. TRefPointerCollection<CInstance> &lefts
  68. );
  69. virtual bool AreRelated(
  70. const CInstance *pLeft,
  71. const CInstance *pRight
  72. )
  73. {
  74. return IsInstance(pLeft) && IsInstance(pRight);
  75. }
  76. virtual void MakeWhere(
  77. CHStringArray &sRightPaths,
  78. CHStringArray &sRightWheres
  79. )
  80. {
  81. }
  82. virtual HRESULT FindWhere(
  83. TRefPointerCollection<CInstance> &lefts,
  84. CHStringArray &sLeftWheres
  85. )
  86. {
  87. return WBEM_S_NO_ERROR;
  88. }
  89. virtual HRESULT LoadPropertyValues(
  90. CInstance *pInstance,
  91. const CInstance *pLeft,
  92. const CInstance *pRight
  93. )
  94. {
  95. return WBEM_S_NO_ERROR;
  96. }
  97. virtual HRESULT GetLeftInstances(
  98. MethodContext *pMethodContext,
  99. TRefPointerCollection<CInstance> &lefts,
  100. const CHStringArray &sRightValues
  101. );
  102. virtual HRESULT GetRightInstances(
  103. MethodContext *pMethodContext,
  104. TRefPointerCollection<CInstance> *lefts,
  105. const CHStringArray &sLeftWheres
  106. );
  107. bool IsDerivedFrom(
  108. LPCWSTR pszBaseClassName,
  109. LPCWSTR pszDerivedClassName,
  110. MethodContext *pMethodContext
  111. );
  112. CHString m_sLeftClassName;
  113. CHString m_sRightClassName;
  114. CHString m_sLeftPropertyName;
  115. CHString m_sRightPropertyName;
  116. };