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.

133 lines
4.5 KiB

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