Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

more::gen::handle Class Template Reference

Utility class to deal with reference counting. More...

#include <more/gen/utility.h>

Inheritance diagram for more::gen::handle:

Inheritance graph
[legend]
Collaboration diagram for more::gen::handle:

Collaboration graph
[legend]
List of all members.

Public Methods


Detailed Description

template<typename T>
class more::gen::handle< T >

Utility class to deal with reference counting.

This class can be used as a base class for the user-visible class, whereas the data members are placed in a separate type, given as the template argument T. The handle can also be a data-member. In any case, the copy constructor, the assigment operator and the destructor shall be invoked when the superclass or containing class is copied, assigned to ar destructed, respectively.

A const handle is treated as a constant object referring to mutable data, since constness of the data is anyway violated when a non-constant handle to the same data also exists. But the member functions of the object derived from the handle should nevertheless reflect the constness of the data. The important consequence of this semanic, is that the copy-constructor can be declared `const&', and thus the classes will interact more normally with STL headers, and in particular the extensions in `more/lambda.h'.


Constructor & Destructor Documentation

template<typename T>
more::gen::handle< T >::handle   [inline]
 

template<typename T>
more::gen::handle< T >::handle T *    p [inline, explicit]
 

template<typename T>
more::gen::handle< T >::handle handle< T > const &    x [inline]
 

template<typename T>
more::gen::handle< T >::~handle   [inline]
 


Member Function Documentation

template<typename T>
void more::gen::handle< T >::check_data   const [inline]
 

template<typename T>
T* more::gen::handle< T >::data   const [inline]
 

template<typename T>
T* more::gen::handle< T >::data_ref   const [inline]
 

template<typename T>
T* more::gen::handle< T >::datachk   const [inline]
 

template<typename T>
bool more::gen::handle< T >::is_owner   const [inline]
 

template<typename T>
more::gen::handle< T >::operator bool   const [inline]
 

template<typename T>
handle& more::gen::handle< T >::operator= handle< T > const &    x [inline]
 

template<typename T>
void more::gen::handle< T >::set_data T *    ptr [inline]
 

Set the handle to point to ptr.

The caller looses ownership of ptr.


The documentation for this class was generated from the following file:
Generated on Sat Sep 7 19:12:07 2002 for more with Doxygen 1.2.13.1. Doxygen 1.2.13.1 is written and copyright 1997-2002 by Dimitri van Heesch.