Provides the error and warning system used by the RSVS3D project.
More...
#include <stdarg.h>
#include <fstream>
#include <iostream>
#include <stdexcept>
Go to the source code of this file.
|
| | rsvs3d |
| | Namespace for general purpose tools of the RSVS project.
|
| |
|
| #define | RSVS3D_ERROR(M) (rsvs3d::error(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
| | Throw generic rsvs errors. More...
|
| |
| #define | RSVS3D_ERROR_NOTHROW(M) (rsvs3d::error(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, false)) |
| | Generic rsvs warning. More...
|
| |
| #define | RSVS3D_ERROR_TYPE(M, T) (rsvs3d::error<T>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
| | Throw a specific error type. More...
|
| |
| #define | RSVS3D_ERROR_LOGIC(M) (rsvs3d::error<std::logic_error>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
| | Throw a logic_error. More...
|
| |
| #define | RSVS3D_ERROR_ARGUMENT(M) (rsvs3d::error<std::invalid_argument>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
| | Throw a invalid_argument. More...
|
| |
| #define | RSVS3D_ARGCHECK(E, M) |
| |
| #define | RSVS3D_ARGCHECK_WARN(E, M) |
| |
| #define | RSVS3D_ERROR_RANGE(M) (rsvs3d::error<std::range_error>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
| | Throw a range_error. More...
|
| |
|
| template<class E = rsvs_exception> |
| void | rsvs3d::error (const char *message="", const char *caller="", const char *file="", int line=0, bool throwError=true) |
| | Custom error function. More...
|
| |
| template<typename T > |
| int | rsvs3d::sign (T val) |
| | Returns the sign of a type comparable to 0. More...
|
| |
|
int | rsvs3d::TimeStamp (const char *str, int start_s) |
| |
| double | rsvs3d::SignedLogScale (double in) |
| | Returns a signed logscale useful for plotting data. More...
|
| |
|
double | rsvs3d::Clock2ms (int clockCycles) |
| |
|
void | ThrowWarning (const char *message) |
| |
| template<class T > |
| void | CheckFStream (const T &file, const char *callerID, const std::string &fileName) |
| | Checks a file stream. More...
|
| |
Provides the error and warning system used by the RSVS3D project.
Definition in file warning.hpp.
◆ RSVS3D_ARGCHECK
| #define RSVS3D_ARGCHECK |
( |
|
E, |
|
|
|
M |
|
) |
| |
Value: if (!(E)) \
{ \
RSVS3D_ERROR_ARGUMENT(M); \
}
Definition at line 152 of file warning.hpp.
◆ RSVS3D_ARGCHECK_WARN
| #define RSVS3D_ARGCHECK_WARN |
( |
|
E, |
|
|
|
M |
|
) |
| |
Value: if (!(E)) \
{ \
RSVS3D_ERROR_NOTHROW(M); \
}
Definition at line 157 of file warning.hpp.
◆ RSVS3D_ERROR
| #define RSVS3D_ERROR |
( |
|
M | ) |
(rsvs3d::error(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
Throw generic rsvs errors.
- Parameters
-
| M | Message of the error (const char*). |
- Exceptions
-
Definition at line 113 of file warning.hpp.
◆ RSVS3D_ERROR_ARGUMENT
| #define RSVS3D_ERROR_ARGUMENT |
( |
|
M | ) |
(rsvs3d::error<std::invalid_argument>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
Throw a invalid_argument.
- Parameters
-
| M | Message of the error (const char*). |
- Exceptions
-
Definition at line 148 of file warning.hpp.
◆ RSVS3D_ERROR_LOGIC
| #define RSVS3D_ERROR_LOGIC |
( |
|
M | ) |
(rsvs3d::error<std::logic_error>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
Throw a logic_error.
- Parameters
-
| M | Message of the error (const char*). |
- Exceptions
-
Definition at line 139 of file warning.hpp.
◆ RSVS3D_ERROR_NOTHROW
| #define RSVS3D_ERROR_NOTHROW |
( |
|
M | ) |
(rsvs3d::error(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, false)) |
Generic rsvs warning.
- Parameters
-
| M | Message of the warning (const char*). |
Definition at line 120 of file warning.hpp.
◆ RSVS3D_ERROR_RANGE
| #define RSVS3D_ERROR_RANGE |
( |
|
M | ) |
(rsvs3d::error<std::range_error>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
Throw a range_error.
- Parameters
-
| M | Message of the error (const char*). |
- Exceptions
-
Definition at line 173 of file warning.hpp.
◆ RSVS3D_ERROR_TYPE
| #define RSVS3D_ERROR_TYPE |
( |
|
M, |
|
|
|
T |
|
) |
| (rsvs3d::error<T>(M, __PRETTY_FUNCTION__, __FILE__, __LINE__, true)) |
Throw a specific error type.
- Parameters
-
| M | Message of the warning (const char*). |
- Template Parameters
-
| T | Type of the exception to throw. |
- Exceptions
-
Definition at line 130 of file warning.hpp.
◆ CheckFStream()
template<class T >
| void CheckFStream |
( |
const T & |
file, |
|
|
const char * |
callerID, |
|
|
const std::string & |
fileName |
|
) |
| |
Checks a file stream.
- Parameters
-
| [in] | file | input or output file stream |
| [in] | callerID | the name of the caller function as given by pretty function |
| [in] | fileName | The name of the file opened in the stream. |
- Template Parameters
-
| T | either ifstream or ofstream, needs to support method T::is_open() |
Definition at line 187 of file warning.hpp.