ETL  0.04.19
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
handle< T > Class Template Reference

Object Handle. More...

#include <ETL/handle>

Inheritance diagram for handle< T >:
rhandle< T >

Public Types

typedef T value_type
typedef T & reference
typedef const T & const_reference
typedef T * pointer
typedef const T * const_pointer
typedef int count_type
typedef int size_type

Public Member Functions

 handle ()
 Default constructor - empty handle.
 handle (pointer x)
 Constructor that constructs from a pointer to new object.
 handle (const handle< value_type > &x)
 Default copy constructor.
 ~handle ()
 Handle is released on deletion.
handle< value_type > & operator= (const handle< value_type > &x)
 Template Assignment operator.
handle< value_type > & swap (handle< value_type > &x)
 Swaps the values of two handles without reference counts.
void detach ()
 Handle detach procedure.
void reset ()
bool empty () const
void spawn ()
 Creates a new instance of a T object and puts it in the handle.
handle< const value_typeconstant () const
 Returns a constant handle to our object.
count_type count () const
 Returns number of instances.
bool unique () const
 Returns true if there is only one instance of the object.
reference operator* () const
pointer operator-> () const
 operator bool () const
 More explicit bool cast.
 operator handle< const value_type > () const
pointer get () const
 Returns pointer to the object that is being wrapped.
bool operator! () const
template<class U >
 operator handle< U > () const
 static_cast<> overload – Useful for implicit casts

Static Public Member Functions

template<class U >
static handle< T > cast_static (const handle< U > &x)
  static_cast<> wrapper
template<class U >
static handle< T > cast_dynamic (const handle< U > &x)
  dynamic_cast<> wrapper
template<class U >
static handle< T > cast_const (const handle< U > &x)
  const_cast<> wrapper
template<class U >
static handle< T > cast_reinterpret (const handle< U > &x)
  reinterpret_cast<> wrapper
template<class U >
static handle< T > cast_static (const loose_handle< U > &x)
template<class U >
static handle< T > cast_dynamic (const loose_handle< U > &x)
template<class U >
static handle< T > cast_const (const loose_handle< U > &x)
template<class U >
static handle< T > cast_reinterpret (const loose_handle< U > &x)
template<class U >
static handle< T > cast_static (const rhandle< U > &x)
template<class U >
static handle< T > cast_dynamic (const rhandle< U > &x)
template<class U >
static handle< T > cast_const (const rhandle< U > &x)
template<class U >
static handle< T > cast_reinterpret (const rhandle< U > &x)
template<class U >
static handle< T > cast_static (U *x)
template<class U >
static handle< T > cast_dynamic (U *x)
template<class U >
static handle< T > cast_const (U *x)
template<class U >
static handle< T > cast_reinterpret (U *x)

Protected Attributes

value_typeobj
 Pointer to object.

Detailed Description

template<class T>
class handle< T >

Object Handle.

See Also
shared_object, loose_handle
Todo:
This needs to be documented

Definition at line 169 of file _handle.h.

Member Typedef Documentation

template<class T>
typedef T handle< T >::value_type

Definition at line 173 of file _handle.h.

template<class T>
typedef T& handle< T >::reference

Definition at line 174 of file _handle.h.

template<class T>
typedef const T& handle< T >::const_reference

Definition at line 175 of file _handle.h.

template<class T>
typedef T* handle< T >::pointer

Definition at line 176 of file _handle.h.

template<class T>
typedef const T* handle< T >::const_pointer

Definition at line 177 of file _handle.h.

template<class T>
typedef int handle< T >::count_type

Definition at line 178 of file _handle.h.

template<class T>
typedef int handle< T >::size_type

Definition at line 179 of file _handle.h.

Constructor & Destructor Documentation

template<class T>
handle< T >::handle ( )
inline

Default constructor - empty handle.

Definition at line 190 of file _handle.h.

Referenced by handle< T >::spawn().

template<class T>
handle< T >::handle ( pointer  x)
inline

Constructor that constructs from a pointer to new object.

Definition at line 193 of file _handle.h.

References handle< T >::obj.

template<class T>
handle< T >::handle ( const handle< value_type > &  x)
inline

Default copy constructor.

Definition at line 200 of file _handle.h.

References handle< T >::obj.

template<class T>
handle< T >::~handle ( )
inline

Handle is released on deletion.

Definition at line 207 of file _handle.h.

References handle< T >::detach().

Member Function Documentation

template<class T>
handle<value_type>& handle< T >::operator= ( const handle< value_type > &  x)
inline

Template Assignment operator.

Note
This class may not be necessary, and may be removed at some point in the future.Assignment operator

Reimplemented in rhandle< T >.

Definition at line 230 of file _handle.h.

References handle< T >::detach(), handle< T >::get(), and handle< T >::obj.

Referenced by handle< T >::spawn().

template<class T>
handle<value_type>& handle< T >::swap ( handle< value_type > &  x)
inline

Swaps the values of two handles without reference counts.

Reimplemented in rhandle< T >.

Definition at line 244 of file _handle.h.

References handle< T >::obj.

template<class T>
void handle< T >::detach ( )
inline

Handle detach procedure.

unref()'s the object and sets the internal object pointer to NULL

Reimplemented in rhandle< T >.

Definition at line 255 of file _handle.h.

References handle< T >::obj.

Referenced by handle< T >::operator=(), handle< T >::reset(), and handle< T >::~handle().

template<class T>
void handle< T >::reset ( )
inline

Reimplemented in rhandle< T >.

Definition at line 271 of file _handle.h.

References handle< T >::detach().

template<class T>
bool handle< T >::empty ( ) const
inline

Definition at line 273 of file _handle.h.

References handle< T >::obj.

template<class T>
void handle< T >::spawn ( )
inline

Creates a new instance of a T object and puts it in the handle.

Uses the default constructor

Reimplemented in rhandle< T >.

Definition at line 277 of file _handle.h.

References handle< T >::handle(), and handle< T >::operator=().

template<class T>
handle<const value_type> handle< T >::constant ( ) const
inline

Returns a constant handle to our object.

Definition at line 280 of file _handle.h.

References handle< T >::obj.

template<class T>
count_type handle< T >::count ( ) const
inline

Returns number of instances.

Definition at line 284 of file _handle.h.

References handle< T >::obj.

Referenced by handle< T >::unique().

template<class T>
bool handle< T >::unique ( ) const
inline

Returns true if there is only one instance of the object.

Definition at line 289 of file _handle.h.

References handle< T >::count(), and handle< T >::obj.

template<class T>
reference handle< T >::operator* ( ) const
inline

Definition at line 293 of file _handle.h.

References handle< T >::obj.

template<class T>
pointer handle< T >::operator-> ( ) const
inline

Definition at line 297 of file _handle.h.

References handle< T >::obj.

template<class T>
handle< T >::operator bool ( ) const
inline

More explicit bool cast.

Definition at line 301 of file _handle.h.

References NULL, and handle< T >::obj.

template<class T>
handle< T >::operator handle< const value_type > ( ) const
inline

Definition at line 304 of file _handle.h.

References handle< T >::obj.

template<class T>
template<class U >
static handle<T> handle< T >::cast_static ( const handle< U > &  x)
inlinestatic

static_cast<> wrapper

Definition at line 308 of file _handle.h.

References handle< T >::get().

template<class T>
template<class U >
static handle<T> handle< T >::cast_dynamic ( const handle< U > &  x)
inlinestatic

dynamic_cast<> wrapper

Definition at line 310 of file _handle.h.

References handle< T >::get().

template<class T>
template<class U >
static handle<T> handle< T >::cast_const ( const handle< U > &  x)
inlinestatic

const_cast<> wrapper

Definition at line 312 of file _handle.h.

References handle< T >::get().

template<class T>
template<class U >
static handle<T> handle< T >::cast_reinterpret ( const handle< U > &  x)
inlinestatic

reinterpret_cast<> wrapper

Definition at line 314 of file _handle.h.

References handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_static ( const loose_handle< U > &  x)
static

Definition at line 791 of file _handle.h.

References loose_handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_dynamic ( const loose_handle< U > &  x)
static

Definition at line 792 of file _handle.h.

References loose_handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_const ( const loose_handle< U > &  x)
static

Definition at line 793 of file _handle.h.

References loose_handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_reinterpret ( const loose_handle< U > &  x)
static

Definition at line 794 of file _handle.h.

References loose_handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_static ( const rhandle< U > &  x)
static

Definition at line 797 of file _handle.h.

References handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_dynamic ( const rhandle< U > &  x)
static

Definition at line 798 of file _handle.h.

References handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_const ( const rhandle< U > &  x)
static

Definition at line 799 of file _handle.h.

References handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_reinterpret ( const rhandle< U > &  x)
static

Definition at line 800 of file _handle.h.

References handle< T >::get().

template<class T >
template<class U >
handle< T > handle< T >::cast_static ( U *  x)
static

Definition at line 803 of file _handle.h.

template<class T >
template<class U >
handle< T > handle< T >::cast_dynamic ( U *  x)
static

Definition at line 804 of file _handle.h.

template<class T >
template<class U >
handle< T > handle< T >::cast_const ( U *  x)
static

Definition at line 805 of file _handle.h.

template<class T >
template<class U >
handle< T > handle< T >::cast_reinterpret ( U *  x)
static

Definition at line 806 of file _handle.h.

template<class T>
pointer handle< T >::get ( ) const
inline
template<class T>
bool handle< T >::operator! ( ) const
inline

Definition at line 335 of file _handle.h.

References handle< T >::obj.

template<class T>
template<class U >
handle< T >::operator handle< U > ( ) const
inline

static_cast<> overload – Useful for implicit casts

Definition at line 340 of file _handle.h.

References handle< T >::obj.

Member Data Documentation

template<class T>
value_type* handle< T >::obj
protected

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