Jpp
Static Public Member Functions | Static Protected Attributes | List of all members
JLANG::JThrow< T > Class Template Reference

Auxiliary base class for controling the throwing of exceptions. More...

#include <JThrow.hh>

Inheritance diagram for JLANG::JThrow< T >:
JDETECTOR::JPMTParametersMap

Static Public Member Functions

static void Throw (const bool option)
 Enable/disable throw option. More...
 
static int Throw (const JException &error, const int value=-1)
 Throw exception or return error. More...
 

Static Protected Attributes

static bool do_throw = true
 throw option More...
 

Detailed Description

template<class T>
class JLANG::JThrow< T >

Auxiliary base class for controling the throwing of exceptions.

The template class refers to the throwing object.

Definition at line 25 of file JThrow.hh.

Member Function Documentation

◆ Throw() [1/2]

template<class T>
static void JLANG::JThrow< T >::Throw ( const bool  option)
inlinestatic

Enable/disable throw option.

Parameters
optiontrue enable; false disable

Definition at line 37 of file JThrow.hh.

38  {
39  do_throw = option;
40  }

◆ Throw() [2/2]

template<class T>
static int JLANG::JThrow< T >::Throw ( const JException error,
const int  value = -1 
)
inlinestatic

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 50 of file JThrow.hh.

51  {
52  using namespace std;
53 
54  if (do_throw) {
55  throw error;
56  }
57 
58  cerr << error.what() << endl;
59 
60  return value;
61  }

Member Data Documentation

◆ do_throw

template<class T>
bool JLANG::JThrow< T >::do_throw = true
staticprotected

throw option

Set default throw option to true.

Definition at line 28 of file JThrow.hh.


The documentation for this class was generated from the following file:
std
Definition: jaanetDictionary.h:36
JLANG::JThrow::do_throw
static bool do_throw
throw option
Definition: JThrow.hh:28
JLANG::JException::what
virtual const char * what() const
Get error message.
Definition: JException.hh:48