|
Flow123d
release_1.8.2-1603-g0109a2b
|
Class defining debugging messages. More...
#include <asserts.hh>

Public Member Functions | |
| Assert (const std::string &expression) | |
| Constructor. More... | |
| Assert (const Assert &other) | |
| Copy constructor. More... | |
| ~Assert () | |
| Destructor. More... | |
| template<typename T > | |
| Assert & | add_value (T var_current_val, const char *var_name) |
| Adds name and value of variable. More... | |
| Assert & | set_context (const char *file_name, const char *function, const int line) |
| Stores values for printing out line number, function, etc. More... | |
| void | error (std::string error_msg="") |
| Generate error with given message. More... | |
| void | warning (std::string warning_msg="") |
| Generate warning with given message. More... | |
Public Attributes | |
| Assert & | _FEAL_ASSERT_A |
| clever macro A More... | |
| Assert & | _FEAL_ASSERT_B |
| clever macro B More... | |
Protected Attributes | |
| Exc_assert | exception_ |
| Exception object. More... | |
| bool | thrown_ |
| Flag marked if Assert thrown error, warning, ... More... | |
Class defining debugging messages.
Allows define assert, warning etc. either only for debug mode or for release mode also.
Definition of asserts is designed using macros FEAL_ASSERT and FEAL_DEBUG_ASSERT. First macro is used for both modes, second is only for debug. Definition allows to printout given variables too.
Examples of usage:
1) We expect empty stings 's1' and 's2', if condition is not satisfied exception will be thrown. Condition is indicated in first parentheses, variables designed for printout follow as (s1)(s2). Each variable must be defined in separate parentheses. The last step is calling of the appropriate assert type, in this case error(). This assert is performed for debug and release mode.
2) Parameter of error method is optional.
3) This example is same as previous, but assert is performed only for debug mode.
4) Example is same as case 1). Assert type error is called automatically if any other is not listed. This case is not recommended, rather use explicitly calling of error() method.
5) Example with same condition as all previous but with other type - warning. Any exception is not thrown, only warning is printed. Parameter of warning method is optional.
Definition at line 102 of file asserts.hh.
|
inline |
Constructor.
Definition at line 105 of file asserts.hh.
|
inline |
Copy constructor.
Definition at line 115 of file asserts.hh.
| feal::Assert::~Assert | ( | ) |
Destructor.
Definition at line 54 of file asserts.cc.
|
inline |
Adds name and value of variable.
Definition at line 129 of file asserts.hh.
| void feal::Assert::error | ( | std::string | error_msg = "" | ) |
Generate error with given message.
Definition at line 73 of file asserts.cc.
| Assert & feal::Assert::set_context | ( | const char * | file_name, |
| const char * | function, | ||
| const int | line | ||
| ) |
Stores values for printing out line number, function, etc.
Definition at line 63 of file asserts.cc.
| void feal::Assert::warning | ( | std::string | warning_msg = "" | ) |
Generate warning with given message.
Definition at line 81 of file asserts.cc.
| Assert& feal::Assert::_FEAL_ASSERT_A |
clever macro A
Definition at line 124 of file asserts.hh.
| Assert& feal::Assert::_FEAL_ASSERT_B |
clever macro B
Definition at line 125 of file asserts.hh.
|
protected |
Exception object.
Definition at line 148 of file asserts.hh.
|
protected |
Flag marked if Assert thrown error, warning, ...
Definition at line 149 of file asserts.hh.
1.8.11