include
ecl
utilities
singleton.hpp
Go to the documentation of this file.
1
13
/*****************************************************************************
14
** Ifdefs
15
*****************************************************************************/
16
17
#ifndef ECL_UTILITIES_SINGLETON_HPP_
18
#define ECL_UTILITIES_SINGLETON_HPP_
19
20
/*****************************************************************************
21
** Namespaces
22
*****************************************************************************/
23
24
namespace
ecl
{
25
26
/*****************************************************************************
27
** Class [Singleton]
28
*****************************************************************************/
51
template
<
typename
T>
class
Singleton
52
{
53
public
:
59
static
T&
instance
()
60
{
61
static
T the_single_instance;
// assumes T has a protected default constructor
62
return
the_single_instance;
63
}
64
65
virtual
~Singleton
() {}
66
};
67
68
};
// namespace ecl
69
70
#endif
/*ECL_UTILITIES_SINGLETON_HPP_*/
ecl::Singleton::instance
static T & instance()
Definition:
singleton.hpp:69
ecl
Embedded control libraries.
ecl::Singleton::~Singleton
virtual ~Singleton()
Definition:
singleton.hpp:75
ecl_utilities
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:32