Pointers performing reference counting.
More...
#include <GyotoSmartPointer.h>
|
| | SmartPointer (T *orig=NULL) |
| | Constructor from a standard pointer-to-class.
|
| | SmartPointer (const SmartPointer< T > &orig) |
| | Copy constructor from same type.
|
| template<class U> |
| | SmartPointer (const SmartPointer< U > &orig) |
| | Copy constructor from compatible type (used for casting).
|
| T & | operator* () |
| | Dereference operator "*".
|
| const T & | operator* () const |
| | Dereference operator "*".
|
| T * | operator-> () |
| | Dereference operator "->".
|
| T * | operator-> () const |
| | Dereference operator "->" (const).
|
|
bool | operator== (const SmartPointer< T > &right) |
| | Comparison operator between two SmartPointer of same kind.
|
|
bool | operator!= (const SmartPointer< T > &right) |
| | Comparison operator between two SmartPointer of same kind.
|
|
SmartPointer< T > & | operator= (SmartPointer< T > &right) |
| | Copy a SmartPointer to another (already defined) SmartPointer of same kind.
|
|
SmartPointer< T > & | operator= (T *right) |
| | Copy a normal pointer to an (already defined) SmartPointer of same kind.
|
|
| operator T* () const |
| | Cast SmartPointer to normal pointer.
|
| const T * | operator() () const |
| | Get standard, non-smart pointer to object. Use with care.
|
|
|
void | decRef () |
| | Decrement the reference counter. Warning: don't mess with it.
|
|
|
T * | obj |
| | Real pointer, don't mess with it.
|
template<class T>
class Gyoto::SmartPointer< T >
Pointers performing reference counting.
Pointee must inherit from class SmartPointee.
To create an object and a SmartPointer pointing to it:
SmartPointer(T *orig=NULL)
Constructor from a standard pointer-to-class.
Definition GyotoSmartPointer.h:169
Access to metrics.
Definition GyotoAstrobj.h:47
- Template Parameters
-
◆ SmartPointer() [1/3]
Constructor from a standard pointer-to-class.
- Parameters
-
| orig | : a pointer to an instance of class T, created using new T(). |
Example:
◆ SmartPointer() [2/3]
Copy constructor from same type.
- Parameters
-
Example:
ObjPtr and ObjPtr2 point to the same instance of class T. Copying increments the reference counter.
◆ SmartPointer() [3/3]
template<class T>
template<class U>
Copy constructor from compatible type (used for casting).
- Parameters
-
Example: MetricPtr is a SmartPoiter<Metric>, but really points to an instance of the child class Gyoto::Kerr:
MetricPtr and KerrPtr point to the same instance of class Kerr. The methods specific to class Kerr are available only to KerrPtr.
◆ operator()()
Get standard, non-smart pointer to object. Use with care.
This public method is needed to cast from a SmartPointer flavor to another. It should almost certainly never be used in user code, except perhaps for debugging purposes.
- Returns
- usual pointer to object, T*.
◆ operator*() [1/2]
Dereference operator "*".
- Returns
- address of the pointed-to-object
◆ operator*() [2/2]
Dereference operator "*".
- Returns
- address of the pointed-to-object
◆ operator->() [1/2]
Dereference operator "->".
Access to the pointed-to-object's members.
◆ operator->() [2/2]
Dereference operator "->" (const).
Access to the pointed-to-object's members.
The documentation for this class was generated from the following files: