Jpp  19.1.0-rc.1
the software that should make you happy
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...
 
template<class JException_t >
static int Throw (const JException_t &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  }
static bool do_throw
throw option
Definition: JThrow.hh:28

◆ Throw() [2/2]

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

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 51 of file JThrow.hh.

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

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: