UCommon

sarray< T > Class Template Reference

Generate a typed sparse managed object array. More...

#include <object.h>

Inheritance diagram for sarray< T >:
Collaboration diagram for sarray< T >:

Public Member Functions

T * get (unsigned offset)
 Get typed member of array.
T & operator[] (unsigned offset)
 Array operation to access member object.
 sarray (unsigned size)
 Generate a sparse typed array of specified size.

Detailed Description

template<class T>
class sarray< T >

Generate a typed sparse managed object array.

Members in the array are created when they are first referenced. The types for objects that are generated by sarray must have Object as a base class. Managed sparse arrays differ from standard arrays in that the member elements are not allocated from the heap when the array is created, but rather as they are needed.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 329 of file object.h.


Constructor & Destructor Documentation

template<class T >
sarray< T >::sarray ( unsigned  size) [inline]

Generate a sparse typed array of specified size.

Parameters:
sizeof array to create.

Definition at line 336 of file object.h.


Member Function Documentation

template<class T >
T* sarray< T >::get ( unsigned  offset) [inline]

Get typed member of array.

If the object does not exist, it is created.

Parameters:
offsetin array for object.
Returns:
pointer to typed object.

Reimplemented from sparse_array.

Definition at line 344 of file object.h.

template<class T >
T& sarray< T >::operator[] ( unsigned  offset) [inline]

Array operation to access member object.

If the object does not exist, it is created.

Parameters:
offsetin array for object.
Returns:
pointer to typed object.

Definition at line 353 of file object.h.


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