cepgen
is hosted by
Hepforge
,
IPPP Durham
CepGen
N/A
Central exclusive processes event generator
Toggle main menu visibility
Main Page
Related Pages
Packages
Package List
Package Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
y
Variables
Typedefs
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
b
c
d
e
g
h
i
l
m
n
p
r
t
u
w
x
y
z
Related Symbols
d
g
h
o
u
v
Files
File List
File Members
All
_
a
b
c
d
e
h
o
p
r
s
Functions
Variables
Macros
_
b
c
d
e
p
r
s
▼
CepGen
Reference manual
Bibliography
►
Packages
►
Classes
▼
Files
▼
File List
▼
include
▼
CepGen
►
Cards
▼
Core
►
Exception.h
►
GeneratorWorker.h
►
ParametersDescription.h
►
ParametersList.h
►
RunParameters.h
►
Steerable.h
►
SteeredObject.h
►
Event
►
EventFilter
►
FormFactors
►
Integration
►
Modules
►
PartonFluxes
►
Physics
►
Process
►
StructureFunctions
►
Utils
►
Generator.h
►
Version.h
►
CepGenBoost
►
CepGenHepMC2
►
CepGenHepMC3
►
CepGenHerwig6
►
CepGenMadGraph
►
CepGenPythia6
►
CepGenPythia8
►
CepGenPython
►
CepGenRoot
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1
/*
2
* CepGen: a central exclusive processes event generator
3
* Copyright (C) 2013-2025 Laurent Forthomme
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef CepGen_Core_Exception_h
20
#define CepGen_Core_Exception_h
21
22
#include "
CepGen/Utils/Message.h
"
23
24
namespace
cepgen
{
26
class
Exception
:
public
LoggedMessage
,
public
std::runtime_error {
27
public
:
29
enum struct
Type
{
30
undefined
= -1,
31
error
,
32
fatal
33
};
29
enum struct
Type
{
…
};
34
explicit
Exception
(
const
std::string& module_name,
35
const
std::string&
from
=
""
,
36
Type
type
=
Type::undefined
,
37
const
std::string&
file
=
""
,
38
short
lineno = 0) noexcept(true);
39
Exception
(const
Exception
&) noexcept(true);
40
~
Exception
() noexcept override;
41
42
friend std::ostream& operator<<(std::ostream&, const
Type
&);
43
44
template <typename T>
45
friend const
Exception
& operator<<(const
Exception
& exception, const T&
message
) noexcept {
46
static_cast<
const
LoggedMessage
&
>
(exception) <<
message
;
47
return
exception;
48
}
45
friend const
Exception
& operator<<(const
Exception
& exception, const T&
message
) noexcept {
…
};
49
void
dump
(std::ostream* =
nullptr
) const noexcept(true) override;
50
const
char
*
what
() const noexcept(true) override;
51
52
private:
53
const
Type
type_{
Type::undefined
};
54
mutable
char
what_[50]{
""
};
55
};
26
class
Exception
:
public
LoggedMessage
,
public
std::runtime_error {
…
};
56
static_assert
(std::is_nothrow_copy_constructible_v<Exception>,
"Exception must be nothrow copy-constructible"
);
57
}
// namespace cepgen
58
59
#define CG_ERROR(mod) cepgen::Exception(mod, __FUNC__, cepgen::Exception::Type::error, __FILE__, __LINE__)
60
#define CG_FATAL(mod) cepgen::Exception(mod, __FUNC__, cepgen::Exception::Type::fatal, __FILE__, __LINE__)
61
#define CG_ASSERT(assertion) \
62
if (!(assertion)) \
63
throw CG_FATAL("Assertion") << "Assertion '" << #assertion << "' failed.";
61
#define CG_ASSERT(assertion) \
…
64
65
#endif
Message.h
cepgen::Exception
Standard exception message.
Definition
Exception.h:26
cepgen::Exception::what
const char * what() const noexcept(true) override
cepgen::Exception::Type
Type
Enumeration of exception severities.
Definition
Exception.h:29
cepgen::Exception::Type::undefined
@ undefined
Irregular message.
cepgen::Exception::Type::error
@ error
General non-stopping error.
cepgen::Exception::Type::fatal
@ fatal
Critical and stopping error.
cepgen::Exception::Exception
Exception(const std::string &module_name, const std::string &from="", Type type=Type::undefined, const std::string &file="", short lineno=0) noexcept(true)
cepgen::Exception::dump
void dump(std::ostream *=nullptr) const noexcept(true) override
Human-readable dump of the exception.
cepgen::LoggedMessage
A simple exception handler.
Definition
Message.h:43
cepgen::LoggedMessage::from
const std::string & from() const
Origin of the exception.
Definition
Message.h:152
cepgen::LoggedMessage::type
const MessageType & type() const
Message type.
Definition
Message.h:155
cepgen::LoggedMessage::message
std::string message() const
Human-readable message.
Definition
Message.h:151
cepgen::LoggedMessage::file
const std::string & file() const
File where the exception occurred.
Definition
Message.h:153
cepgen
Common namespace for this Monte Carlo generator.
Definition
Handler.h:26
include
CepGen
Core
Exception.h
Generated on Tue Apr 22 2025 for CepGen by
1.10.0