

Go to the source code of this file.
Data Structures | |
| class | IMP::Exception |
The general base class for IMP exceptions. More... | |
| class | IMP::IndexException |
| An exception for a request for an invalid member of a container. More... | |
| struct | IMP::InternalException |
| A general exception for an intenal error in IMP. More... | |
| class | IMP::IOException |
| An input/output exception. More... | |
| class | IMP::ModelException |
| An exception which is thrown when the Model has attributes with invalid values. More... | |
| class | IMP::UsageException |
An exception for an invalid usage of IMP. More... | |
| class | IMP::ValueException |
An exception for an invalid value being passed to IMP. More... | |
Namespaces | |
| namespace | IMP |
The IMP kernel provides base classes and key shared functionality. | |
Copyright 2007-2010 IMP Inventors. All rights reserved.
| #define IMP_CHECK_CODE | ( | expr | ) |
Only compile the code if checks are enabled.
For example
IMP_CHECK_CODE({ std::vector<Particle*> testp(input.begin(), input.end()); std::sort(testp.begin(), testp.end()); IMP_USAGE_CHECK(std::unique(testp.begin(), testp.end()) == testp.end(), "Duplicate particles found in the input list."); });
| #define IMP_FAILURE | ( | message | ) |
A runtime failure for IMP.
| [in] | message | Failure message to write. This macro is used to provide nice error messages when there is an internal error in IMP. It causes an IMP::InternalException to be thrown. |
| #define IMP_IF_CHECK | ( | level | ) |
Execute the code block if a certain level checks are on.
The next code block (delimited by { }) is executed if get_check_level() <= level.
For example:
IMP_CHECK_CODE(CHECK_USAGE) { std::vector<Particle*> testp(input.begin(), input.end()); std::sort(testp.begin(), testp.end()); IMP_USAGE_CHECK(std::unique(testp.begin(), testp.end()) == testp.end(), "Duplicate particles found in the input list."); }
| #define IMP_INTERNAL_CHECK | ( | expr, | |||
| message | ) |
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Since it is a debug-only check and no attempt should be made to recover from it, the exception type cannot be specified.
For example:
IMP_INTERNAL_CHECK((3.14-PI) < .01, "PI is not close to 3.14. It is instead " << PI);
| [in] | expr | The assertion expression. |
| [in] | message | Write this message if the assertion fails. |
| #define IMP_THROW | ( | message, | |||
| exception_name | ) |
Throw an exception with a message.
The exception thrown must inherit from Exception and not be UsageException or InternalException as those are reserved for disableable checks (the IMP_INTERNAL_CHECK() and IMP_USAGE_CHECK() macros).
IMP_THROW("Could not open file " << file_name, IOException);
| #define IMP_USAGE_CHECK | ( | expr, | |||
| message | ) |
A runtime test for incorrect usage of a class or method.
| [in] | expr | The assertion expression. |
| [in] | message | Write this message if the assertion fails. |
IMP_USAGE_CHECK(positive_argument >0, "Argument positive_argument to function my_function " << " must be positive. Instead got " << positive_argument);