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.

169 lines
3.4 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Module: gni.h
  4. //
  5. // Description: Graph Pin Info Class
  6. //
  7. //
  8. //@@BEGIN_MSINTERNAL
  9. // Development Team:
  10. // Mike McLaughlin
  11. //
  12. // History: Date Author Comment
  13. //
  14. //@@END_MSINTERNAL
  15. //---------------------------------------------------------------------------
  16. //
  17. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  18. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  19. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  20. // PURPOSE.
  21. //
  22. // Copyright (c) 1996-1999 Microsoft Corporation. All Rights Reserved.
  23. //
  24. //---------------------------------------------------------------------------
  25. //---------------------------------------------------------------------------
  26. // Constants and Macros
  27. //---------------------------------------------------------------------------
  28. #define GPI_FLAGS_RESERVE_PIN_INSTANCE 0x00000001
  29. #define GPI_FLAGS_PIN_INSTANCE_RESERVED 0x00000002
  30. //---------------------------------------------------------------------------
  31. // Class
  32. //---------------------------------------------------------------------------
  33. typedef class CGraphPinInfo : public CListDoubleItem
  34. {
  35. friend class CConnectInfo;
  36. private:
  37. CGraphPinInfo(
  38. PPIN_INFO pPinInfo,
  39. ULONG ulFlags,
  40. PGRAPH_NODE pGraphNode
  41. );
  42. ~CGraphPinInfo(
  43. );
  44. public:
  45. static NTSTATUS
  46. Create(
  47. PGRAPH_PIN_INFO *ppGraphPinInfo,
  48. PPIN_INFO pPinInfo,
  49. ULONG ulFlags,
  50. PGRAPH_NODE pGraphNode
  51. );
  52. ENUMFUNC
  53. Destroy(
  54. )
  55. {
  56. if(this != NULL) {
  57. Assert(this);
  58. ASSERT(cReference > 0);
  59. if(--cReference == 0) {
  60. delete this;
  61. }
  62. }
  63. return(STATUS_CONTINUE);
  64. };
  65. VOID
  66. AddRef(
  67. )
  68. {
  69. if(this != NULL) {
  70. Assert(this);
  71. ++cReference;
  72. }
  73. };
  74. PPIN_INFO
  75. GetPinInfo(
  76. )
  77. {
  78. Assert(this);
  79. return(pPinInfo);
  80. };
  81. PKSPIN_CINSTANCES
  82. GetPinInstances(
  83. )
  84. {
  85. Assert(this);
  86. return(&cPinInstances);
  87. };
  88. VOID
  89. AddPinInstance(
  90. )
  91. {
  92. Assert(this);
  93. cPinInstances.CurrentCount++;
  94. };
  95. VOID
  96. RemovePinInstance(
  97. )
  98. {
  99. Assert(this);
  100. cPinInstances.CurrentCount--;
  101. };
  102. BOOL
  103. IsPinInstances(
  104. )
  105. {
  106. Assert(this);
  107. return(cPinInstances.CurrentCount < cPinInstances.PossibleCount);
  108. };
  109. BOOL
  110. IsPinReserved(
  111. )
  112. {
  113. return(ulFlags & GPI_FLAGS_PIN_INSTANCE_RESERVED);
  114. };
  115. BOOL
  116. IsPossibleInstances(
  117. )
  118. {
  119. if(IsPinReserved()) {
  120. return(cPinInstances.PossibleCount > 1);
  121. }
  122. return(cPinInstances.PossibleCount > 0);
  123. };
  124. VOID
  125. ReservePinInstance(
  126. )
  127. {
  128. Assert(this);
  129. ulFlags |= GPI_FLAGS_PIN_INSTANCE_RESERVED;
  130. cPinInstances.CurrentCount = 1;
  131. };
  132. private:
  133. LONG cReference;
  134. ULONG ulFlags;
  135. PPIN_INFO pPinInfo;
  136. KSPIN_CINSTANCES cPinInstances;
  137. public:
  138. DefineSignature(0x20495047); // GPI
  139. } GRAPH_PIN_INFO, *PGRAPH_PIN_INFO;
  140. //---------------------------------------------------------------------------
  141. typedef ListDouble<GRAPH_PIN_INFO> LIST_GRAPH_PIN_INFO;
  142. //---------------------------------------------------------------------------
  143. typedef ListData<GRAPH_PIN_INFO> LIST_DATA_GRAPH_PIN_INFO;
  144. //---------------------------------------------------------------------------