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)
 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
pointer get () const
 Returns pointer to the object that is being wrapped.
bool operator! () const
template<class U>
 operator handle () 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 130 of file _handle.h.


Member Typedef Documentation

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

Reimplemented in rhandle< T >.

Definition at line 134 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 135 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 136 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 137 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 138 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 139 of file _handle.h.

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

Reimplemented in rhandle< T >.

Definition at line 140 of file _handle.h.


Constructor & Destructor Documentation

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

Default constructor - empty handle.

Definition at line 148 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 151 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 158 of file _handle.h.

References handle< T >::obj.

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

Handle is released on deletion.

Definition at line 165 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]
 

Assignment operator.

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

Reimplemented in rhandle< T >.

Definition at line 188 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 202 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 213 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 229 of file _handle.h.

References handle< T >::detach().

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

Definition at line 231 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 235 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 237 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 240 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 244 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 249 of file _handle.h.

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

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

Definition at line 253 of file _handle.h.

References handle< T >::obj.

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

Definition at line 257 of file _handle.h.

References handle< T >::obj.

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

More explicit bool cast.

Definition at line 261 of file _handle.h.

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

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

Definition at line 264 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 270 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 275 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 280 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 285 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 770 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 774 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 778 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 782 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 788 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 792 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 796 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 806 of file _handle.h.

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

Definition at line 810 of file _handle.h.

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

Definition at line 814 of file _handle.h.

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

Definition at line 818 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 304 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 307 of file _handle.h.

References handle< T >::obj.

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

static_cast<> overload -- Useful for implicit casts

Definition at line 312 of file _handle.h.

References handle< T >::obj.


Member Data Documentation

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

Pointer to object.

Definition at line 143 of file _handle.h.

Referenced by rhandle< T >::add_to_rlist(), handle< T >::clone(), handle< T >::constant(), handle< T >::count(), rhandle< T >::del_from_rlist(), rhandle< T >::detach(), handle< T >::detach(), handle< T >::empty(), handle< T >::get(), handle< T >::handle(), handle< T >::operator *(), handle< T >::operator bool(), handle< T >::operator handle(), handle< T >::operator!(), handle< T >::operator->(), rhandle< T >::operator=(), handle< T >::operator=(), rhandle< T >::rcount(), rhandle< T >::replace(), rhandle< T >::rhandle(), rhandle< T >::runique(), handle< T >::swap(), and handle< T >::unique().


The documentation for this class was generated from the following file:
Generated on Wed Jun 21 16:26:00 2006 for ETL by  doxygen 1.4.6