Sen API
Sen Libraries
Toggle main menu visibility
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1
// === assert.h ========================================================================================================
2
// Sen Infrastructure
3
// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4
// See the LICENSE.txt file for more information.
5
// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6
// =====================================================================================================================
7
8
#ifndef SEN_CORE_BASE_ASSERT_H
9
#define SEN_CORE_BASE_ASSERT_H
10
11
#include "
sen/core/base/detail/assert_impl.h
"
12
13
// std
14
#include <memory>
15
#include <stdexcept>
16
#include <string>
17
18
namespace
sen
19
{
20
33
36
38
#define SEN_EXPECT(expr) ::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::expect, #expr, SEN_SL())
39
41
#define SEN_ASSERT(expr) ::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::assert, #expr, SEN_SL())
42
44
#if defined(DEBUG)
45
# define SEN_DEBUG_ASSERT(expr) ::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::assert, #expr, SEN_SL())
46
#else
47
# define SEN_DEBUG_ASSERT(expr)
48
#endif
49
51
#define SEN_ENSURE(expr) ::sen::impl::senCheckImpl((expr), ::sen::impl::CheckType::ensure, #expr, SEN_SL())
52
54
void
registerTerminateHandler
();
55
65
class
TracedRuntimeError
:
public
std::runtime_error
66
{
67
public
:
68
explicit
TracedRuntimeError
(
const
std::string& err);
69
71
[[nodiscard]] std::string
getTrace
(
bool
color =
false
)
const
;
72
73
private
:
74
std::shared_ptr<const void> trace_;
75
};
76
78
[[noreturn]]
void
throwRuntimeError
(
const
std::string& err);
79
81
void
trace
();
82
86
void
trace
(std::string preMessage);
87
89
90
}
// namespace sen
91
92
#endif
// SEN_CORE_BASE_ASSERT_H
assert_impl.h
sen::TracedRuntimeError::TracedRuntimeError
TracedRuntimeError(const std::string &err)
sen::TracedRuntimeError::getTrace
std::string getTrace(bool color=false) const
The throw site's trace, symbolised on each call.
sen::throwRuntimeError
void throwRuntimeError(const std::string &err)
Throws an exception that attempts to collect the stack trace.
sen::registerTerminateHandler
void registerTerminateHandler()
Installs a custom termination handler.
sen::trace
void trace()
Prints the current stack trace to stderr.
sen
Definition
assert.h:19
libs
core
include
sen
core
base
assert.h
Generated by
1.17.0