Dali 3D User Interface Engine
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
Dali::Internal::OwnerPointer< T > Class Template Reference

#include <owner-pointer.h>

Inheritance diagram for Dali::Internal::OwnerPointer< T >:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::OwnerPointer< T >:
Collaboration graph
[legend]

Public Types

typedef void(OwnerPointer::* BooleanType )() const
 Pointer-to-member type. More...
 

Public Member Functions

 OwnerPointer ()
 Default constructor. More...
 
 OwnerPointer (T *object)
 Constructor. More...
 
 OwnerPointer (OwnerPointer &other)
 Copy constructor. More...
 
OwnerPointeroperator= (OwnerPointer &other)
 Assignment operator. More...
 
OwnerPointeroperator= (T *pointer)
 Assignment operator. More...
 
 ~OwnerPointer ()
 Destructor. More...
 
T & operator* ()
 Indirection operator. More...
 
T & operator* () const
 Const indirection operator. More...
 
T * operator-> ()
 Pointer operator. More...
 
T * operator-> () const
 Const pointer operator. More...
 
bool operator== (const T *pointer)
 Compare with a raw pointer. More...
 
void Reset ()
 Reset the pointer, deleting any owned object. More...
 
T * Release ()
 Release the ownership, it does not delete the object. More...
 
const T * Get () const
 Returns a const pointer to the object owned. More...
 
 operator BooleanType () const
 Converts an object handle to a BooleanType. More...
 

Private Member Functions

void ThisIsSaferThanReturningVoidStar () const
 Used by the safe bool idiom. More...
 
void Init (OwnerPointer &ownerPointer)
 Initialise this pointer from another one. More...
 

Private Attributes

T * mObject
 Raw pointer to the object. More...
 

Detailed Description

template<typename T>
class Dali::Internal::OwnerPointer< T >

Definition at line 34 of file owner-pointer.h.

Member Typedef Documentation

template<typename T>
typedef void(OwnerPointer::* Dali::Internal::OwnerPointer< T >::BooleanType)() const

Pointer-to-member type.

Objects can be implicitly converted to this for validity checks.

Definition at line 191 of file owner-pointer.h.

Constructor & Destructor Documentation

template<typename T>
Dali::Internal::OwnerPointer< T >::OwnerPointer ( )
inline

Default constructor.

Creates an OwnerPointer that does not own any object.

Definition at line 40 of file owner-pointer.h.

template<typename T>
Dali::Internal::OwnerPointer< T >::OwnerPointer ( T *  object)
inline

Constructor.

Creates an OwnerPointer that owns the object.

Parameters
[in]objectA pointer to a heap allocated object.

Definition at line 49 of file owner-pointer.h.

template<typename T>
Dali::Internal::OwnerPointer< T >::OwnerPointer ( OwnerPointer< T > &  other)
inline

Copy constructor.

Passes the ownership of a pointer to another.

Parameters
[in]otherThe pointer that gives away the ownership.

Definition at line 58 of file owner-pointer.h.

template<typename T>
Dali::Internal::OwnerPointer< T >::~OwnerPointer ( )
inline

Destructor.

Definition at line 98 of file owner-pointer.h.

Member Function Documentation

template<typename T>
const T* Dali::Internal::OwnerPointer< T >::Get ( ) const
inline

Returns a const pointer to the object owned.

Returns
a const pointer to the object.

Definition at line 181 of file owner-pointer.h.

Referenced by Dali::Internal::Object::RegisterSceneGraphProperty().

Here is the caller graph for this function:

template<typename T>
void Dali::Internal::OwnerPointer< T >::Init ( OwnerPointer< T > &  ownerPointer)
inlineprivate

Initialise this pointer from another one.

ownerPointer parameter looses ownership.

Parameters
ownerPointerowner pointer

Definition at line 216 of file owner-pointer.h.

Referenced by Dali::Internal::OwnerPointer< NodeAttachment >::operator=(), and Dali::Internal::OwnerPointer< NodeAttachment >::OwnerPointer().

Here is the caller graph for this function:

template<typename T>
Dali::Internal::OwnerPointer< T >::operator BooleanType ( ) const
inline

Converts an object handle to a BooleanType.

This is useful for checking whether the handle is NULL.

Definition at line 197 of file owner-pointer.h.

template<typename T>
T& Dali::Internal::OwnerPointer< T >::operator* ( )
inline

Indirection operator.

Returns
a reference to the object.

Definition at line 107 of file owner-pointer.h.

template<typename T>
T& Dali::Internal::OwnerPointer< T >::operator* ( ) const
inline

Const indirection operator.

Returns
a reference to the object from const OwnerPointer.

Definition at line 118 of file owner-pointer.h.

template<typename T>
T* Dali::Internal::OwnerPointer< T >::operator-> ( )
inline

Pointer operator.

Returns
a pointer to the object.

Definition at line 130 of file owner-pointer.h.

template<typename T>
T* Dali::Internal::OwnerPointer< T >::operator-> ( ) const
inline

Const pointer operator.

Returns
a pointer to the object referenced by a const OwnerPointer.

Definition at line 139 of file owner-pointer.h.

template<typename T>
OwnerPointer& Dali::Internal::OwnerPointer< T >::operator= ( OwnerPointer< T > &  other)
inline

Assignment operator.

Passes the ownership of a pointer to another.

Parameters
[in]otherThe pointer that gives away the ownership.

Definition at line 67 of file owner-pointer.h.

template<typename T>
OwnerPointer& Dali::Internal::OwnerPointer< T >::operator= ( T *  pointer)
inline

Assignment operator.

Takes the ownership of the object. If it owns an object already, it will be deleted.

Parameters
[in]pointerA pointer to a heap allocated object.

Definition at line 84 of file owner-pointer.h.

template<typename T>
bool Dali::Internal::OwnerPointer< T >::operator== ( const T *  pointer)
inline

Compare with a raw pointer.

Returns
true if the raw pointer matches the one owned by this object.

Definition at line 149 of file owner-pointer.h.

template<typename T>
T* Dali::Internal::OwnerPointer< T >::Release ( )
inline

Release the ownership, it does not delete the object.

Returns
a pointer to the object.

Definition at line 170 of file owner-pointer.h.

Referenced by Dali::Internal::Object::RegisterSceneGraphProperty().

Here is the caller graph for this function:

template<typename T>
void Dali::Internal::OwnerPointer< T >::Reset ( )
inline

Reset the pointer, deleting any owned object.

Definition at line 157 of file owner-pointer.h.

Referenced by Dali::Internal::OwnerPointer< NodeAttachment >::operator=(), and Dali::Internal::OwnerPointer< NodeAttachment >::~OwnerPointer().

Here is the caller graph for this function:

template<typename T>
void Dali::Internal::OwnerPointer< T >::ThisIsSaferThanReturningVoidStar ( ) const
inlineprivate

Used by the safe bool idiom.

Definition at line 207 of file owner-pointer.h.

Referenced by Dali::Internal::OwnerPointer< NodeAttachment >::operator BooleanType().

Here is the caller graph for this function:

Member Data Documentation

template<typename T>
T* Dali::Internal::OwnerPointer< T >::mObject
private

The documentation for this class was generated from the following file:
Dali Docs Home
Read more about Dali