#include "HepTuple/useMethod.h" #include string s; ZMuseMethodImpl testA(&s,s.c_str); #include #define throw printf("this is an actual throw\n"); #include class ZMxTop : public ZMexception { public: ZMxTop(string msg) : ZMexception(msg) {}; static ZMexceptInfo information; ZMexceptionWrappers; virtual ZMexception* copy () { return new ZMxTop(*this); }; }; ZMexceptInfo ZMxTop::information("ZMxTop","Top Exception"); class ZMxHepTuple : public ZMxTop { public: ZMxHepTuple(string msg) : ZMxTop(msg) {}; static ZMexceptInfo information; ZMexceptionWrappers; virtual ZMexception* copy () { return new ZMxHepTuple(*this); }; }; ZMexceptInfo ZMxHepTuple::information("ZMxHepTuple","HepTuple"); /* class ZMxTop2 : public ZMexception { public: ZMxTop2(string msg, ZMxSeverityLevel level = EndOfSeverity) : ZMexception(msg) {init(level);}; virtual ZMexception* copy () { return new ZMxTop2(*this); }; static ZMexceptInfo information; ZMexceptionWrappers; }; */ ZMxTopDefinition(ZMxTop2) ZMexceptInfo ZMxTop2::information("ZMxTop2","Other Top Exception"); /* dsfsclass ZMxHepTuple2 : public ZMxTop2 { public: ZMxHepTuple2(string msg) :ZMxTop2(msg) {}; virtual ZMexception* copy () { return new ZMxHepTuple2(*this); }; static ZMexceptInfo information; ZMexceptionWrappers; }; */ ZMxCompleteDefinition(ZMxTop2,ZMxHepTuple2) ZMexceptInfo ZMxHepTuple2::information("ZMxHepTuple2","Other HepTuple"); /* class ZMxColumn : public ZMxHepTuple2 { public: ZMxColumn(string msg) : ZMxHepTuple2(msg) {}; virtual ZMexception* copy () { return new ZMxColumn(*this); }; static ZMexceptInfo information; ZMexceptionWrappers; }; */ ZMxCompleteDefinition(ZMxHepTuple2,ZMxColumn) ZMexceptInfo ZMxColumn::information("ZMxColumn","Column excep"); void main () { // ZMxTop::ignore(); // ZMxHepTuple::dontIgnore(); ZMxTop::setHandler(ZMhIgnore()); ZMxHepTuple::setHandler(ZMhThrow()); printf("Try to ignore a ZMxTop with msg -top-\n"); ZMthrow(ZMxTop("top")); printf("Try to throw a ZMxHepTuple with msg -bottom-\n"); ZMthrow(ZMxHepTuple("bottom")); printf("Try to throw a top exception with a ZMhParentHandler\n"); ZMthrow(ZMxTop2("top2")); printf("Try to throw a ZMxColumn\n"); ZMthrow(ZMxColumn("a column error")); ZMxHepTuple2::setHandler(ZMhIgnoreNextN(3)); ZMxHepTuple2::setLogger(ZMlSimple("exception.report")); printf("Try to throw a ZMxTop2\n"); ZMthrow(ZMxTop2("top2")); printf("Try to ignore a ZMxHepTuple2\n"); ZMthrow(ZMxHepTuple2("a heptuple error")); printf("Try to ignore a ZMxColumn\n"); ZMthrow(ZMxColumn("2 column error")); printf("Try to ignore a ZMxColumn\n"); ZMthrow(ZMxColumn("3 column error")); printf("Try to throw a ZMxColumn\n"); ZMthrow(ZMxColumn("4 column error")); cout << "logged the following exceptions\n"; for (int s = 0; s < ZMerrno.size(); s++ ) { cout << ZMerrno.read(s) << " : " << ZMerrno.get(s)->message() << endl; } cout << "Reset the length of ZMerrno to 4\n"; ZMerrno.setMax(4); for (int s = 0; s < ZMerrno.size(); s++ ) { cout << ZMerrno.read(s) << " : " << ZMerrno.get(s)->message() << endl; } }