ATLAS Offline Software
Classes | Typedefs | Enumerations | Functions | Variables
RCU::Check Namespace Reference

Classes

struct  TestInvariant
 

Typedefs

typedef void(* TestInvariantFunction) (const void *object)
 effects: apply the test invariant method on an object guarantee: no-fail availability: experts only rationale: this is a templated wrapper for the class specific invariant testers More...
 

Enumerations

enum  Type {
  assert_soft, assert_hard, assert_noimp, require_soft,
  require_hard, require_noimp, provide_soft, provide_hard,
  provide_noimp, invariant
}
 

Functions

void fail (const char *package, const char *file, unsigned line, Type type, const char *error)
 effects: report the error and abort either by exception or assert like guarantee: all-fail failures: as requested requires: file != 0 requires: line != 0 requires: type < typeNum requires: error != 0 availability: experts only More...
 
bool testInvariantPrint (TestInvariantFunction function, const void *object)
 
template<class T >
void testInvariantVoid (const void *object)
 
template<class T >
TestInvariant invariant_tester (T *object)
 effects: create the right invariant testing object returns: the tester More...
 

Variables

const char *const typeLiteral [typeNum]
 
const bool typeAbort [typeNum]
 
const int typeNum = invariant + 1
 

Typedef Documentation

◆ TestInvariantFunction

typedef void(* RCU::Check::TestInvariantFunction) (const void *object)

effects: apply the test invariant method on an object guarantee: no-fail availability: experts only rationale: this is a templated wrapper for the class specific invariant testers

Definition at line 98 of file Assert.h.

Enumeration Type Documentation

◆ Type

Enumerator
assert_soft 

regular old style assertion

assert_hard 
assert_noimp 
require_soft 

function parameter requirement

require_hard 
require_noimp 
provide_soft 

function postcondition

provide_hard 
provide_noimp 
invariant 

invariant violation

Definition at line 55 of file Assert.h.

56  {
61 
66 
71 
73  invariant
74  };

Function Documentation

◆ fail()

void RCU::Check::fail ( const char *  package,
const char *  file,
unsigned  line,
Type  type,
const char *  error 
)

effects: report the error and abort either by exception or assert like guarantee: all-fail failures: as requested requires: file != 0 requires: line != 0 requires: type < typeNum requires: error != 0 availability: experts only

Definition at line 67 of file Assert.cxx.

69  {
70  RCU_REQUIRE (file != 0);
71  RCU_REQUIRE (line != 0);
73  RCU_REQUIRE (error != 0);
74 
75  Message msg;
76  msg.package = package;
77  msg.file = file;
78  msg.line = line;
80 
81  std::string mymessage = typeLiteral[type];
82  mymessage += ": ";
83  mymessage += error;
84  msg.message = mymessage.c_str();
85 
86  msg.send();
87  }

◆ invariant_tester()

template<class T >
TestInvariant RCU::Check::invariant_tester ( T *  object)
inline

effects: create the right invariant testing object returns: the tester

Definition at line 126 of file Assert.h.

127  {
128  return TestInvariant (testInvariantVoid<T>, object);
129  }

◆ testInvariantPrint()

bool RCU::Check::testInvariantPrint ( TestInvariantFunction  function,
const void *  object 
)

Definition at line 109 of file Assert.cxx.

111  {
112  try
113  {
114  (*function) (object);
115  return false;
116  } catch (std::exception& e)
117  {
118  RCU_ERROR_MSG (e.what());
119  return true;
120  };
121  }

◆ testInvariantVoid()

template<class T >
void RCU::Check::testInvariantVoid ( const void *  object)

Definition at line 100 of file Assert.h.

101  {
102  static_cast<const T *>(object)->testInvariant ();
103  }

Variable Documentation

◆ typeAbort

const bool RCU::Check::typeAbort
Initial value:
=
{
false,
true,
true,
false,
true,
true,
false,
true,
true,
true,
}

Definition at line 48 of file Assert.cxx.

◆ typeLiteral

const char *const RCU::Check::typeLiteral
Initial value:
=
{
"assertion failed",
"assertion failed",
"assertion failed",
"requirement failed",
"requirement failed",
"requirement failed",
"postcondition violated",
"postcondition violated",
"postcondition violated",
"invariant violated"
}

Definition at line 29 of file Assert.cxx.

◆ typeNum

const int RCU::Check::typeNum = invariant + 1

Definition at line 75 of file Assert.h.

RCU_ERROR_MSG
#define RCU_ERROR_MSG(message)
Definition: PrintMsg.h:55
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
checkFileSG.line
line
Definition: checkFileSG.py:75
RCU::Check::require_hard
@ require_hard
Definition: Assert.h:64
RCU::Check::require_noimp
@ require_noimp
Definition: Assert.h:65
RCU_REQUIRE
#define RCU_REQUIRE(x)
Definition: Assert.h:208
RCU::Check::require_soft
@ require_soft
function parameter requirement
Definition: Assert.h:63
RCU::Check::typeLiteral
const char *const typeLiteral[typeNum]
Definition: Assert.cxx:29
RCU::Check::provide_noimp
@ provide_noimp
Definition: Assert.h:70
RCU::Check::provide_hard
@ provide_hard
Definition: Assert.h:69
calibdata.exception
exception
Definition: calibdata.py:496
file
TFile * file
Definition: tile_monitor.h:29
RCU::Check::assert_hard
@ assert_hard
Definition: Assert.h:59
RCU::MESSAGE_EXCEPTION
@ MESSAGE_EXCEPTION
description: send out an exception
Definition: MessageType.h:35
RCU::Check::invariant
@ invariant
invariant violation
Definition: Assert.h:73
RCU::Check::typeAbort
const bool typeAbort[typeNum]
Definition: Assert.cxx:48
RCU::Check::typeNum
const int typeNum
Definition: Assert.h:75
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RCU::MESSAGE_ABORT
@ MESSAGE_ABORT
description: print and abort
Definition: MessageType.h:38
pickleTool.object
object
Definition: pickleTool.py:30
RCU::Check::assert_noimp
@ assert_noimp
Definition: Assert.h:60
get_generator_info.error
error
Definition: get_generator_info.py:40
RCU::Check::provide_soft
@ provide_soft
function postcondition
Definition: Assert.h:68
error
Definition: IImpactPoint3dEstimator.h:70
RCU::Check::assert_soft
@ assert_soft
regular old style assertion
Definition: Assert.h:58
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
run.Message
Message
Definition: run.py:57
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35