CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
Singleton.hpp
1
/*
2
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3
*
4
* This software is distributed under the terms of the GNU General Public
5
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6
* the license.
7
*/
8
9
#pragma once
10
11
namespace
corsika
{
39
template
<
typename
T>
40
class
Singleton
{
41
public
:
42
static
T& getInstance() {
43
static
T instance;
44
return
instance;
45
}
46
47
Singleton
(
const
Singleton
&) =
48
delete
;
// Singleton Classes should not be copied. Removes move constructor and
49
// move assignment as well
50
Singleton
& operator=(
const
Singleton
&) =
51
delete
;
// Singleton Classes should not be copied.
52
53
protected
:
54
// derived class can call ctor and dtor
55
Singleton
() {}
56
~
Singleton
() {}
57
};
58
59
}
// namespace corsika
corsika::Singleton
Curiously Recurring Template Pattern (CRTP) for Meyers singleton.
Definition:
Singleton.hpp:40
corsika
`, since they are used everywhere as integral part of the framework.
Definition:
BoundaryCrossingProcess.hpp:14
corsika
framework
utility
Singleton.hpp
Generated by
1.8.13