Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TCollection Class Reference

Streamable collection of items. More...

#include <objects.h>

Inheritance diagram for TCollection::

TNSCollection TStreamable TObject TDirCollection TSortedCollection TFileCollection TStringCollection TResourceCollection List of all members.

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)

Detailed Description

TCollection implements a streamable collection of arbitrary items, including other objects.

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 & Destructor Documentation

TCollection::TCollection ( ccIndex aLimit,
ccIndex aDelta ) [inline]
 

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 *);
 

Definition at line 365 of file objects.h.

TCollection::TCollection ( StreamableInit ) [protected]
 

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.


Member Function Documentation

void * TCollection::read ( ipstream & is ) [protected, virtual]
 

Reads a collection from the input stream `is' to the associated TCollection object.

Reimplemented from TStreamable.

Reimplemented in TSortedCollection.

void TCollection::write ( opstream & os ) [protected, virtual]
 

Writes the associated collection to the output stream `os'.

Reimplemented from TStreamable.

Reimplemented in TSortedCollection.


Member Data Documentation

const char *const TCollection::name [static]
 

The name of the collection class, "TCollection". Used internally by the stream manager.

Reimplemented in TSortedCollection, TStringCollection, TResourceCollection, TFileCollection, and TDirCollection.

Definition at line 410 of file objects.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:22 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001