AGX Dynamics 2.41.1.2
Loading...
Searching...
No Matches
agx::ref_ptr< T > Class Template Reference

Smart pointer for handling referenced counted objects. More...

#include <ref_ptr.h>

+ Inheritance diagram for agx::ref_ptr< T >:

Public Types

typedef T element_type
 The type of the referenced class.
 

Public Member Functions

 ref_ptr ()
 Constructor.
 
 ref_ptr (const ref_ptr &rp)
 Copy constructor. Will increment reference count with one.
 
 ref_ptr (T *ptr)
 Will take ownership and reference ptr.
 
 ~ref_ptr ()
 Destructor, will decrement reference count with one.
 
void forceClear ()
 Force the pointer to the referenced object to be null. Without deleting or decrement counters. Use with caution!
 
T * get () const
 
bool isValid () const
 
 operator T* () const
 Cast operator that will cast the ref_ptr to its native type.
 
bool operator! () const
 
template<typename U >
bool operator!= (ref_ptr< U > const &rp) const
 
template<typename U >
bool operator!= (U *p) const
 
template<typename U >
bool operator!= (U const *p) const
 
T & operator* () const
 
T * operator-> () const
 automatic cast to native pointer and use the dereferencing operator
 
bool operator< (const ref_ptr &rp) const
 
ref_ptroperator= (const ref_ptr &rp)
 Assignment operator, will increment reference count.
 
ref_ptroperator= (T *ptr)
 Assignment operator, will reference and increment its reference count with one.
 
template<typename U >
bool operator== (ref_ptr< U > const &rp) const
 
template<typename U >
bool operator== (U *p) const
 
template<typename U >
bool operator== (U const *p) const
 
T * release ()
 Release the reference (without decrementing) to the referenced object and return a native pointer.
 
void swap (ref_ptr &rp)
 Swap rb with this reference without changing reference count.
 

Detailed Description

template<class T>
class agx::ref_ptr< T >

Smart pointer for handling referenced counted objects.

Definition at line 29 of file ref_ptr.h.

Member Typedef Documentation

◆ element_type

template<class T >
typedef T agx::ref_ptr< T >::element_type

The type of the referenced class.

Definition at line 36 of file ref_ptr.h.

Constructor & Destructor Documentation

◆ ref_ptr() [1/3]

template<typename T >
agx::ref_ptr< T >::ref_ptr

Constructor.

Definition at line 145 of file ref_ptr.h.

◆ ref_ptr() [2/3]

template<typename T >
agx::ref_ptr< T >::ref_ptr ( T *  ptr)

Will take ownership and reference ptr.

Definition at line 148 of file ref_ptr.h.

◆ ref_ptr() [3/3]

template<typename T >
agx::ref_ptr< T >::ref_ptr ( const ref_ptr< T > &  rp)

Copy constructor. Will increment reference count with one.

Definition at line 154 of file ref_ptr.h.

◆ ~ref_ptr()

template<typename T >
agx::ref_ptr< T >::~ref_ptr

Destructor, will decrement reference count with one.

Definition at line 160 of file ref_ptr.h.

Member Function Documentation

◆ forceClear()

template<typename T >
void agx::ref_ptr< T >::forceClear

Force the pointer to the referenced object to be null. Without deleting or decrement counters. Use with caution!

Definition at line 283 of file ref_ptr.h.

◆ get()

◆ isValid()

template<typename T >
bool agx::ref_ptr< T >::isValid
Returns
true if the referenced pointer is != null

Definition at line 268 of file ref_ptr.h.

Referenced by agx::ScalarParameter::get(), and agxWire::Wire::hasPropertyContainer().

◆ operator T*()

template<typename T >
agx::ref_ptr< T >::operator T*

Cast operator that will cast the ref_ptr to its native type.

Definition at line 196 of file ref_ptr.h.

◆ operator!()

template<typename T >
bool agx::ref_ptr< T >::operator!
Returns
true if the referenced pointer is == null

Definition at line 262 of file ref_ptr.h.

◆ operator!=() [1/3]

template<typename T >
template<typename U >
bool agx::ref_ptr< T >::operator!= ( ref_ptr< U > const &  rp) const
Returns
true if the reference pointer is NOT pointing to the same object as rp

Definition at line 208 of file ref_ptr.h.

References agx::ref_ptr< T >::get().

◆ operator!=() [2/3]

template<typename T >
template<typename U >
bool agx::ref_ptr< T >::operator!= ( U *  p) const
Returns
true if the reference pointer is NOT pointing to the same object as p

Definition at line 232 of file ref_ptr.h.

◆ operator!=() [3/3]

template<typename T >
template<typename U >
bool agx::ref_ptr< T >::operator!= ( U const *  p) const
Returns
true if the reference pointer is NOT pointing to the same object as p

Definition at line 220 of file ref_ptr.h.

◆ operator*()

template<typename T >
T & agx::ref_ptr< T >::operator*
Returns
a reference to the referenced object

Definition at line 244 of file ref_ptr.h.

◆ operator->()

template<typename T >
T * agx::ref_ptr< T >::operator->

automatic cast to native pointer and use the dereferencing operator

Definition at line 250 of file ref_ptr.h.

◆ operator<()

template<typename T >
bool agx::ref_ptr< T >::operator< ( const ref_ptr< T > &  rp) const
Returns
true if the pointer this is referencing to is less than the one rp is referencing.

Definition at line 238 of file ref_ptr.h.

◆ operator=() [1/2]

template<typename T >
ref_ptr< T > & agx::ref_ptr< T >::operator= ( const ref_ptr< T > &  rp)

Assignment operator, will increment reference count.

Definition at line 167 of file ref_ptr.h.

◆ operator=() [2/2]

template<typename T >
ref_ptr< T > & agx::ref_ptr< T >::operator= ( T *  ptr)

Assignment operator, will reference and increment its reference count with one.

Definition at line 181 of file ref_ptr.h.

◆ operator==() [1/3]

template<typename T >
template<typename U >
bool agx::ref_ptr< T >::operator== ( ref_ptr< U > const &  rp) const
Returns
true if the reference pointer is pointing to the same object as rp

Definition at line 202 of file ref_ptr.h.

References agx::ref_ptr< T >::get().

◆ operator==() [2/3]

template<typename T >
template<typename U >
bool agx::ref_ptr< T >::operator== ( U *  p) const
Returns
true if the reference pointer is pointing to the same object as p

Definition at line 226 of file ref_ptr.h.

◆ operator==() [3/3]

template<typename T >
template<typename U >
bool agx::ref_ptr< T >::operator== ( U const *  p) const
Returns
true if the reference pointer is pointing to the same object p

Definition at line 214 of file ref_ptr.h.

◆ release()

template<typename T >
T * agx::ref_ptr< T >::release

Release the reference (without decrementing) to the referenced object and return a native pointer.

Definition at line 274 of file ref_ptr.h.

◆ swap()

template<typename T >
void agx::ref_ptr< T >::swap ( ref_ptr< T > &  rp)

Swap rb with this reference without changing reference count.

Definition at line 289 of file ref_ptr.h.

Referenced by std::swap().


The documentation for this class was generated from the following file: