BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/ers/ers-00-00-03/ers/Assertion.h File Reference
#include <stdio.h>
#include "ers/Issue.h"

Go to the source code of this file.

Classes

class  ers::Assertion
 This Issue represents a basic assertion. More...
 
struct  ers::Compile_time_error< true >
 compile time error structure More...
 

Namespaces

namespace  ers
 

Macros

#define ERS_STATIC_ASSERT(expr)   { ers::Compile_time_error <((expr) != 0)> ERROR_ASSERTION_FAILED ; (void) ERROR_ASSERTION_FAILED ; }
 
#define ERS_ASSERT(expr, ...)   { if(!(expr)) { char assertion_buffer[256] ; snprintf(assertion_buffer,sizeof(assertion_buffer), __VA_ARGS__) ; ers::Assertion failed_assertion(ERS_HERE, ers::error,#expr,assertion_buffer,false) ; throw failed_assertion ; } }
 

Detailed Description

This file defines the assertion class and the associated macros.

Definition in file Event/ers/ers-00-00-03/ers/Assertion.h.

Macro Definition Documentation

◆ ERS_ASSERT

#define ERS_ASSERT (   expr,
  ... 
)    { if(!(expr)) { char assertion_buffer[256] ; snprintf(assertion_buffer,sizeof(assertion_buffer), __VA_ARGS__) ; ers::Assertion failed_assertion(ERS_HERE, ers::error,#expr,assertion_buffer,false) ; throw failed_assertion ; } }

if e is not true, then an issue of type ers::Asertion is thrown with message msg. The msg is actually a formatting string, like printf, that can be used with subsequent parameters. If the compiler is gcc, then the transient field of the assertion is set according to the transcience of the expression. This means that if the expression is detected by the compiler as being constant,

Note
This macro is disabled if the N_ERS_ASSERT macro is defined

Definition at line 86 of file Event/ers/ers-00-00-03/ers/Assertion.h.

◆ ERS_STATIC_ASSERT

#define ERS_STATIC_ASSERT (   expr)    { ers::Compile_time_error <((expr) != 0)> ERROR_ASSERTION_FAILED ; (void) ERROR_ASSERTION_FAILED ; }

Compile time assertion can only be done on constant factors (i.e compile-time known quantities).

Definition at line 69 of file Event/ers/ers-00-00-03/ers/Assertion.h.