HepMC3 event record library
include
HepMC3
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 warning macros
8
*
9
*/
10
#ifndef HEPMC3_ERRORS_H
11
#define HEPMC3_ERRORS_H
12
13
#include <iostream>
14
#include <stdexcept>
15
16
namespace
HepMC3
{
17
18
19
/// @name Printing macros
20
//@{
21
22
/** @brief Macro for printing error messages */
23
#define ERROR(MESSAGE) if ( Setup::print_errors() ) { std::cerr << "ERROR::" << MESSAGE << std::endl; }
24
25
/** @brief Macro for printing warning messages */
26
#define 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 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 DEBUG_CODE_BLOCK( x ) x
35
36
#else
37
38
#define DEBUG( x,y )
39
#define DEBUG_CODE_BLOCK( x )
40
41
#endif
42
43
//@}
44
45
46
/// @name Exceptions
47
//@{
48
49
/// @class Exception
50
/// @brief Standard runtime error
51
struct
Exception
:
public
std::runtime_error {
52
Exception
(
const
std::string& msg) : std::runtime_error(msg) {}
///< Default constructor
53
};
54
55
/// @brief Exception related to weight lookups, setting, and index consistency
56
struct
WeightError
:
public
Exception
{
57
WeightError
(
const
std::string& msg) :
Exception
(msg) {}
///< Default constructor
58
};
59
60
//@}
61
62
63
}
// namespace HepMC3
64
65
#endif
HepMC3::WeightError
Exception related to weight lookups, setting, and index consistency.
Definition:
Errors.h:56
HepMC3
HepMC3 main namespace.
Definition:
ReaderGZ.h:28
HepMC3::Exception
Standard runtime error.
Definition:
Errors.h:51
Generated on Tue Mar 24 2020 14:04:50 for HepMC3 event record library by
1.8.17