ucommon
Public Member Functions
ucommon::sarray< T > Class Template Reference

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

#include <object.h>

Inheritance diagram for ucommon::sarray< T >:
Inheritance graph
[legend]
Collaboration diagram for ucommon::sarray< T >:
Collaboration graph
[legend]

Public Member Functions

const T * at (unsigned offset)
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 ucommon::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 270 of file object.h.


Constructor & Destructor Documentation

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

Generate a sparse typed array of specified size.

Parameters:
sizeof array to create.

Definition at line 277 of file object.h.


Member Function Documentation

template<class T >
T* ucommon::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 ucommon::SparseObjects.

Definition at line 285 of file object.h.

template<class T >
T& ucommon::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 294 of file object.h.


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