43 #ifndef TEUCHOS_PTR_DECL_HPP
44 #define TEUCHOS_PTR_DECL_HPP
126 inline explicit Ptr( T *
ptr );
171 inline T*
get()
const;
211 T* access_private_ptr()
const
213 const RCP<T> access_rcp()
const
226 template<
typename T>
inline
238 template<
typename T>
inline
250 template<
typename T>
inline
262 template<
typename T>
inline
274 template<
typename T>
inline
286 template<
typename T>
inline
297 template<
typename T>
inline
308 template<
typename T>
inline
317 if (!
is_null(ptr.access_rcp()))
318 return ptr.access_rcp();
320 return rcpFromRef(*ptr);
328 template<
typename T>
inline
343 template<
typename T>
inline
354 template<
class T>
inline
365 template<
class T>
inline
376 template<
class T>
inline
398 template<
class T1,
class T2>
401 return p1.
get() == p2.
get();
410 template<
class T1,
class T2>
413 return p1.
get() != p2.
get();
428 template<
class T2,
class T1>
448 template<
class T2,
class T1>
463 template<
class T2,
class T1>
495 template<
class T2,
class T1>
497 const Ptr<T1>& p1,
bool throw_on_fail =
false
505 check =
dynamic_cast<T2*
>(p1.get());
522 std::ostream& operator<<( std::ostream& out, const Ptr<T>& p );
528 #endif // TEUCHOS_PTR_DECL_HPP
Ptr< T > inOutArg(T &arg)
create a non-persisting (required or optional) input/output argument for a function call...
bool is_null(const Ptr< T > &p)
Returns true if p.get()==NULL.
Ptr< T2 > ptr_static_cast(const Ptr< T1 > &p1)
Static cast of underlying Ptr type from T1* to T2*.
bool operator==(const Ptr< T1 > &p1, const Ptr< T2 > &p2)
Return true if two Ptr objects point to the same object.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
void debug_assert_valid_ptr() const
Ptr< T > optInArg(T &arg)
create a non-persisting non-const optional input argument for a function call.
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< T2 > ptr_dynamic_cast(const Ptr< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying Ptr type from T1* to T2*.
Ptr< T2 > ptr_implicit_cast(const Ptr< T1 > &p1)
Implicit cast of underlying Ptr type from T1* to T2*.
T_To & dyn_cast(T_From &from)
Dynamic casting utility function meant to replace dynamic_cast<T&> by throwing a better documented er...
Ptr< T > ptrFromRef(T &arg)
Create a pointer to a object from an object reference.
Ptr< T > inoutArg(T &arg)
create a non-persisting (required or optional) input/output argument for a function call...
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.
Ptr< const T > ptrInArg(T &arg)
create a general Ptr input argument for a function call from a reference.
Ptr< T > ptr(T *p)
Create a pointer to an object from a raw pointer.
bool is_null() const
Return true if the wrapped raw pointer is NULL, else return false.
void debug_assert_not_null() const
RCP< T > rcpFromPtr(const Ptr< T > &ptr)
Create an RCP<T> from a Ptr<T> object.
bool operator!=(const Ptr< T1 > &p1, const Ptr< T2 > &p2)
Return true if two Ptr objects do not point to the same object.
Reference-counted pointer class and non-member templated function implementations.
Smart reference counting pointer class for automatic garbage collection.
Ptr< const T > constPtr(T &arg)
Create a pointer from a const object given a non-const object reference.
bool nonnull(const Ptr< T > &p)
Returns true if p.get()!=NULL
Ptr< T > outArg(T &arg)
create a non-persisting (required or optional) output argument for a function call.
Ptr< const T > getConst() const
Return a Ptr<const T> version of *this.
Ptr< const T > constOptInArg(T &arg)
create a non-persisting const optional input argument for a function call.
const Ptr< T > ptr() const
Return a copy of *this.
bool operator!=(const Ptr< T > &p, ENull)
Returns true if p.get()!=NULL.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
bool operator==(const Ptr< T > &p, ENull)
Returns true if p.get()==NULL.
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.
Ptr< T2 > ptr_const_cast(const Ptr< T1 > &p1)
Constant cast of underlying Ptr type from T1* to T2*.