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 <boost/shared_ptr.hpp>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS DEFINITION
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
83 template< typename T > // Type of the lifetime dependency
85 {
86  public:
87  //**Constructor*********************************************************************************
90  inline Dependency();
91  // No explicitly declared copy constructor.
93  //**********************************************************************************************
94 
95  //**Destructor**********************************************************************************
96  // No explicitly declared destructor.
97  //**********************************************************************************************
98 
99  //**Copy assignment operator********************************************************************
100  // No explicitly declared copy assignment operator.
101  //**********************************************************************************************
102 
103  private:
104  //**Member variables****************************************************************************
107  boost::shared_ptr<T> dependency_;
108 
109  //**********************************************************************************************
110 };
111 //*************************************************************************************************
112 
113 
114 
115 
116 //=================================================================================================
117 //
118 // CONSTRUCTOR
119 //
120 //=================================================================================================
121 
122 //*************************************************************************************************
125 template< typename T > // Type of the lifetime dependency
127  : dependency_( T::instance() ) // Handle to the lifetime dependency
128 {
129  BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( T, typename T::SingletonType );
130 }
131 //*************************************************************************************************
132 
133 } // namespace blaze
134 
135 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM(D, B)
Constraint on the inheritance relationship of a data type.In case D is not derived from B...
Definition: DerivedFrom.h:78
Constraint on the inheritance relationship of a data type.
Lifetime dependency on a singleton object.The Dependency template class represents a lifetime depende...
Definition: Dependency.h:84
Dependency()
Default constructor for Dependency.
Definition: Dependency.h:126
boost::shared_ptr< T > dependency_
Handle to the lifetime dependency.
Definition: Dependency.h:107