μHAL (v2.6.5)
Part of the IPbus software repository
Classes | Namespaces | Macros
exception.hpp File Reference
#include <exception>
#include <string>
#include <sys/time.h>
Include dependency graph for exception.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  uhal::exception::exception
 An abstract base exception class providing an interface to a throw/ThrowAsDerivedType mechanism which will allow us to catch the base type and ThrowAsDerivedType the derived type. More...
 

Namespaces

 uhal
 
 uhal::exception
 A namespace for all exceptions to live in - this will hopefully make documentation a bit clearer.
 

Macros

#define UHAL_DEFINE_DERIVED_EXCEPTION_CLASS(ClassName, BaseClassName, ClassDescription)
 Macro for simplifying the declaration and definition of derived exception types. More...
 
#define UHAL_DEFINE_EXCEPTION_CLASS(ClassName, ClassDescription)   UHAL_DEFINE_DERIVED_EXCEPTION_CLASS(ClassName, uhal::exception::exception, ClassDescription)
 
#define ExceptionClass   UHAL_DEFINE_EXCEPTION_CLASS
 
#define ThrowAsDerivedType()   ThrowAsDerivedType_(); throw 0;
 Macro version of the member function to wrap the ThrowAsDerivedType but also tell the compiler that this function always throws. More...
 

Detailed Description

Author
Andrew W. Rose
Date
2012

Definition in file exception.hpp.

Macro Definition Documentation

◆ ExceptionClass

#define ExceptionClass   UHAL_DEFINE_EXCEPTION_CLASS

Definition at line 66 of file exception.hpp.

◆ ThrowAsDerivedType

#define ThrowAsDerivedType ( )    ThrowAsDerivedType_(); throw 0;

Macro version of the member function to wrap the ThrowAsDerivedType but also tell the compiler that this function always throws.

Definition at line 74 of file exception.hpp.

◆ UHAL_DEFINE_DERIVED_EXCEPTION_CLASS

#define UHAL_DEFINE_DERIVED_EXCEPTION_CLASS (   ClassName,
  BaseClassName,
  ClassDescription 
)
Value:
class ClassName : public BaseClassName {\
public:\
ClassName() : BaseClassName() {}\
void ThrowAsDerivedType_(){ throw ClassName(*this); } \
exception* clone(){ return new ClassName(*this); } \
protected:\
std::string description() const throw() { return std::string( ClassDescription ); } \
};

Macro for simplifying the declaration and definition of derived exception types.

Definition at line 54 of file exception.hpp.

Referenced by uhal::IPbus< 1, IPbus_minor >::getInfoCodeTranslator().

◆ UHAL_DEFINE_EXCEPTION_CLASS

#define UHAL_DEFINE_EXCEPTION_CLASS (   ClassName,
  ClassDescription 
)    UHAL_DEFINE_DERIVED_EXCEPTION_CLASS(ClassName, uhal::exception::exception, ClassDescription)

Definition at line 64 of file exception.hpp.