COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
Assert.h File Reference

This file contains classes required for generic custom assertion functionality. More...

#include <cassert>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

class  comms::Assert
 Base class for any custom assertion behaviour. More...
 
class  comms::EnableAssert< TAssert >
 Enable new assertion behaviour. More...
 

Namespaces

namespace  comms
 Main namespace for all classes / functions of COMMS library.
 

Macros

#define COMMS_ASSERT(expr)
 Generic assert macro.
 
#define GASSERT(expr)   COMMS_ASSERT(expr)
 Same as COMMS_ASSERT.
 

Detailed Description

This file contains classes required for generic custom assertion functionality.

Macro Definition Documentation

◆ COMMS_ASSERT

#define COMMS_ASSERT (   expr)
Value:
((expr) \
? static_cast<void>(0) \
: (comms::AssertManager::instance().hasAssertRegistered() \
? comms::AssertManager::instance().getAssert()->fail( \
#expr, __FILE__, __LINE__, COMMS_ASSERT_FUNCTION_STR) \
: COMMS_ASSERT_FAIL_FUNC(expr)))

Generic assert macro.

Will use custom assertion failure behaviour if such is defined, otherwise it will use standard "assert()" macro. In case COMMS_NOSTDLIB is defined and no custom assertion failure was enabled, infinite loop will be executed.

Parameters
exprBoolean expression

◆ GASSERT

#define GASSERT (   expr)    COMMS_ASSERT(expr)

Same as COMMS_ASSERT.

Kept for backward compatibility of already written protocols.