reconciliation_lib 0.1
Library for data reconciliation algorithms
Loading...
Searching...
No Matches
dvr_assert.h
Go to the documentation of this file.
1#ifndef DVRLIB_DVR_ASSERT_H
2#define DVRLIB_DVR_ASSERT_H
3
4#include <stdexcept>
5#include <string>
6
7namespace dvrlib {
8
9struct assertion_error : public std::logic_error {
10 assertion_error(const char* cond, const char* file, int line)
11 : std::logic_error(std::string("assertion failed: ") + cond +
12 " (" + file + ":" + std::to_string(line) + ")") {
13 }
14};
15
16} // namespace dvrlib
17
18#define dvr_assert(cond) \
19 do { \
20 if(!(cond)) \
21 throw dvrlib::assertion_error(#cond, __FILE__, __LINE__); \
22 } while(0)
23
24#endif // DVRLIB_DVR_ASSERT_H
Definition dvr_assert.h:7
Definition dvr_assert.h:9
assertion_error(const char *cond, const char *file, int line)
Definition dvr_assert.h:10