ETL  0.04.19
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
rhandle< T > Class Template Reference

Replaceable Object Handle. More...

#include <ETL/handle>

Inheritance diagram for rhandle< T >:
handle< 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 Types inherited from handle< T >
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

 rhandle ()
 Default constructor - empty handle.
 rhandle (pointer x)
 Constructor that constructs from a pointer to new object.
 rhandle (const handle< value_type > &x)
 rhandle (const rhandle< value_type > &x)
 Default copy constructor.
 ~rhandle ()
 Handle is released on deletion.
rhandle< value_type > & operator= (const rhandle< value_type > &x)
 Template Assignment operator.
rhandle< value_type > & operator= (const handle< value_type > &x)
 Template Assignment operator.
rhandle< value_type > & operator= (value_type *x)
void detach ()
 Handle release procedure.
void reset ()
void spawn ()
 Creates a new instance of a T object and puts it in the handle.
count_type rcount () const
 Returns number of reversible instances.
bool runique () const
 Returns true if there is only one instance of the object.
int replace (const handle< value_type > &x)
handle< value_type > & swap (handle< value_type > &x)
 Swaps the values of two handles without reference counts.
- Public Member Functions inherited from handle< T >
 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.
bool empty () 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

Private Member Functions

void add_to_rlist ()
void del_from_rlist ()

Private Attributes

rhandle< value_type > * prev_
rhandle< value_type > * next_

Friends

class rshared_object

Additional Inherited Members

- Static Public Member Functions inherited from handle< T >
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 inherited from handle< T >
value_typeobj
 Pointer to object.

Detailed Description

template<class T>
class rhandle< T >

Replaceable Object Handle.

See Also
rshared_object, handle, loose_handle
Todo:
This needs to be documented

Definition at line 383 of file _handle.h.

Member Typedef Documentation

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

Definition at line 388 of file _handle.h.

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

Definition at line 389 of file _handle.h.

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

Definition at line 390 of file _handle.h.

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

Definition at line 391 of file _handle.h.

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

Definition at line 392 of file _handle.h.

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

Definition at line 393 of file _handle.h.

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

Definition at line 394 of file _handle.h.

Constructor & Destructor Documentation

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

Default constructor - empty handle.

Definition at line 464 of file _handle.h.

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

Constructor that constructs from a pointer to new object.

Definition at line 467 of file _handle.h.

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

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

Definition at line 473 of file _handle.h.

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

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

Default copy constructor.

Definition at line 480 of file _handle.h.

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

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

Handle is released on deletion.

Definition at line 487 of file _handle.h.

References rhandle< T >::detach().

Member Function Documentation

template<class T>
void rhandle< T >::add_to_rlist ( )
inlineprivate
template<class T>
void rhandle< T >::del_from_rlist ( )
inlineprivate

Definition at line 436 of file _handle.h.

References rhandle< T >::next_, handle< T >::obj, and rhandle< T >::prev_.

Referenced by rhandle< T >::detach().

template<class T>
rhandle<value_type>& rhandle< T >::operator= ( const rhandle< 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

Definition at line 514 of file _handle.h.

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

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

template<class T>
rhandle<value_type>& rhandle< 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 from handle< T >.

Definition at line 532 of file _handle.h.

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

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

Definition at line 550 of file _handle.h.

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

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

Handle release procedure.

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

Reimplemented from handle< T >.

Definition at line 570 of file _handle.h.

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

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

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

Reimplemented from handle< T >.

Definition at line 581 of file _handle.h.

References rhandle< T >::detach().

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

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

Uses the default constructor

Reimplemented from handle< T >.

Definition at line 585 of file _handle.h.

References rhandle< T >::operator=().

template<class T>
count_type rhandle< T >::rcount ( ) const
inline

Returns number of reversible instances.

Definition at line 589 of file _handle.h.

References handle< T >::obj.

template<class T>
bool rhandle< T >::runique ( ) const
inline

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

Definition at line 597 of file _handle.h.

References handle< T >::obj.

template<class T>
int rhandle< T >::replace ( const handle< value_type > &  x)
inline
Todo:
This needs to be documented

Definition at line 604 of file _handle.h.

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

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

Swaps the values of two handles without reference counts.

Warning
not yet implemented.
Todo:
This needs to be documented

Reimplemented from handle< T >.

Friends And Related Function Documentation

template<class T>
friend class rshared_object
friend

Definition at line 385 of file _handle.h.

Member Data Documentation

template<class T>
rhandle<value_type>* rhandle< T >::prev_
private

Definition at line 412 of file _handle.h.

Referenced by rhandle< T >::add_to_rlist(), and rhandle< T >::del_from_rlist().

template<class T>
rhandle<value_type>* rhandle< T >::next_
private

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