Commit eb11369a authored by Lynn Garren's avatar Lynn Garren
Browse files

adding Exceptions to CLHEP_1_900

parent 119c1990
Makefile.in
configure
aclocal.m4
autom4te.cache
config.h.in
#! /bin/sh
# @configure_input@
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
usage()
{
cat >2 <<EOF
Usage: Exceptions-config [OPTION]
Known values for OPTION are:
--prefix show installation prefix
--cxx print compilation command
--cppflags print pre-processor flags
--cxxflags print C++ compiler flags
--ldflags print linker flags
--libs print libraries to link against
--help display this help and exit
--version output version information
EOF
exit $1
}
if test $# -eq 0; then
usage 1
fi
while test $# -gt 0; do
case "$1" in
-*=*)
optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
;;
*)
optarg=
;;
esac
case "$1" in
--prefix=*)
prefix="$optarg"
;;
--prefix)
echo "$prefix"
;;
--version)
echo @PACKAGE@ @VERSION@
exit 0
;;
--help)
usage 0
;;
--cxx)
echo @CXX@
;;
--cppflags)
echo @AM_CPPFLAGS@ @CPPFLAGS@ @Exceptions_CPPFLAGS@
;;
--cxxflags)
echo @AM_CXXFLAGS@ @CXXFLAGS@
;;
--ldflags)
echo @AM_LDFLAGS@ @LDFLAGS@ @Exceptions_LDFLAGS@
;;
--libs)
echo @LIBS@ @Exceptions_LIBS@ -lm
;;
*)
usage
exit 1
;;
esac
shift
done
exit 0
CLHEP-@PACKAGE@-@VERSION@ CLHEP-@PACKAGE@-@VERSION@
## Process this file with automake to produce Makefile.in
includedir = $(prefix)/include/CLHEP
pkginclude_HEADERS = \
ZMerrno.h \
ZMerrno.icc \
ZMexAction.h \
ZMexClassInfo.h \
ZMexClassInfo.icc \
ZMexHandler.h \
ZMexHandler.icc \
ZMexLogResult.h \
ZMexLogger.h \
ZMexSeverity.h \
ZMexception.h \
ZMexception.icc \
ZMthrow.h \
arch_spec_Exceptions.mk \
link_Exceptions.mk \
defs.h
# Identify generated file(s) to be removed when 'make clean' is requested:
CLEANFILES = defs.h
#ifndef ZMERRNO_H
#define ZMERRNO_H
// ----------------------------------------------------------------------
//
// ZMerrno.h - declaration of ZMerrno and its ZMerrnoList class
//
// Declares the following, which are defined in ZMerrno.cc:
// ZMerrnoList();
// unsigned int setMax(unsigned int max_number);
// void write(ZMexception& x);
// string name(unsigned int k = 0) const;
// const ZMexception* get(unsigned int k=0) const;
// void clear();
// void erase();
// discard();
//
// Defined in ZMerrno.icc:
// int size() const;
// int count() const;
// int countSinceCleared() const;
//
// Revision History:
// 970916 WEB Updated per code review
// 970917 WEB Updated per code review 2
// 970918 PGC Change deque from Exception object to Exception
// pointer to keep polymorphism.
// 971112 WEB Updated for conformance to standard and the zoom
// compatability headers
// 980615 WEB Added namespace support
// 980728 WEB Added ZMerrnoList destructor
// 000217 WEB Improve C++ standard compliance
// 000503 WEB Avoid global using
// 011030 MF Changed return type of size() to unsigned int
// to avoid conversion warnings
// 031105 LG Get rid of all ZMutility references
//
// ----------------------------------------------------------------------
#ifndef STRING_INCLUDED
#define STRING_INCLUDED
#include <string>
#endif
#ifndef DEQUE_INCLUDED
#define DEQUE_INCLUDED
#include <deque>
#endif
namespace zmex {
class ZMexception;
class ZMerrnoList {
public:
ZMerrnoList();
// Constructor of list.
~ZMerrnoList();
// Destructor of list.
unsigned int setMax( unsigned int limit );
// Set the maximum number of exceptions to be kept in the ZMerrnoList.
// We prohibit unlimited size because each exception kept
// may represent a memory leak of at least sizeof(ZMexception). You
// really do want a circular buffer; in Unix the size of that buffer is 1.
// Zero completely disables the ZMerrno mechanism and clears out and
// deletes the exceptions on the list.
void write( const ZMexception & x );
// Copy an exception onto ZMerrno at the "back" of the deque
int countSinceCleared() const;
// Returns the number of exceptions since last cleared
std::string name( unsigned int k = 0 ) const;
// Obtain the mnemonic name of the latest-but-k exception on ZMerrno.
// Thus name()gets the name of the latest exception.
const ZMexception* get( unsigned int k = 0 ) const;
// Obtain a pointer to the exception for the latest-but-k exception
// on ZMerrno. Thus get() obtains a const pointer to the latest exception.
// Allows perusal of things like the message and the logger
// and handler used when the exception was encountered. Should be
// checked for 0 since ZMerrno may not go back as far as requested.
void clear();
// Zero out the countSinceCleared.
void erase();
// Remove the top entry, restoring the top (latest entry) to the
// previous entry (if any). For instance, if you have a loop in which
// some known ignorable happening places a value on the ZMerrnoList, you
// can erase each one so as not to wipe out the history for others.
int count() const;
// Return the number of exceptions ever placed on the ZMerrnoList
// via ZMerrnoList::write().
unsigned int size() const;
// Return the number of entries currently on the stack.
private:
std::deque< const ZMexception * > errors_;
unsigned int max_;
enum { ZMERRNO_LENGTH = 100 };
// Default maximum number of entries on the stack
int count_;
int countSinceCleared_;
}; // ZMerrnoList
extern ZMerrnoList ZMerrno;
} // namespace zmex
#define ZMERRNO_ICC
#include "CLHEP/Exceptions/ZMerrno.icc"
#undef ZMERRNO_ICC
#endif // ZMERRNO_H
#ifndef ZMERRNO_ICC
#error "Exceptions/ZMerrno.icc included without Exceptions/ZMerrno.h"
#endif
// ----------------------------------------------------------------------
//
// ZMerrno.icc -- inline implementations for the error list mechanism.
//
//
// The following methods of ZMerrnoList are defined here:
// ZMerrnoList();
// unsigned int size();
// void clear();
// int count();
// int countSinceCleared();
//
// Revision History:
// 970916 WEB Updated per code review
// 970917 WEB Updated per code review 2
// 980617 WEB Added namespace support
// 011030 MF Changed return type of size to unsigned
//
// ----------------------------------------------------------------------
namespace zmex {
//**************
//
// ZMerrnoList()
//
//**************
// Constructor
inline ZMerrnoList::ZMerrnoList() :
max_( ZMERRNO_LENGTH )
, count_( 0 )
, countSinceCleared_( 0 )
{
}
//********************
//
// countSinceCleared()
//
//********************
inline int ZMerrnoList::countSinceCleared() const {
// Return the number of exceptions written to the ZMerrnoList since
// last cleared
return countSinceCleared_;
}
//********
//
// size()
//
//********
//
// unsigned int size() const;
// return the number of entries currently on the exception stack
inline unsigned int ZMerrnoList::size() const {
return errors_.size();
}
//********
//
// count()
//
//********
//
// int count() const;
// return the number of entries ever ZMerrno.write() to the exception stack
inline int ZMerrnoList::count() const {
return count_;
}
//********
//
// clear()
//
//********
inline void ZMerrnoList::clear() {
countSinceCleared_ = 0;
}
} // namespace zmex
#ifndef ZMEXACTION_H
#define ZMEXACTION_H
// ----------------------------------------------------------------------
//
// ZMexAction.h - define codes for handler return values
//
// Revision History:
// 970916 WEB Initial creation, excised from ZMexHandler.h
// 980615 WEB Added namespace support
// 031105 LG Get rid of all ZMutility references
//
// ----------------------------------------------------------------------
namespace zmex {
enum ZMexAction { ZMexThrowIt, ZMexIgnoreIt, ZMexHANDLEVIAPARENT };
} // namespace zmex
#endif // ZMEXACTION_H
#ifndef ZMEXCLASSINFO_H
#define ZMEXCLASSINFO_H
// ----------------------------------------------------------------------
//
// ZMexClassInfo.h - class declaration for the member of ZOOM Exception
// classes that contains all the static information
// that does NOT depend on the parent class.
//
// Every ZOOM exception must have a static member classInfo, of type
// ZMexClassInfo. This is done in the macro ZMexStandardContents.
// See ZMexception.h.
//
// Methods (in .icc):
// ZMexClassInfo() constructor
// const string name() const;
// const string facility() const;
// int nextCount();
// ZMexHandler getHandler() const;
// ZMexHandler setHandler(const ZMexHandler & newHandler);
// ZMexLogger getLogger() const;
// ZMexLogger setLogger(const ZMexLogger & newLogger);
// void logNMore();
// bool OKtoLog() const;
// int count() const;
// int filterMax() const;
//
// A related header is ZMexHeritage.h which contains class static info
// which DOES depend on the parent class.
//
// Revision History
// 970911 MF Initial version
// 970914 MF Added nextCount to be able to keep count_ private
// 970916 WEB Updated per code review
// 970917 WEB Updated per code review 2
// 971112 WEB Updated for conformance to standard and the zoom
// compatability headers
// 971211 WEB Updated per code walkthrough
// 971217 WEB Added count() and filterMax() member functions
// 980219 WEB Fixed get/set Logger/Handler return type
// 980615 WEB Added namespace support
// 990721 JVR Added setName, setFacility, and setSeverity functions
// 000217 WEB Improve C++ standard compliance
// 000503 WEB Avoid global using
// 010411 MF setName, setFacility and setSeverity return old value
// and take const argument reference
// 011212 WEB Pass all std::strings by const &; add new 3- and
// 4-arg constructors in lieu of a single 5-arg
// constructor taking default arguments
// 031105 LG Get rid of all ZMutility references
//
// ----------------------------------------------------------------------
#ifndef STRING_INCLUDED
#define STRING_INCLUDED
#include <string>
#endif
#ifndef ZMEXHANDLER_H
#include "CLHEP/Exceptions/ZMexHandler.h"
#endif
#ifndef ZMEXLOGGER_H
#include "CLHEP/Exceptions/ZMexLogger.h"
#endif
#ifndef ZMEXSEVERITY_H
#include "CLHEP/Exceptions/ZMexSeverity.h"
#endif
namespace zmex {
// ******************************************************
//
// ZMexClassInfo
//
// Template for ZMexClassInfo (used to define classInfo)
//
// ******************************************************
// Contains all the methods which are logically "virtual class statics",
// and which do not depend on a Parent's method (see note (1)).
// Each derived exception contains a ZMexClassInfo member named classInfo.
// The members and functions of ZMexClassInfo are public so that when the
// exception class uses classInfo it can get at the info. But classInfo itself
// is declared protected, to isolate this from the actual interface.
class ZMexClassInfo {
// - Methods - //
public:
ZMexClassInfo(
const std::string & name
, const std::string & facility
, const ZMexSeverity s = ZMexERROR
);
ZMexClassInfo(
const std::string & name
, const std::string & facility
, const ZMexSeverity s
, const ZMexHandler & h
);
ZMexClassInfo(
const std::string & name
, const std::string & facility
, const ZMexSeverity s
, const ZMexHandler & h
, const ZMexLogger & l
);
const std::string name() const;
// return the name_ of this exception type, which ought to match the
// class name ZMexWhatever.
const std::string setName(const std::string& newName);
const std::string facility() const;
// return the name of facility_ this exception type is under.
const std::string setFacility(const std::string& newFacility);
ZMexSeverity severity() const;
// return the severity_ of the exception class.
ZMexSeverity setSeverity(const ZMexSeverity& newSeverity);
int nextCount();
// increment the count_ and return that value
int count() const;
// return the current count_ value
ZMexHandler getHandler () const ;
ZMexHandler setHandler( const ZMexHandler & newHandler );
// Replace previous handler with this new one.
ZMexLogger getLogger() const;
ZMexLogger setLogger( const ZMexLogger & newLogger );
// Replace previous logger with this new one.
void logNMore( const int N );
// Allow logging the next N exceptions of this class.
bool OKtoLog() const;
// May the currently-thrown exception be logged
// (based on count_ <= filterMax_)?
int filterMax() const;
// return the current filterMax_ value
// - Data Members - //
private:
int count_;
int filterMax_;
std::string name_; // was const
std::string facility_; // was const
ZMexSeverity severity_; // was const
ZMexHandler handler_;
ZMexLogger logger_;
}; // ZMexClassInfo
} // namespace zmex
#define ZMEXCLASSINFO_ICC
#include "CLHEP/Exceptions/ZMexClassInfo.icc"
#undef ZMEXCLASSINFO_ICC
#endif // ZMEXCLASSINFO_H
#ifndef ZMEXCLASSINFO_ICC
#error "Exceptions/ZMexClassInfo.icc included without Exceptions/ZMexClassInfo.h"
#endif
// ----------------------------------------------------------------------
//
// ZMexClassInfo.icc
//
// Contains the following methods:
//
// ZMexClassInfo()
// name()
// setName() //
// facilty()
// setFacility() //
// nextCount()
// setHandler()
// getHandler()
// setLogger()
// getLogger()
// logNMore()
// OKtoLog()
// count()
// filterMax()
//
// Revision History
// 970914 MF Initial version, after adding nextCount()
// 970916 WEB Updated per code review
// 970917 WEB Updated per code review 2
// 971211 WEB Updated per code walkthrough
// 971217 WEB Added count() and filterMax()
// 980219 WEB Fixed get/set Handler()/setLogger() to return
// correct type
// 980617 WEB Added namespace support
// 990318 MF Modified intializer list orders to avoid warnings
// 990721 JVR Added setName, setFacility, and setSeverity functions
// 010411 MF setName, setFacility, and setSeverity return old value
// and take const & argument
// 011212 WEB Pass all std::strings by const &; constructor no
// longer inline
//
// ----------------------------------------------------------------------
namespace zmex {
// name()
// ------
inline const std::string ZMexClassInfo::name() const {
return name_;
}
// setName()
// ---------
inline const std::string ZMexClassInfo::setName(const std::string& newName) {
std::string n=name_;