Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
util
singleton
Dependency.h
Go to the documentation of this file.
1
//=================================================================================================
33
//=================================================================================================
34
35
#ifndef _BLAZE_UTIL_SINGLETON_DEPENDENCY_H_
36
#define _BLAZE_UTIL_SINGLETON_DEPENDENCY_H_
37
38
39
//*************************************************************************************************
40
// Includes
41
//*************************************************************************************************
42
43
#include <memory>
44
#include <
blaze/util/constraints/DerivedFrom.h
>
45
46
47
namespace
blaze {
48
49
//=================================================================================================
50
//
51
// CLASS DEFINITION
52
//
53
//=================================================================================================
54
55
//*************************************************************************************************
83
template
<
typename
T >
// Type of the lifetime dependency
84
class
Dependency
85
{
86
public
:
87
//**Constructors********************************************************************************
90
inline
Dependency
();
92
//**********************************************************************************************
93
94
private
:
95
//**Member variables****************************************************************************
98
std::shared_ptr<T>
dependency_
;
100
//**********************************************************************************************
101
};
102
//*************************************************************************************************
103
104
105
106
107
//=================================================================================================
108
//
109
// CONSTRUCTORS
110
//
111
//=================================================================================================
112
113
//*************************************************************************************************
116
template
<
typename
T >
// Type of the lifetime dependency
117
inline
Dependency<T>::Dependency
()
118
:
dependency_
( T::instance() )
// Handle to the lifetime dependency
119
{
120
BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM
( T,
typename
T::SingletonType );
121
}
122
//*************************************************************************************************
123
124
}
// namespace blaze
125
126
#endif
DerivedFrom.h
Constraint on the inheritance relationship of a data type.
blaze::Dependency::Dependency
Dependency()
Default constructor for Dependency.
Definition
Dependency.h:117
blaze::Dependency::dependency_
std::shared_ptr< T > dependency_
Handle to the lifetime dependency.
Definition
Dependency.h:98
BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM
#define BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM(D, B)
Constraint on the inheritance relationship of a data type.
Definition
DerivedFrom.h:60
Generated by
1.18.0