Sen API
Sen Libraries
Loading...
Searching...
No Matches
assert_impl.h
Go to the documentation of this file.
1// === assert_impl.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_DETAIL_ASSERT_IMPL_H
9#define SEN_CORE_BASE_DETAIL_ASSERT_IMPL_H
10
12
13// std
14#include <cstdint>
15#include <functional>
16
17namespace sen::impl
18{
19
21enum class CheckType : std::uint8_t
22{
23 assert = 0,
24 expect = 1,
25 ensure = 2,
26};
27
29struct CheckInfo
30{
31 CheckType checkType;
32 std::string_view expression;
33 SourceLocation sourceLocation;
34};
35
38using FailedCheckHandler = std::function<void(const CheckInfo&)>;
39
44[[nodiscard]] FailedCheckHandler setFailedCheckHandler(FailedCheckHandler handler) noexcept;
45
50void senCheckImpl(bool checkResult,
51 CheckType checkType,
52 std::string_view expression,
53 const SourceLocation& sourceLocation) noexcept;
54
55} // namespace sen::impl
56
57#endif // SEN_CORE_BASE_DETAIL_ASSERT_IMPL_H