ucc::sparse_array Class Reference

A sparse array of managed objects. More...

#include <object.h>

Inheritance diagram for ucc::sparse_array:

Inheritance graph
[legend]
Collaboration diagram for ucc::sparse_array:

Collaboration graph
[legend]

Public Member Functions

virtual ~sparse_array ()
 Destroy sparse array and delete all generated objects.
unsigned count (void)
 Get count of array elements.

Protected Member Functions

virtual Objectcreate (void)=0
 Object factory for creating members of the spare array when they are initially requested.
void purge (void)
 Purge the array by deleting all created objects.
Objectget (unsigned offset)
 Get (reference) an object at a specified offset in the array.
 sparse_array (unsigned size)
 Create a sparse array of known size.

Detailed Description

A sparse array of managed objects.

This might be used as a simple array class for reference counted objects. This class assumes that objects in the array exist when assigned, and that gaps in the array are positions that do not reference any object. Objects are automatically created (create on access/modify when an array position is referenced for the first time. This is an abstract class because it is a type factory for objects who's derived class form constructor is not known in advance and is a helper class for the sarray template.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 273 of file object.h.


Constructor & Destructor Documentation

ucc::sparse_array::sparse_array ( unsigned  size  )  [protected]

Create a sparse array of known size.

No member objects are created until they are referenced.

Parameters:
size of array.


Member Function Documentation

unsigned ucc::sparse_array::count ( void   ) 

Get count of array elements.

Returns:
array elements.

virtual Object* ucc::sparse_array::create ( void   )  [protected, pure virtual]

Object factory for creating members of the spare array when they are initially requested.

Returns:
new object.

Object* ucc::sparse_array::get ( unsigned  offset  )  [protected]

Get (reference) an object at a specified offset in the array.

Parameters:
offset in array.
Returns:
new or existing object.

Reimplemented in ucc::sarray< T >.


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

Generated on Tue Jul 28 21:46:07 2009 for UCommon by  doxygen 1.5.9