CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
exctestNothrow.cc File Reference
#include "CLHEP/Exceptions/ZMthrow.h"
#include "CLHEP/Exceptions/ZMexception.h"
#include "CLHEP/Exceptions/ZMexAction.h"
#include "CLHEP/Exceptions/ZMexClassInfo.h"
#include "CLHEP/Exceptions/ZMexSeverity.h"
#include "CLHEP/Exceptions/ZMerrno.h"
#include <iostream>
#include <fstream>
#include <stdio.h>

Go to the source code of this file.

Macros

#define DEFECT_NO_EXCEPTIONS   1
 
#define exit(x)   printf( "this is an actual exit\n", x );
 
#define abort()   printf( "this is an actual abort\n" );
 

Functions

 ZMexStandardDefinition (ZMexception, ZMxTop)
 
 ZMexStandardDefinition (ZMxTop, ZMxHepTuple)
 
 ZMexStandardDefinition (ZMexception, ZMxTop2)
 
 ZMexStandardDefinition (ZMxTop2, ZMxHepTuple2)
 
 ZMexStandardDefinition (ZMxHepTuple2, ZMxColumn)
 
int main ()
 

Macro Definition Documentation

◆ abort

#define abort ( )    printf( "this is an actual abort\n" );

Definition at line 30 of file exctestNothrow.cc.

◆ DEFECT_NO_EXCEPTIONS

#define DEFECT_NO_EXCEPTIONS   1

Definition at line 5 of file exctestNothrow.cc.

◆ exit

#define exit (   x)    printf( "this is an actual exit\n", x );

Definition at line 29 of file exctestNothrow.cc.

Function Documentation

◆ main()

int main ( )

Definition at line 49 of file exctestNothrow.cc.

49 {
50
51 ZMxTop::setHandler( ZMexIgnoreAlways( ) );
52 ZMxHepTuple::setHandler( ZMexThrowAlways( ) );
53
54 printf( "Try to ignore a ZMxTop with msg -top-\n" );
55 ZMthrow( ZMxTop( "top" ) );
56 printf( "Try to throw a ZMxHepTuple with msg -bottom-\n" );
57 ZMthrow( ZMxHepTuple( "bottom" ) );
58
59 printf( "Try to throw a top exception with a ZMhParentHandler\n" );
60 ZMthrow( ZMxTop2( "top2" ) );
61
62 printf( "Try to throw a ZMxColumn\n" );
63 ZMthrow( ZMxColumn( "a column error" ) );
64
65 ZMxHepTuple2::setHandler( ZMexIgnoreNextN( 3 ) );
66
67 std::ofstream logfile( "exception.report" );
68 ZMxHepTuple2::setLogger( ZMexLogAlways( logfile ) );
69
70 printf( "Try to throw a ZMxTop2\n" );
71 ZMthrow( ZMxTop2( "top2" ) );
72
73 printf( "Try to ignore a ZMxHepTuple2\n" );
74 ZMthrow( ZMxHepTuple2( "a heptuple error" ) );
75
76 //ZMxColumn::logNMore( 4 );
77 printf( "Try to ignore a ZMxColumn\n" );
78 ZMthrow( ZMxColumn( "2 column error" ) );
79 printf( "Try to ignore a ZMxColumn\n" );
80 ZMthrow( ZMxColumn( "3 column error" ) );
81 printf( "Try to throw a ZMxColumn\n" );
82 ZMthrow( ZMxColumn( "4 column error" ) );
83 printf( "Try to throw a ZMxColumn\n" );
84 ZMthrow( ZMxColumn( "5 column error" ) );
85
86 std::cout << "logged the following exceptions\n";
87 unsigned int s;
88 for ( s = 0; s < ZMerrno.size( ); s++ ) {
89 std::cout << ZMerrno.get( s )->name( ) << " : " <<
90 ZMerrno.get( s )->message( ) << std::endl;
91 }
92 std::cout << "Reset the length of ZMerrno to 4\n";
93 ZMerrno.setMax( 4 );
94 for ( s = 0; s < ZMerrno.size( ); s++ ) {
95 std::cout << ZMerrno.get( s )->name( ) << " : " <<
96 ZMerrno.get( s )->message( ) << std::endl;
97 }
98
99 return 0;
100}
#define ZMthrow(userExcept)
Definition: ZMthrow.h:97
unsigned int setMax(unsigned int limit)
Definition: ZMerrno.cc:147
unsigned int size() const
const ZMexception * get(unsigned int k=0) const
Definition: ZMerrno.cc:95
std::string message() const
virtual std::string name() const
Definition: ZMexception.cc:106
ZMerrnoList ZMerrno
Definition: ZMerrno.cc:40

◆ ZMexStandardDefinition() [1/5]

ZMexStandardDefinition ( ZMexception  ,
ZMxTop   
)

◆ ZMexStandardDefinition() [2/5]

ZMexStandardDefinition ( ZMexception  ,
ZMxTop2   
)

◆ ZMexStandardDefinition() [3/5]

ZMexStandardDefinition ( ZMxHepTuple2  ,
ZMxColumn   
)

◆ ZMexStandardDefinition() [4/5]

ZMexStandardDefinition ( ZMxTop  ,
ZMxHepTuple   
)

◆ ZMexStandardDefinition() [5/5]

ZMexStandardDefinition ( ZMxTop2  ,
ZMxHepTuple2   
)