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
00029 #ifndef TEUCHOS_REFCOUNTPTR_SHAREDPTR_CONVERSIONS_DECL_H
00030 #define TEUCHOS_REFCOUNTPTR_SHAREDPTR_CONVERSIONS_DECL_H
00031
00032 #include "Teuchos_RefCountPtrDecl.hpp"
00033 #include "boost/shared_ptr.hpp"
00034
00035 namespace Teuchos {
00036
00052
00055 template<class T>
00056 class DeallocBoostSharedPtr
00057 {
00058 public:
00060 DeallocBoostSharedPtr( const boost::shared_ptr<T> &sptr ) : sptr_(sptr) {}
00062 typedef T ptr_t;
00064 void free( T* ptr ) const { sptr_.reset(); }
00066 const boost::shared_ptr<T>& ptr() const { return sptr_; }
00067 private:
00068 mutable boost::shared_ptr<T> sptr_;
00069 DeallocBoostSharedPtr();
00070 };
00071
00075 template<class T>
00076 class RefCountPtrDeleter
00077 {
00078 public:
00080 RefCountPtrDeleter( const RefCountPtr<T> &rcp ) : rcp_(rcp) {}
00082 typedef void result_type;
00084 typedef T * argument_type;
00086 void operator()(T * x) const { rcp_ = null; }
00088 const RefCountPtr<T>& ptr() const { return rcp_; }
00089 private:
00090 mutable RefCountPtr<T> rcp_;
00091 RefCountPtrDeleter();
00092 };
00093
00102 template<class T>
00103 RefCountPtr<T> rcp( const boost::shared_ptr<T> &sptr );
00104
00114 template<class T>
00115 boost::shared_ptr<T> shared_pointer( const RefCountPtr<T> &rcp );
00116
00118
00119 }
00120
00121 #endif // TEUCHOS_REFCOUNTPTR_SHAREDPTR_CONVERSIONS_DECL_H