Main Page
Modules
Namespaces
Classes
Files
File List
File Members
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
ecl::Singleton::~Singleton
virtual ~Singleton()
ecl::Singleton::instance
static T & instance()
xbot_node
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:28:13