handle< T > Class Template Reference

Object Handle. More...

#include <ETL/handle>

Inheritance diagram for handle< T >:

rhandle< T >

List of all members.

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< value_typeclone () const
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 149 of file _handle.h.


Member Typedef Documentation

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

Reimplemented in rhandle< T >.

Definition at line 153 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 154 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 155 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 156 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 157 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 158 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 159 of file _handle.h.


Constructor & Destructor Documentation

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

Default constructor - empty handle.

Definition at line 170 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 173 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 180 of file _handle.h.

References handle< T >::obj.

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

Handle is released on deletion.

Definition at line 187 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 210 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 224 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 235 of file _handle.h.

References handle< T >::obj.

Referenced by rhandle< T >::detach(), 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 251 of file _handle.h.

References handle< T >::detach().

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

Definition at line 253 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 257 of file _handle.h.

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

template<class T>
handle<value_type> handle< T >::clone (  )  const [inline]

Definition at line 259 of file _handle.h.

References handle< T >::obj.

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

Returns a constant handle to our object.

Definition at line 262 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 266 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 271 of file _handle.h.

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

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

Definition at line 275 of file _handle.h.

References handle< T >::obj.

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

Definition at line 279 of file _handle.h.

References handle< T >::obj.

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

More explicit bool cast.

Definition at line 283 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 286 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  )  [inline, static]

static_cast<> wrapper

Definition at line 290 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  )  [inline, static]

dynamic_cast<> wrapper

Definition at line 292 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  )  [inline, static]

const_cast<> wrapper

Definition at line 294 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  )  [inline, static]

reinterpret_cast<> wrapper

Definition at line 296 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  )  [inline, static]

Definition at line 775 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  )  [inline, static]

Definition at line 776 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  )  [inline, static]

Definition at line 777 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  )  [inline, static]

Definition at line 778 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  )  [inline, static]

Definition at line 781 of file _handle.h.

References handle< T >::get().

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

Definition at line 782 of file _handle.h.

References handle< T >::get().

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

Definition at line 783 of file _handle.h.

References handle< T >::get().

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

Definition at line 784 of file _handle.h.

References handle< T >::get().

template<class T>
template<class U>
handle< T > handle< T >::cast_static ( U *  x  )  [inline, static]

Definition at line 787 of file _handle.h.

template<class T>
template<class U>
handle< T > handle< T >::cast_dynamic ( U *  x  )  [inline, static]

Definition at line 788 of file _handle.h.

template<class T>
template<class U>
handle< T > handle< T >::cast_const ( U *  x  )  [inline, static]

Definition at line 789 of file _handle.h.

template<class T>
template<class U>
handle< T > handle< T >::cast_reinterpret ( U *  x  )  [inline, static]

Definition at line 790 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 317 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 322 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:

Generated on Fri Jul 31 00:00:42 2009 for ETL by  doxygen 1.5.6