# rhandle< T > Class Template Reference

Replaceable Object Handle. More...

`#include <ETL/handle>`

Inheritance diagram for 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

| 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.

## 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

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

## Member Typedef Documentation

template<class T>

typedef T rhandle< T >::value_type

Reimplemented from handle< T >.

Definition at line 370 of file _handle.h.

template<class T>

typedef T& rhandle< T >::reference

Reimplemented from handle< T >.

Definition at line 371 of file _handle.h.

template<class T>

typedef const T& rhandle< T >::const_reference

Reimplemented from handle< T >.

Definition at line 372 of file _handle.h.

template<class T>

typedef T* rhandle< T >::pointer

Reimplemented from handle< T >.

Definition at line 373 of file _handle.h.

template<class T>

typedef const T* rhandle< T >::const_pointer

Reimplemented from handle< T >.

Definition at line 374 of file _handle.h.

template<class T>

typedef int rhandle< T >::count_type

Reimplemented from handle< T >.

Definition at line 375 of file _handle.h.

template<class T>

typedef int rhandle< T >::size_type

Reimplemented from handle< T >.

Definition at line 376 of file _handle.h.

## Constructor & Destructor Documentation

template<class T>

rhandle< T >::rhandle | ( |  | ) | `[inline]`

Default constructor - empty handle.

Definition at line 446 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 449 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 455 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 462 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 469 of file _handle.h.

References rhandle< T >::detach().

## Member Function Documentation

template<class T>

void rhandle< T >::add_to_rlist | ( |  | ) | `[inline, private]`

Definition at line 397 of file _handle.h.

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

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

template<class T>

void rhandle< T >::del_from_rlist | ( |  | ) | `[inline, private]`

Definition at line 418 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 496 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 514 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 532 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 552 of file _handle.h.

References rhandle< T >::del_from_rlist(), handle< T >::detach(), 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 563 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 567 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 571 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 579 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 586 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 367 of file _handle.h.

## Member Data Documentation

template<class T>

rhandle<value_type>* rhandle< T >::prev_ `[private]`

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

Definition at line 395 of file _handle.h.

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

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

- _handle.h