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.

123 lines
4.3 KiB

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