AutoArray Class Template Reference

#include <AutoArray.h>

Inheritance diagram for AutoArray:

AutoPtr List of all members.

Public Member Functions

 AutoArray (T *t)
void registerReferer (void *pR)
int hasReferer () const
T * origObject ()

Static Public Member Functions

static bool destroy (AutoArray< T > *pA, void *pR)
static bool destroy (AutoPtr< T > *pA, void *pR)

Protected Member Functions

 ~AutoArray ()
void _unregister (void *pR)

Protected Attributes

T * _pObject
 original object
std::set< void * > _ref
 set of referencing objects

Static Protected Attributes

static std::set< AutoArray<
T > * > 
_repos
 global static set of AutoArray instances

Detailed Description

template<class T>
class esg::AutoArray< T >

This class encapsulates given array of objects and guarantees that array is not destroied until it has some reference to itself.

This class very similar to AutoPtr class but is designed for arrays instead of single objects.

Protocol: see AutoPtr

Definition at line 24 of file AutoArray.h.


Constructor & Destructor Documentation

~AutoArray  )  [inline, protected]
 

AutoArray T *  t  )  [inline]
 

Parameters:
t original array


Member Function Documentation

void _unregister void *  pR  )  [inline, protected, inherited]
 

Definition at line 49 of file AutoPtr.h.

Referenced by AutoPtr< Mesh >::destroy(), and AutoArray< Vertex3 >::destroy().

static bool destroy AutoPtr< T > *  pA,
void *  pR
[inline, static, inherited]
 

Destructor of original object. The object is realy destroied only if it has no reference to it.

Parameters:
pA autopointer with deleted object
pR referer to deleted object
Returns:
true if deleted object is really erased from memory, false otherwise

Definition at line 76 of file AutoPtr.h.

static bool destroy AutoArray< T > *  pA,
void *  pR
[inline, static]
 

Destructor of original array. The array is realy destroied only if it has no reference to it.

Parameters:
pA autopointer with deleted array
pR referer to deleted array
Returns:
true if deleted array is really erased from memory, false otherwise

Definition at line 57 of file AutoArray.h.

int hasReferer  )  const [inline, inherited]
 

Returns number of referers registered to this autopointer

Returns:
number of referers

Definition at line 100 of file AutoPtr.h.

Referenced by AutoPtr< Mesh >::destroy(), and AutoArray< Vertex3 >::destroy().

T* origObject  )  [inline, inherited]
 

Returns the original object stored in this autopointer

Returns:
original object or NULL

Definition at line 107 of file AutoPtr.h.

Referenced by Surface::_duplicate_attributes(), LightSource::LightSource(), SceneGraphObject::setSharedDiffuseBRDF(), SceneGraphObject::setSharedEmittance(), SceneGraphObject::setSharedGeometry(), SceneGraphObject::setSharedSpecularBRDF(), SceneGraphObject::setSharedTexture(), SceneGraphObject::setSharedTransformation(), and Surface::Surface().

void registerReferer void *  pR  )  [inline, inherited]
 

Registers new object that uses the object in this autopointer.

Parameters:
pR referer

Definition at line 93 of file AutoPtr.h.

Referenced by Surface::_duplicate_attributes(), SceneGraphObject::appendSharedAttribute(), SceneGraphObject::appendSharedMaterial(), RhinoParser::RhinoParser(), Shape::setEnergyState(), SceneGraphObject::setSharedDiffuseBRDF(), SceneGraphObject::setSharedEmittance(), SceneGraphObject::setSharedGeometry(), SceneGraphObject::setSharedSpecularBRDF(), SceneGraphObject::setSharedTexture(), SceneGraphObject::setSharedTransformation(), and Surface::Surface().


Member Data Documentation

T* _pObject [protected, inherited]
 

original object

Definition at line 44 of file AutoPtr.h.

std::set<void*> _ref [protected, inherited]
 

set of referencing objects

Definition at line 45 of file AutoPtr.h.

std::set<AutoArray<T>*> _repos [static, protected]
 

global static set of AutoArray instances

Reimplemented from AutoPtr.

Definition at line 26 of file AutoArray.h.


The documentation for this class was generated from the following file:
Generated on Wed Jun 28 12:24:33 2006 for esg by  doxygen 1.4.6