Helpers for design by contract idioms.
More...
#include <boost/assert.hpp>
Go to the source code of this file.
|
|
#define | DBC_IS_VOID |
| | Is defined for PRODUCTION build type.
|
| |
| #define | DBC_INV_RAII(TT) const DbCRAIIassert<TT> _destructmeatreturn( &TT::invariant, this ) |
| | Defines an instance of the class DbCRAIIassert<>, which
calls the invariant()-function at the return of the current function.
|
| |
| #define | DBC_PRE(XXX) BOOST_ASSERT(XXX) |
| | Assert for preconditions.
|
| |
| #define | DBC_POST(XXX) BOOST_ASSERT(XXX) |
| | Assert for postconditions.
|
| |
|
#define | DBC_INV BOOST_ASSERT(invariant()) |
| | Assert for invariant checks in member functions.
|
| |
| #define | DBC_INV_CTOR(T) BOOST_ASSERT(T::invariant()) |
| | Assert for invariant checks in ctors and dtors.
|
| |
Helpers for design by contract idioms.
- Copyright
Leonardus, a minimalist stack-based programming system.
Copyright (C) 2025 Andreas Muckenschnabel
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see https://www.gnu.org/licenses/.
◆ DBC_INV_CTOR
| #define DBC_INV_CTOR |
( |
|
T | ) |
BOOST_ASSERT(T::invariant()) |
Assert for invariant checks in ctors and dtors.
This version calls T::invariant(), because there's no
virtual table available in the ctors.
- Parameters
-
| T | The class type for which the invariant is checked. |
◆ DBC_INV_RAII
| #define DBC_INV_RAII |
( |
|
TT | ) |
const DbCRAIIassert<TT> _destructmeatreturn( &TT::invariant, this ) |
Defines an instance of the class DbCRAIIassert<>, which
calls the invariant()-function at the return of the current function.
- Parameters
-
| TT | The class type for which the invariant is checked. |
◆ DBC_POST
| #define DBC_POST |
( |
|
XXX | ) |
BOOST_ASSERT(XXX) |
Assert for postconditions.
- Parameters
-
| XXX | The postcondition to check. |
◆ DBC_PRE
| #define DBC_PRE |
( |
|
XXX | ) |
BOOST_ASSERT(XXX) |
Assert for preconditions.
- Parameters
-
| XXX | The precondition to check. |