Class: TIndexedSequenceOf

Declaration: IndexedSequenceOf.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TSequenceOf

Inherited By:

TArrayOf

Purpose:

TIndexedSequenceOf is an abstract base class you can use to create collections of ordered objects. The order of the collection is typically based on the order or manner in which the objects are added. Individual objects in the collection can be accessed randomly, using a numerical index. An object can also be inserted after a particular object identified by a numerical index. The collection automatically grows in size, as needed, when objects are added. Iterators on TIndexedSequenceOf return objects in order. Iterators can be provided that return objects in reverse order.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive any classes from TIndexedSequenceOf.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::LowBound

CollectionIndex LowBound () const

Interface Category:

API.

Purpose:

Returns the first valid index for the sequence.

Calling Context:

Call this function directly to obtain the lowest index of the sequence.

Parameters:

Return Value:

The lowest valid index that can be used with the sequence.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This operation is a pure virtual function. Classes derived from TIndexedSequenceOf should provide an implementation for this operation.

Member Function: TIndexedSequenceOf::HighBound

CollectionIndex HighBound () const

Interface Category:

API.

Purpose:

Returns the index of the highest addressable element.

Calling Context:

Call this function directly to obtain the highest valid index for the sequence.

Parameters:

Return Value:

The highest valid index for the sequence.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This operation is a pure virtual function. Classes derived from TIndexedSequenceOf should provide an implementation for this operation.

Member Function: TIndexedSequenceOf::At

AType * At (CollectionIndex where) const

Interface Category:

API.

Purpose:

Given an index, returns the object at that index.

Calling Context:

Call this function directly to obtain a reference to the object at the specified index.

Parameters:

Return Value:

A pointer to the object at the specified index. A NIL pointer is returned if there is no object at the specified index.

Exceptions:

Throws TCollectionException::kIndexOutOfBounds if the index supplied is out of bounds.

Concurrency:

Not multithread safe.

Other Considerations:

This operation is a pure virtual function. Classes derived from TIndexedSequenceOf should provide an implementation for this operation.

Member Function: TIndexedSequenceOf::AtInsert

AType * AtInsert (CollectionIndex where, const AType * obj)

Interface Category:

API.

Purpose:

Inserts an object into the collection at the specified index. The collection is grown in size and all objects with indexes greater than or equal to the specified index are shifted to accommodate the new object.

Calling Context:

Call this function directly to insert an object in the collection at a specific location.

Parameters:

Return Value:

A reference to the object inserted.

Exceptions:

Throws TCollectionException::kIndexOutOfBounds if the index supplied is out of range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::AtPut

AType * AtPut (CollectionIndex where, const AType * obj)

Interface Category:

API.

Purpose:

Removes the object with the specified index from the collection and replaces it with the object provided.

Calling Context:

Call this function directly to replace one object in the collection with another object.

Parameters:

Return Value:

A reference to the object replaced. A NIL reference is returned if there is no object at the specified location.

Exceptions:

Throws TCollectionException::kIndexOutOfBounds if the index supplied is out of bounds.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::~TIndexedSequenceOf

virtual ~ TIndexedSequenceOf ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Call this function directly to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::operator==

bool operator ==(const TIndexedSequenceOf < AType > & indexedSequenceOf) const

Interface Category:

API.

Purpose:

Tests whether the contents of this collection are equal to the contents of another collection.

Calling Context:

Call this function directly to test the equivalence of the two objects on either side of the ==symbol.

Parameters:

Return Value:

Returns true if the contents of the two collections are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::operator!=

bool operator != (const TIndexedSequenceOf < AType > & indexedSequenceOf) const

Interface Category:

API.

Purpose:

Tests whether the contents of this collection are equal to the contents of another collection.

Calling Context:

Call this function directly to test the equivalence of the two objects on either side of the != symbol.

Parameters:

Return Value:

Returns true if if the contents of the two collections are not equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::TIndexedSequenceOf

  1. TIndexedSequenceOf ()
  2. TIndexedSequenceOf (const TIndexedSequenceOf < AType > & that)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Call this function directly anywhere the creation of a TIndexedSequenceOf is desired.
  2. Call this function directly when an object is assigned to another compatible object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TIndexedSequenceOf::operator=

const TIndexedSequenceOf < AType > & operator =(const TIndexedSequenceOf < AType > & that)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function directly when an object is assigned to another compatible object.

Parameters:

Return Value:

A reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.