10 #ifndef TEUCHOS_PTR_HPP
11 #define TEUCHOS_PTR_HPP
14 #include "Teuchos_PtrDecl.hpp"
21 namespace PtrPrivateUtilityPack {
22 TEUCHOSCORE_LIB_DLL_EXPORT
void throw_null(
const std::string &type_name );
26 template<
class T>
inline
32 template<
class T>
inline
38 template<
class T>
inline
42 ,rcp_(ptr_in.access_rcp())
48 template<
class T2>
inline
52 ,rcp_(ptr_in.access_rcp())
57 template<
class T>
inline
68 template<
class T>
inline
71 debug_assert_not_null();
72 debug_assert_valid_ptr();
77 template<
class T>
inline
80 debug_assert_not_null();
81 debug_assert_valid_ptr();
86 template<
class T>
inline
89 debug_assert_valid_ptr();
94 template<
class T>
inline
101 template<
class T>
inline
110 template<
class T>
inline
116 template<
class T>
inline
123 template<
class T>
inline
126 return ptr_implicit_cast<
const T>(*this);
130 template<
class T>
inline
134 rcp_.access_private_node().assert_valid_ptr(*
this);
142 template<
class T>
inline
144 : ptr_(p.getRawPtr()), rcp_(p)
148 #endif // TEUCHOS_DEBUG
155 std::ostream& Teuchos::operator<<( std::ostream& out, const Ptr<T>& p )
158 << TypeNameTraits<RCP<T> >::name() <<
"{"
159 <<
"ptr="<<(
const void*)(p.get())
165 #endif // TEUCHOS_PTR_HPP
ENull
Used to initialize a RCP object to NULL using an implicit conversion!
T * getRawPtr() const
Get the raw C++ pointer to the underlying object.
Ptr(ENull null_in=null)
Default construct to NULL.
T & operator*() const
Dereference the underlying object.
const Ptr< T > & assert_not_null() const
Throws std::logic_error if this->get()==NULL, otherwise returns reference to *this.
bool is_null() const
Return true if the wrapped raw pointer is NULL, else return false.
Default traits class that just returns typeid(T).name().
Ptr< const T > getConst() const
Return a Ptr<const T> version of *this.
Reference-counted pointer class and non-member templated function implementations.
const Ptr< T > ptr() const
Return a copy of *this.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
T * get() const
Get the raw C++ pointer to the underlying object.
T * operator->() const
Pointer (->) access to members of underlying object.
Ptr< T > & operator=(const Ptr< T > &ptr)
Shallow copy of the underlying pointer.