KaliVeda
Toolkit for HIC analysis
KVError Namespace Reference

Provides colourised versions of the standard ROOT informational/warning/error messages. More...

Classes

class  colour_error_handler
 

Functions

template<typename UserClass >
void Error (UserClass p, const char *location, const char *va_(fmt),...)
 
template<typename UserClass >
void Info (UserClass p, const char *location, const char *va_(fmt),...)
 
template<typename UserClass >
std::enable_if_t< std::is_class_v< UserClass >, colour_error_handler< UserClass > > make_handler (const UserClass &)
 
template<typename UserClass >
std::enable_if_t< std::is_class_v< UserClass >, colour_error_handler< UserClass > > make_handler (const UserClass *)
 
template<typename UserClass >
std::enable_if_t< std::is_class_v< UserClass >, colour_error_handler< UserClass > > make_handler (UserClass *)
 
template<typename UserClass >
void Warning (UserClass p, const char *location, const char *va_(fmt),...)
 

Detailed Description

Provides colourised versions of the standard ROOT informational/warning/error messages.

These can be used with any class which has ROOT dictionary information (i.e. with a ClassDef in its header file, and an entry in a LinkDef.h file). In class method definitions, just pass the this pointer as first argument:

#include "MyClass.h"
#include "KVError.h"
void MyClass::Method1(int x)
{
if(x>0)
KVError::Info(this, "Method1", "The value of x (%d) is positive", x);
}
void MyClass::Method2(int x)
{
if(x%2)
KVError::Warning(this, "Method2", "x is an odd number (%d)", x);
}
void MyClass::Method3(int x)
{
if(x<0)
KVError::Error(this, "Method3", "Called with negative value for x, %d", x);
}
void Error(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:116
void Warning(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:125
void Info(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:134

In static method definitions, where the this pointer is not defined, you can pass any valid object of the class (i.e. a default-constructed temporary) as first argument:

~~~{.cpp} #include "KVError.h"

class MyClass { public:

static void StaticMethod() { KVError::Info(MyClass{}, "StaticMethod", "I'm in a static method"); } }; ~~~`

Function Documentation

◆ Error()

template<typename UserClass >
void KVError::Error ( UserClass  p,
const char *  location,
const char *  va_fmt,
  ... 
)

Definition at line 116 of file KVError.h.

◆ Info()

template<typename UserClass >
void KVError::Info ( UserClass  p,
const char *  location,
const char *  va_fmt,
  ... 
)

Definition at line 134 of file KVError.h.

◆ make_handler() [1/3]

template<typename UserClass >
std::enable_if_t<std::is_class_v<UserClass>,colour_error_handler<UserClass> > KVError::make_handler ( const UserClass &  )

Definition at line 96 of file KVError.h.

◆ make_handler() [2/3]

template<typename UserClass >
std::enable_if_t<std::is_class_v<UserClass>,colour_error_handler<UserClass> > KVError::make_handler ( const UserClass *  )

Definition at line 110 of file KVError.h.

◆ make_handler() [3/3]

template<typename UserClass >
std::enable_if_t<std::is_class_v<UserClass>,colour_error_handler<UserClass> > KVError::make_handler ( UserClass *  )

Definition at line 103 of file KVError.h.

◆ Warning()

template<typename UserClass >
void KVError::Warning ( UserClass  p,
const char *  location,
const char *  va_fmt,
  ... 
)

Definition at line 125 of file KVError.h.