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 129 of file _handle.h.


Member Typedef Documentation

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

Reimplemented in rhandle< T >.

Definition at line 133 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 134 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 135 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 136 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 137 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 138 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 139 of file _handle.h.


Constructor & Destructor Documentation

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

Default constructor - empty handle.

Definition at line 147 of file _handle.h.

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

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

Constructor that constructs from a pointer to new object.

Definition at line 150 of file _handle.h.

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

Default copy constructor.

Definition at line 157 of file _handle.h.

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

Handle is released on deletion.

Definition at line 164 of file _handle.h.


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 187 of file _handle.h.

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

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

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 201 of file _handle.h.

References handle< T >::get(), and 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 212 of file _handle.h.

References handle< T >::obj.

Referenced by rhandle< T >::detach(), handle< T >::empty(), and handle< T >::operator=().

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

Reimplemented in rhandle< T >.

Definition at line 227 of file _handle.h.

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

Definition at line 229 of file _handle.h.

References handle< T >::detach().

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 233 of file _handle.h.

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

Definition at line 235 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 238 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 242 of file _handle.h.

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

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

Definition at line 247 of file _handle.h.

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

Definition at line 251 of file _handle.h.

References handle< T >::obj.

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

Definition at line 255 of file _handle.h.

References handle< T >::obj.

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

More explicit bool cast.

Definition at line 259 of file _handle.h.

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

Definition at line 262 of file _handle.h.

References NULL, and 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 268 of file _handle.h.

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 273 of file _handle.h.

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 278 of file _handle.h.

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 283 of file _handle.h.

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

Definition at line 768 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 772 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 776 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 780 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 786 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 790 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 794 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 798 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 804 of file _handle.h.

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

Definition at line 808 of file _handle.h.

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

Definition at line 812 of file _handle.h.

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

Definition at line 816 of file _handle.h.

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

Returns pointer to the object that is being wrapped.

Definition at line 302 of file _handle.h.

References handle< T >::obj.

Referenced by handle< T >::cast_const(), handle< T >::cast_dynamic(), handle< T >::cast_reinterpret(), handle< T >::cast_static(), operator!=(), loose_handle< T >::operator=(), rhandle< T >::operator=(), handle< T >::operator=(), operator==(), rhandle< T >::replace(), and handle< T >::swap().

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

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


Member Data Documentation

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

Pointer to object.

Definition at line 142 of file _handle.h.

Referenced by rhandle< T >::add_to_rlist(), handle< T >::constant(), rhandle< T >::detach(), handle< T >::detach(), handle< T >::get(), handle< T >::operator *(), handle< T >::operator handle< const value_type >(), handle< T >::operator!(), handle< T >::operator->(), rhandle< T >::operator=(), handle< T >::operator=(), rhandle< T >::replace(), rhandle< T >::rhandle(), and handle< T >::swap().


The documentation for this class was generated from the following file:
Generated on Sat Oct 27 11:30:18 2007 for ETL by  doxygen 1.5.3-20071008