All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Dependency.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_SINGLETON_DEPENDENCY_H_
23 #define _BLAZE_UTIL_SINGLETON_DEPENDENCY_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <boost/shared_ptr.hpp>
32 
33 
34 namespace blaze {
35 
36 //=================================================================================================
37 //
38 // CLASS DEFINITION
39 //
40 //=================================================================================================
41 
42 //*************************************************************************************************
70 template< typename T > // Type of the lifetime dependency
72 {
73  public:
74  //**Constructor*********************************************************************************
77  inline Dependency();
78  // No explicitly declared copy constructor.
80  //**********************************************************************************************
81 
82  //**Destructor**********************************************************************************
83  // No explicitly declared destructor.
84  //**********************************************************************************************
85 
86  //**Copy assignment operator********************************************************************
87  // No explicitly declared copy assignment operator.
88  //**********************************************************************************************
89 
90  private:
91  //**Member variables****************************************************************************
94  boost::shared_ptr<T> dependency_;
95 
96  //**********************************************************************************************
97 };
98 //*************************************************************************************************
99 
100 
101 
102 
103 //=================================================================================================
104 //
105 // CONSTRUCTOR
106 //
107 //=================================================================================================
108 
109 //*************************************************************************************************
112 template< typename T > // Type of the lifetime dependency
114  : dependency_( T::instance() ) // Handle to the lifetime dependency
115 {
116  BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( T, typename T::SingletonType );
117 }
118 //*************************************************************************************************
119 
120 } // namespace blaze
121 
122 #endif