Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

_Body Class Reference

Handle/Body: Base for refcounted representation classes (Body). More...

#include <_Body.h>

List of all members.

Public Member Functions

 _Body ()
 _Body (const _Body &rhs)
_Bodyoperator= (const _Body &rhs)
virtual ~_Body ()
void ref () const
void unref () const
unsigned refCount () const
virtual std::ostream & dumpOn (std::ostream &str) const

Static Public Member Functions

static void ref (const _Body *obj_r)
static void unref (const _Body *obj_r)

Protected Member Functions

virtual void ref_to (unsigned) const
virtual void unref_to (unsigned) const

Private Attributes

unsigned _counter


Detailed Description

Handle/Body: Base for refcounted representation classes (Body).

_Body provides the reference counter for representation classes manipulated through _Handle. For details see class _Handle.

The initial reference count is zero. Calling ref(), the reference counter is increased. Calling unref(), the reference counter is decreased. If the reference count becomes zero, the object is deleted.

Any attempt to delete an object with a non zero reference count will throw an exeption.

Any attempt to unref() an object with a zero reference count will throw an exeption.

Stream output operator are provided for _Body and _Body*. Both use dumpOn(), which might be overloaded by derived classes.


Constructor & Destructor Documentation

_Body::_Body  )  [inline]
 

Constructor. Initial reference count is zero.

_Body::_Body const _Body rhs  )  [inline]
 

CopyConstructor. Initial reference count is zero.

virtual _Body::~_Body  )  [inline, virtual]
 

Destructor. Throws exception if reference count is not zero.


Member Function Documentation

virtual std::ostream& _Body::dumpOn std::ostream &  str  )  const [virtual]
 

Derived classes may overload this to realize std::ostream & operator<< for _Body classes.

_Body& _Body::operator= const _Body rhs  )  [inline]
 

Assignment. Reference count remains untouched.

static void _Body::ref const _Body obj_r  )  [inline, static]
 

Safe increment reference counter. Ignore NULL object pointer passed as argument.

void _Body::ref  )  const [inline]
 

Increment reference counter.

virtual void _Body::ref_to unsigned   )  const [inline, protected, virtual]
 

Trigger derived classes after refCount was increased.

unsigned _Body::refCount  )  const [inline]
 

Current reference counter value.

static void _Body::unref const _Body obj_r  )  [inline, static]
 

Safe decrement reference counter. Ignore NULL object pointer passed as argument..

void _Body::unref  )  const [inline]
 

Decrement reference counter and delete the object if reference count got zero. Throws exception if reference count already is zero.

virtual void _Body::unref_to unsigned   )  const [inline, protected, virtual]
 

Trigger derived classes after refCount was decreased. No trigger is sent, if refCount got zero (i.e. the object is deleted).


Member Data Documentation

unsigned _Body::_counter [mutable, private]
 

The reference counter.


The documentation for this class was generated from the following file:
Generated on Mon Mar 21 16:25:28 2005 for liby2util by  doxygen 1.4.1