ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
A sparse array of managed objects. More...
#include <object.h>
Public Member Functions | |
unsigned | count (void) |
Get count of array elements. More... | |
Protected Member Functions | |
virtual ObjectProtocol * | create (void)=0 |
Object factory for creating members of the spare array when they are initially requested. More... | |
void | purge (void) |
Purge the array by deleting all created objects. More... | |
virtual ObjectProtocol * | invalid (void) const |
ObjectProtocol * | get (unsigned offset) |
Get (reference) an object at a specified offset in the array. More... | |
SparseObjects (unsigned size) | |
Create a sparse array of known size. More... | |
virtual | ~SparseObjects () |
Destroy sparse array and delete all generated objects. More... | |
Private Member Functions | |
__DELETE_DEFAULTS (SparseObjects) | |
Private Attributes | |
ObjectProtocol ** | vector |
unsigned | max |
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.
|
protected |
Create a sparse array of known size.
No member objects are created until they are referenced.
size | of array. |
Definition at line 111 of file object.cpp.
|
protectedvirtual |
Destroy sparse array and delete all generated objects.
Definition at line 119 of file object.cpp.
References purge().
|
private |
unsigned ucommon::SparseObjects::count | ( | void | ) |
|
protectedpure virtual |
Object factory for creating members of the spare array when they are initially requested.
Implemented in ucommon::sarray< T >.
Referenced by get().
|
protected |
Get (reference) an object at a specified offset in the array.
offset | in array. |
Definition at line 152 of file object.cpp.
References create(), invalid(), max, ucommon::ObjectProtocol::retain(), and vector.
Referenced by ucommon::sarray< T >::at(), and ucommon::sarray< T >::get().
|
protectedvirtual |
Definition at line 147 of file object.cpp.
Referenced by get().
|
protected |
Purge the array by deleting all created objects.
Definition at line 124 of file object.cpp.
References max, ucommon::ObjectProtocol::release(), and vector.
Referenced by ~SparseObjects().
|
private |
|
private |