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-2019 The HepMC collaboration (see AUTHORS for details)
5/**
6 * @file Errors.h
7 * @brief Implementation of error and HEPMC3_HEPMC3_WARNING macros
8 *
9 */
10#ifndef HEPMC3_ERRORS_H
11#define HEPMC3_ERRORS_H
12
13#include <iostream>
14#include <stdexcept>
15
16namespace HepMC3 {
17
18
19/// @name Printing macros
20//@{
21
22/** @brief Macro for printing error messages */
23#define HEPMC3_ERROR(MESSAGE) if ( Setup::print_errors() ) { std::cerr << "ERROR::" << MESSAGE << std::endl; }
24
25/** @brief Macro for printing HEPMC3_HEPMC3_WARNING messages */
26#define HEPMC3_WARNING(MESSAGE) if ( Setup::print_warnings() ) { std::cout << "WARNING::" << MESSAGE << std::endl; }
27
28// Debug messages and code that will not go to the release version
29#ifndef HEPMC3_RELEASE_VERSION
30
31/** @brief Macro for printing debug messages with appropriate debug level */
32#define HEPMC3_DEBUG(LEVEL,MESSAGE) if( Setup::debug_level()>=(LEVEL) ) { std::cout << "DEBUG(" << LEVEL <<")::" << MESSAGE << std::endl; }
33/** @brief Macro for storing code useful for debugging */
34#define HEPMC3_DEBUG_CODE_BLOCK( x ) x
35
36#else
37
38#define HEPMC3_DEBUG( x,y )
39#define HEPMC3_DEBUG_CODE_BLOCK( x )
40
41#endif
42
43//@}
44
45
46
47
48} // namespace HepMC3
49
50#endif
HepMC3 main namespace.