CARLsim
3.1.3
CARLsim: a GPU-accelerated SNN simulator
|
Static Class for handling user errors. More...
#include <user_errors.h>
Static Public Member Functions | |
static void | assertFalse (bool statement, errorType errorIfAssertionFails, const std::string &errorFunc, const std::string &errorMsgPrefix="", const std::string &errorMsgSuffix="") |
Checks whether assertion statement is false, else throws error. More... | |
static void | assertTrue (bool statement, errorType errorIfAssertionFails, const std::string &errorFunc, const std::string &errorMsgPrefix="", const std::string &errorMsgSuffix="") |
Checks whether assertion statement is true, else throws error. More... | |
This static class handles all possible errors that can be generated by the user. Such errors include incorret calls of CARLsim core functions, conceptual/chronological errors in setting up a network, etc. All these errors are supposed to be fatal; that is, an error message will be printed and CARLsim will exit.
Definition at line 13 of file user_errors.h.
enum errorType |
This enum contains all the different error codes that are possible (in alphabetical order). Whenever an error is thrown, it has to be assigned one of these values. There is also type UNKNOWN for unspecified errors.
Definition at line 24 of file user_errors.h.
|
static |
This function evaluates a certain statement to true or false. If the statement is false, everything is fine. But, if the statement is true, the function will throw an error and the simulation will abort. There is a standard error message for each user error type. This message can be extended by using a prefix and/or a suffix. For example: errorIfAssertionFails=CANNOT_BE_IDENTICAL, errorMsgPrefix="A", errorMsgSuffix="B" will print "A cannot be identical to B.".
[in] | statement | the logical statement to evaluate |
[in] | errorIfAssertionFails | the type of error to throw if assertion fails (from enum errorType) |
[in] | errorFunc | a string to indicate the location where the error occured |
[in] | errorMsgPrefix | a prefix for the error message |
[in] | errorMsgSuffix | a suffix for the error message |
|
static |
This function evaluates a certain statement to true or false. If the statement is true, everything is fine. But, if the statement is false, the function will throw an error and the simulation will abort. There is a standard error message for each user error type. This message can be extended by using a prefix and/or a suffix. For example: errorIfAssertionFails=CANNOT_BE_IDENTICAL, errorMsgPrefix="A", errorMsgSuffix="B" will print "A cannot be identical to B.".
[in] | statement | the logical statement to evaluate |
[in] | errorIfAssertionFails | the type of error to throw if assertion fails (from enum errorType) |
[in] | errorFunc | a string to indicate the location where the error occured |
[in] | errorMsgPrefix | a prefix for the error message |
[in] | errorMsgSuffix | a suffix for the error message |