1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2020 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>
17 namespace 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 HEPMC3_HEPMC3_WARNING messages */
27 #define HEPMC3_WARNING(MESSAGE) if ( Setup::print_warnings() ) { std::cout << "WARNING::" << MESSAGE << std::endl; }
28 
29 // Debug messages and code that will not go to the release version
30 #ifndef HEPMC3_RELEASE_VERSION
31 
32 /** @brief Macro for printing debug messages with appropriate debug level */
33 #define HEPMC3_DEBUG(LEVEL,MESSAGE) if ( Setup::debug_level()>=(LEVEL) ) { std::cout << "DEBUG(" << LEVEL <<")::" << MESSAGE << std::endl; }
34 /** @brief Macro for storing code useful for debugging */
35 #define HEPMC3_DEBUG_CODE_BLOCK( x ) x
36 
37 #else
38 
39 #define HEPMC3_DEBUG( x,y )
40 #define HEPMC3_DEBUG_CODE_BLOCK( x )
41 
42 #endif
43 
44 //@}
45 
46 } // namespace HepMC3
47 
48 #endif
49