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.

140 lines
4.8 KiB

  1. //
  2. // MODULE: BNTS.H
  3. //
  4. // PURPOSE: "read only" belief network API for Troubleshooters
  5. // bnts.h: Definitions for the Belief Network Troubleshooting object.
  6. //
  7. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  8. //
  9. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  10. //
  11. // AUTHOR: Apparently originated at MSR
  12. //
  13. // ORIGINAL DATE: unknown
  14. //
  15. // NOTES:
  16. //
  17. // Version Date By Comments
  18. //--------------------------------------------------------------------
  19. // V0.3 3/24/98 JM Local Version for NT5
  20. #ifndef _BNTS_H_
  21. #define _BNTS_H_
  22. // BN system inclusions
  23. #include "enumstd.h" // Standard enumeration declarations for the BN system
  24. // 'BNTS_EXPORT' should only be defined in the project that builds the DLL
  25. #ifdef BNTS_EXPORT
  26. // We're building the DLL (exporting the class)
  27. #define BNTS_RESIDENT __declspec(dllexport)
  28. #else
  29. // We're using the DLL (importing the class)
  30. #define BNTS_RESIDENT __declspec(dllimport)
  31. #endif
  32. // Forward declaration of internal belief network class
  33. class MBNETDSCTS; // the encapsulated BN class
  34. class GNODEMBND; // Discrete nodes
  35. class LTBNPROP; // Property list
  36. class ZSTR;
  37. typedef const char * SZC; // simple alias
  38. typedef char * SZ;
  39. typedef double REAL;
  40. ////////////////////////////////////////////////////////////////////////////////////////////
  41. //
  42. // class BNTS: the belief network troubleshooter
  43. //
  44. ////////////////////////////////////////////////////////////////////////////////////////////
  45. class BNTS_RESIDENT BNTS
  46. {
  47. public:
  48. // CTOR and DTOR
  49. BNTS ();
  50. ~ BNTS ();
  51. ////////////////////////////////////////////////////////////////////
  52. // Model-level queries and functions
  53. ////////////////////////////////////////////////////////////////////
  54. // Load and process a DSC-based model
  55. BOOL BReadModel ( SZC szcFn, SZC szcFnError = NULL );
  56. // Return the number of (pre-expansion) nodes in the model
  57. int CNode ();
  58. // Return the recommended nodes and, optionally, their values
  59. BOOL BGetRecommendations ();
  60. // Return TRUE if the state of information is impossible
  61. BOOL BImpossible ();
  62. // Return a property item string from the network
  63. BOOL BNetPropItemStr ( SZC szcPropType, int index );
  64. // Return a property item number from the network
  65. BOOL BNetPropItemReal ( SZC szcPropType, int index, double & dbl );
  66. ////////////////////////////////////////////////////////////////////
  67. // Operations involving the "Currrent Node": call NodeSetCurrent()
  68. ////////////////////////////////////////////////////////////////////
  69. // Set the current node for other calls
  70. BOOL BNodeSetCurrent( int inode );
  71. // Get the current node
  72. int INodeCurrent ();
  73. // Return the index of a node given its symbolic name
  74. int INode ( SZC szcNodeSymName );
  75. // Return the label of the current node
  76. ESTDLBL ELblNode ();
  77. // Return the number of discrete states in the current node
  78. int INodeCst ();
  79. // Set the state of a node; use -1 to uninstatiate
  80. BOOL BNodeSet ( int istate, bool bSet = true );
  81. // Return the state of a node
  82. int INodeState ();
  83. // Return the name of a node's state
  84. void NodeStateName ( int istate );
  85. // Return the symbolic name of the node
  86. void NodeSymName ();
  87. // Return the full name of the node
  88. void NodeFullName ();
  89. // Return a property item string from the node
  90. BOOL BNodePropItemStr ( SZC szcPropType, int index );
  91. // Return a property item number from the node
  92. BOOL BNodePropItemReal ( SZC szcPropType, int index, double & dbl );
  93. // Return the belief for a node
  94. void NodeBelief ();
  95. // Return true if the network is loaded and correct
  96. bool BValidNet () const;
  97. // Return true if the current node is set
  98. bool BValidNode () const;
  99. // Discard the model and all components
  100. void Clear();
  101. ////////////////////////////////////////////////////////////////////
  102. // Accessors to the function result information
  103. ////////////////////////////////////////////////////////////////////
  104. SZC SzcResult () const; // String answer
  105. const REAL * RgReal () const; // Array of reals
  106. const int * RgInt () const; // Array of Integers
  107. int CReal () const; // Count of reals
  108. int CInt () const; // Count of integers
  109. protected:
  110. MBNETDSCTS * _pmbnet; // The T/S DSC belief network
  111. int _inodeCurrent; // The current node
  112. protected:
  113. MBNETDSCTS & Mbnet();
  114. const MBNETDSCTS & Mbnet() const;
  115. GNODEMBND * Pgndd ();
  116. BOOL BGetPropItemStr ( LTBNPROP & ltprop,
  117. SZC szcPropType,
  118. int index,
  119. ZSTR & zstr );
  120. BOOL BGetPropItemReal ( LTBNPROP & ltprop,
  121. SZC szcPropType,
  122. int index,
  123. double & dbl );
  124. void ClearArrays ();
  125. void ClearString ();
  126. ZSTR & ZstrResult ();
  127. };
  128. #endif // _BNTS_H_