Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MED_SharedPtr_HeaderFile
00029 #define MED_SharedPtr_HeaderFile
00030
00031 #include <boost/shared_ptr.hpp>
00032
00033 namespace MED
00034 {
00035
00037
00042 template<class T> class SharedPtr: public boost::shared_ptr<T>
00043 {
00044 public:
00046 SharedPtr() {}
00047
00049 template<class Y>
00050 explicit SharedPtr(Y * p):
00051 boost::shared_ptr<T>(p)
00052 {}
00053
00055 template<class Y>
00056 SharedPtr(SharedPtr<Y> const & r):
00057 boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
00058 {}
00059
00061 template<class Y>
00062 SharedPtr&
00063 operator=(SharedPtr<Y> const & r)
00064 {
00065 boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag()).swap(*this);
00066 return *this;
00067 }
00068
00070 template<class Y>
00071 SharedPtr&
00072 operator()(Y * p)
00073 {
00074 return operator=<Y>(SharedPtr<Y>(p));
00075 }
00076
00078 template<class Y>
00079 SharedPtr&
00080 operator()(SharedPtr<Y> const & r)
00081 {
00082 return operator=<Y>(SharedPtr<Y>(r));
00083 }
00084
00086 operator const T& () const
00087 {
00088 return *(this->get());
00089 }
00090
00092 operator T& ()
00093 {
00094 return *(this->get());
00095 }
00096 };
00097
00098 }
00099
00100
00101 #endif