#include <objects.h>
Inheritance diagram for TCollection::
Public Methods | |
TCollection (ccIndex aLimit, ccIndex aDelta) | |
Static Public Attributes | |
const char* const | name |
Protected Methods | |
TCollection (StreamableInit) | |
virtual void* | read (ipstream &is) |
virtual void | write (opstream &os) |
Its main purpose is to provide a base class for more useful streamable collection classes. TNSCollection (the nonstreamable collection class) is a virtual base class for TCollection, providing the functions for adding, accessing, and removing items from a collection. TStreamable provides TCollection with the ability to create and name streams.
Several friend functions and the overloaded operators, >> and <<, provide the ability to write and read collections to and from streams.
A collection is a more general concept than the traditional array, set, or list.
TCollection objects size themselves dynamically at run time and offer a base for more specialized derived classes such as TSortedCollection, TStringCollection, and TResourceCollection.
TCollection inherits from TNSCollection the member functions for adding and deleting items, as well as several iterator routines that call a function for each item in the collection.
Note: type ccIndex is defined in file `ttypes.h' as int.
Definition at line 349 of file objects.h.
|
Constructor. Creates a collection with limit set to `aLimit' and delta set to `aDelta'. The initial number of items will be limited to `aLimit', but the collection is allowed to grow in increments of `aDelta' until memory runs out or the number of items reaches maxCollectionSize, an integer constant defined in `tvconfig.h' as follows:
const int maxCollectionSize = INT_MAX / sizeof(void *); |
|
Constructor. Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized vtable pointers. This is achieved by calling this constructor with an argument of type StreamableInit. |
|
Reads a collection from the input stream `is' to the associated TCollection object. Reimplemented from TStreamable. Reimplemented in TSortedCollection. |
|
Writes the associated collection to the output stream `os'. Reimplemented from TStreamable. Reimplemented in TSortedCollection. |
|
The name of the collection class, "TCollection". Used internally by the stream manager. Reimplemented in TSortedCollection, TStringCollection, TResourceCollection, TFileCollection, and TDirCollection. |