Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Classes | Namespaces | Macros | Enumerations | Variables
JMessage.hh File Reference

General purpose messaging. More...

#include <iostream>
#include "JLang/JFileStream.hh"
#include "Jeep/JColor.hh"

Go to the source code of this file.

Classes

struct  JEEP::JMessage< T >
 Auxiliary class for handling debug parameter within a class. More...
 

Namespaces

 JEEP
 General puprpose classes and methods.
 
 JPP
 This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 

Macros

#define DEBUG(A)   do { if (debug >= JEEP::debug_t) { std::cout << A << std::flush; } } while (0)
 Message macros. More...
 
#define STATUS(A)   do { if (debug >= JEEP::status_t) { std::cout << A << std::flush; } } while (0)
 
#define NOTICE(A)   do { if (debug >= JEEP::notice_t) { std::cerr << A << std::flush; } } while (0)
 
#define WARNING(A)   do { if (debug >= JEEP::warning_t) { std::cerr << "WARNING: " << A << std::flush; } } while (0)
 
#define ERROR(A)   do { { std::cerr << "ERROR: " << A << std::flush; } } while (0)
 
#define FATAL(A)   do { { std::cerr << "FATAL: " << A << std::endl; exit(1); } } while (0)
 
#define VARGS_STREAM(A, B, ...)   B
 Make std::ostream compatible output for variadic macro. More...
 
#define ASSERT(A, ...)
 Assert macro. More...
 
#define QAQC(A)   do { if (qaqc > 0) { JLANG::JFileOutputStream(qaqc) << A; } } while (0)
 QA/QC output macro. More...
 

Enumerations

enum  JEEP::JMessage_t {
  JEEP::debug_t = 3 , JEEP::status_t = 2 , JEEP::warning_t = 2 , JEEP::notice_t = 1 ,
  JEEP::error_t = 0 , JEEP::fatal_t = 0
}
 Debug level. More...
 

Variables

int debug
 debug level More...
 
int qaqc
 QA/QC file descriptor. More...
 

Detailed Description

General purpose messaging.

Author
mdejong

Definition in file JMessage.hh.

Macro Definition Documentation

◆ DEBUG

#define DEBUG (   A)    do { if (debug >= JEEP::debug_t) { std::cout << A << std::flush; } } while (0)

Message macros.

Parameters
Astd::ostream compatible output

Definition at line 62 of file JMessage.hh.

◆ STATUS

#define STATUS (   A)    do { if (debug >= JEEP::status_t) { std::cout << A << std::flush; } } while (0)

Definition at line 63 of file JMessage.hh.

◆ NOTICE

#define NOTICE (   A)    do { if (debug >= JEEP::notice_t) { std::cerr << A << std::flush; } } while (0)

Definition at line 64 of file JMessage.hh.

◆ WARNING

#define WARNING (   A)    do { if (debug >= JEEP::warning_t) { std::cerr << "WARNING: " << A << std::flush; } } while (0)

Definition at line 65 of file JMessage.hh.

◆ ERROR

#define ERROR (   A)    do { { std::cerr << "ERROR: " << A << std::flush; } } while (0)

Definition at line 66 of file JMessage.hh.

◆ FATAL

#define FATAL (   A)    do { { std::cerr << "FATAL: " << A << std::endl; exit(1); } } while (0)

Definition at line 67 of file JMessage.hh.

◆ VARGS_STREAM

#define VARGS_STREAM (   A,
  B,
  ... 
)    B

Make std::ostream compatible output for variadic macro.

When called,

  • first argument should correspond to a dummy value;
  • second to the ##__VA_ARGS__ macro; and
  • third to the fall back value (e.g. "");
Parameters
Adummy value
B##__VA_ARGS__ macro
Returns
output

Definition at line 82 of file JMessage.hh.

◆ ASSERT

#define ASSERT (   A,
  ... 
)
Value:
do { \
if (A) { NOTICE(JEEP::GREEN << "Test at " << __FILE__ << ":" << __LINE__ << " (" << #A << ") \"" << VARGS_STRING("", ##__VA_ARGS__, "") << "\" passed." << JEEP::RESET << std::endl); } \
else { FATAL (JEEP::RED << "Test at " << __FILE__ << ":" << __LINE__ << " (" << #A << ") \"" << VARGS_STRING("", ##__VA_ARGS__, "") << "\" failed." << JEEP::RESET << std::endl); } } while (0)
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
#define VARGS_STRING(A, B,...)
Make string for variadic macro.
Definition: JParser.hh:2136
@ RED
red
Definition: JColorFacet.hh:30
@ RESET
reset
Definition: JColorFacet.hh:37
@ GREEN
green
Definition: JColorFacet.hh:31

Assert macro.

Parameters
Atest

Definition at line 90 of file JMessage.hh.

◆ QAQC

#define QAQC (   A)    do { if (qaqc > 0) { JLANG::JFileOutputStream(qaqc) << A; } } while (0)

QA/QC output macro.

Parameters
Aostream compatible output

Definition at line 100 of file JMessage.hh.

Variable Documentation

◆ debug

int debug
extern

debug level

Definition at line 69 of file JSirene.cc.

◆ qaqc

int qaqc
extern

QA/QC file descriptor.