HepMC3 event record library: Errors.h Source File

HepMC3 event record library

Errors.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of HepMC
4// Copyright (C) 2014-2023 The HepMC collaboration (see AUTHORS for details)
5//
6/**
7 * @file Errors.h
8 * @brief Implementation of error and HEPMC3_HEPMC3_WARNING macros
9 *
10 */
11#ifndef HEPMC3_ERRORS_H
12#define HEPMC3_ERRORS_H
13
14#include <iostream>
15#include <stdexcept>
16#include <HepMC3/Setup.h>
17namespace HepMC3 {
18
19
20/// @name Printing macros
21/// @{
22
23/** @brief Macro for printing error messages */
24#define HEPMC3_ERROR(MESSAGE) if ( Setup::print_errors() ) { std::cerr << "ERROR::" << MESSAGE << std::endl; }
25
26/** @brief Macro for printing error messages */
27#define HEPMC3_ERROR_LEVEL(LEVEL,MESSAGE) if ( Setup::errors_level()>=(LEVEL) && Setup::print_errors() ) { std::cerr << "ERROR::" << MESSAGE << std::endl; }
28
29
30/** @brief Macro for printing HEPMC3_HEPMC3_WARNING messages */
31#define HEPMC3_WARNING(MESSAGE) if ( Setup::print_warnings() ) { std::cout << "WARNING::" << MESSAGE << std::endl; }
32
33/** @brief Macro for printing HEPMC3_HEPMC3_WARNING messages */
34#define HEPMC3_WARNING_LEVEL(LEVEL,MESSAGE) if ( Setup::warnings_level()>=(LEVEL) && Setup::print_warnings() ) { std::cout << "WARNING::" << MESSAGE << std::endl; }
35
36
37// Debug messages and code that will not go to the release version
38#ifndef HEPMC3_RELEASE_VERSION
39
40/** @brief Macro for printing debug messages with appropriate debug level */
41#define HEPMC3_DEBUG(LEVEL,MESSAGE) if ( Setup::debug_level()>=(LEVEL) ) { std::cout << "DEBUG(" << LEVEL <<")::" << MESSAGE << std::endl; }
42/** @brief Macro for storing code useful for debugging */
43#define HEPMC3_DEBUG_CODE_BLOCK( x ) x
44
45#else
46
47#define HEPMC3_DEBUG( x,y )
48#define HEPMC3_DEBUG_CODE_BLOCK( x )
49
50#endif
51
52/// @}
53
54} // namespace HepMC3
55
56#endif
Setup.h
Definition of class Setup.
HepMC3
HepMC3 main namespace.
Definition AnalysisExample.h:24