dai::Exception Class Reference

Error handling in libDAI is done by throwing an instance of the Exception class. More...

#include <dai/exceptions.h>

List of all members.

Public Types

enum  Code {
  NOT_IMPLEMENTED, ASSERTION_FAILED, IMPOSSIBLE_TYPECAST, OBJECT_NOT_FOUND,
  BELIEF_NOT_AVAILABLE, UNKNOWN_ENUM_VALUE, UNKNOWN_DAI_ALGORITHM, UNKNOWN_PARAMETER_ESTIMATION_METHOD,
  UNKNOWN_PROPERTY_TYPE, UNKNOWN_PROPERTY, MALFORMED_PROPERTY, NOT_ALL_PROPERTIES_SPECIFIED,
  INVALID_ALIAS, CANNOT_READ_FILE, CANNOT_WRITE_FILE, INVALID_FACTORGRAPH_FILE,
  INVALID_EVIDENCE_FILE, INVALID_EMALG_FILE, NOT_NORMALIZABLE, MULTIPLE_UNDO,
  FACTORGRAPH_NOT_CONNECTED, INTERNAL_ERROR, RUNTIME_ERROR, OUT_OF_MEMORY,
  NUM_ERRORS
}
 Enumeration of exceptions used in libDAI. More...

Public Member Functions

 Exception (Code _code, const std::string &msg="", const std::string &detailedMsg="")
 Constructor.
Code code () const
 Returns error code of this exception.
const std::string & message (const Code c) const
 Returns error message corresponding to an error code.

Private Attributes

Code errorcode
 Contains the error code of this exception.

Static Private Attributes

static std::string ErrorStrings [NUM_ERRORS]
 Error messages corresponding to the exceptions enumerated above.


Detailed Description

Error handling in libDAI is done by throwing an instance of the Exception class.

The Exception class inherits from std::runtime_error. It defines several types of exceptions and corresponding error messages. The recommended way to throw an instance of the Exception class is by using the DAI_THROW or DAI_THROWE macros.

Examples:

uai2010-aie-solver.cpp.


Member Enumeration Documentation

Enumeration of exceptions used in libDAI.


Constructor & Destructor Documentation

dai::Exception::Exception ( Code  _code,
const std::string &  msg = "",
const std::string &  detailedMsg = "" 
) [inline]

Constructor.


Member Function Documentation

Code dai::Exception::code (  )  const [inline]

Returns error code of this exception.

const std::string& dai::Exception::message ( const Code  c  )  const [inline]

Returns error message corresponding to an error code.


Member Data Documentation

Contains the error code of this exception.

std::string dai::Exception::ErrorStrings [static, private]

Initial value:

 {
        "Feature not implemented",
        "Assertion failed",
        "Impossible typecast",
        "Requested object not found",
        "Requested belief not available",
        "Unknown ENUM value",
        "Unknown DAI algorithm",
        "Unrecognized parameter estimation method",
        "Unknown Property type",
        "Unknown Property",
        "Malformed Property",
        "Not all mandatory Properties specified",
        "Invalid alias",
        "Cannot read file",
        "Cannot write file",
        "Invalid FactorGraph file",
        "Invalid Evidence file",
        "Invalid Expectation-Maximization file",
        "Quantity not normalizable",
        "Multiple undo levels unsupported",
        "FactorGraph is not connected",
        "Internal error",
        "Runtime error",
        "Out of memory"
    }
Error messages corresponding to the exceptions enumerated above.


The documentation for this class was generated from the following files:

Generated on Thu Aug 5 19:04:05 2010 for libDAI by  doxygen 1.5.5