iceoryx_hoofs 2.0.5
Loading...
Searching...
No Matches
requires.hpp
1// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2// Copyright (c) 2022 by Apex.AI Inc. All rights reserved.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16// SPDX-License-Identifier: Apache-2.0
17#ifndef IOX_HOOFS_CXX_REQUIRES_HPP
18#define IOX_HOOFS_CXX_REQUIRES_HPP
19
20#include "iceoryx_hoofs/platform/platform_correction.hpp"
21
22namespace iox
23{
24namespace cxx
25{
26namespace internal
27{
28void Require(
29 const bool condition, const char* file, const int line, const char* function, const char* conditionString) noexcept;
30} // namespace internal
31
32// implementing C++ Core Guideline, I.6. Prefer Expects
33// see:
34// https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-expects
35#define Expects(condition) internal::Require(condition, __FILE__, __LINE__, __PRETTY_FUNCTION__, #condition)
36
37// implementing C++ Core Guideline, I.8. Prefer Ensures
38// see:
39// https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-ensures
40#define Ensures(condition) internal::Require(condition, __FILE__, __LINE__, __PRETTY_FUNCTION__, #condition)
41
42
43} // namespace cxx
44} // namespace iox
45
46#endif
building block to easily create free function for logging in a library context
Definition lockfree_queue.hpp:29