CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
anonymous_namespace{debug.hh}::ConditionalDebug< Threshold, Context, EnableAssertions, VerboseInvariants >::Assert< Args > Struct Template Reference

Function-like class for assertions that is expected to be used via the deduction guide as: More...

#include <debug.hh>

Public Member Functions

template<typename T>
requires DebugConcepts::IsBool<T>
 Assert (T condition, const char *fmt, Args... args, SourceLocation loc=SourceLocation::current())
 Constructor, performs the assertion check.
template<typename T>
requires DebugConcepts::LazyAssertion<T>
 Assert (T &&condition, const char *fmt, Args... args, SourceLocation loc=SourceLocation::current())
 Constructor, performs an assertion check.

Detailed Description

template<DebugLevelTemplateArgument Threshold, DebugContext Context, bool EnableAssertions = (Threshold <= DebugLevel::Warning), bool VerboseInvariants = (Threshold <= DebugLevel::Warning)>
template<typename... Args>
struct anonymous_namespace{debug.hh}::ConditionalDebug< Threshold, Context, EnableAssertions, VerboseInvariants >::Assert< Args >

Function-like class for assertions that is expected to be used via the deduction guide as:

ConditionalDebug::Assert(someCondition, "A message...", ...);

Assertions are checked only if EnableAssertions is true (by default, if the threshold is lower than or equal to Warning).

Definition at line 927 of file debug.hh.

Constructor & Destructor Documentation

◆ Assert() [1/2]

template<DebugLevelTemplateArgument Threshold, DebugContext Context, bool EnableAssertions = (Threshold <= DebugLevel::Warning), bool VerboseInvariants = (Threshold <= DebugLevel::Warning)>
template<typename... Args>
template<typename T>
requires DebugConcepts::IsBool<T>
anonymous_namespace{debug.hh}::ConditionalDebug< Threshold, Context, EnableAssertions, VerboseInvariants >::Assert< Args >::Assert ( T condition,
const char * fmt,
Args... args,
SourceLocation loc = SourceLocation::current() )
inline

◆ Assert() [2/2]

template<DebugLevelTemplateArgument Threshold, DebugContext Context, bool EnableAssertions = (Threshold <= DebugLevel::Warning), bool VerboseInvariants = (Threshold <= DebugLevel::Warning)>
template<typename... Args>
template<typename T>
requires DebugConcepts::LazyAssertion<T>
anonymous_namespace{debug.hh}::ConditionalDebug< Threshold, Context, EnableAssertions, VerboseInvariants >::Assert< Args >::Assert ( T && condition,
const char * fmt,
Args... args,
SourceLocation loc = SourceLocation::current() )
inline

Constructor, performs an assertion check.

This version is passed a lambda that returns a bool, rather than a boolean condition. This allows the compiler to completely elide the contents of the lambda in builds where this component is not being debugged. This version should be used for places where the assertion condition has side effects.

Definition at line 967 of file debug.hh.

References anonymous_namespace{debug.hh}::SourceLocation::current(), and anonymous_namespace{debug.hh}::ConditionalDebug< Threshold, Context, EnableAssertions, VerboseInvariants >::report_failure().


The documentation for this struct was generated from the following file: