rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWSequenceable Class Reference
[RWCollectable-derived]

Abstract base class for collections that can be accessed by an index. More...

#include <rw/seqcltn.h>

Inheritance diagram for RWSequenceable:
RWCollection RWCollectable RWDlistCollectables RWOrdered RWSlistCollectables RWDBForeignKeyList RWSortedVector RWSlistCollectablesQueue RWSlistCollectablesStack

List of all members.

Public Member Functions

virtual void apply (RWapplyCollectable, void *)=0
virtual void clear ()=0
virtual size_t entries () const =0
virtual RWCollectablefind (const RWCollectable *) const =0
virtual RWCollectableinsert (RWCollectable *)=0
virtual bool isEmpty () const =0
virtual size_t occurrencesOf (const RWCollectable *) const =0
virtual RWCollectableremove (const RWCollectable *)=0
virtual RWCollectableappend (RWCollectable *a)=0
virtual RWCollectable *& at (size_t i)=0
virtual const RWCollectableat (size_t i) const =0
virtual RWCollectablefirst () const =0
virtual size_t index (const RWCollectable *c) const =0
virtual RWCollectableinsertAt (size_t indx, RWCollectable *e)=0
virtual RWCollectablelast () const =0
virtual RWCollectableprepend (RWCollectable *c)=0

Detailed Description

Class RWSequenceable is an abstract base class for collections that can be accessed by an index. It inherits class RWCollection as a public base class and adds a few extra virtual functions. This documentation only describes these extra functions.

Synopsis

 #include <rw/seqcltn.h>
 typedef RWSequenceable SequenceableCollection;
               // Smalltalk typedef

Persistence

Polymorphic


Member Function Documentation

virtual RWCollectable* RWSequenceable::append ( RWCollectable a  )  [pure virtual]

Adds a to the end of the collection and returns it. Returns rwnil if the insertion was unsuccessful.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, RWSortedVector, and RWSlistCollectablesStack.

virtual void RWSequenceable::apply ( RWapplyCollectable  ap,
void *  vp 
) [pure virtual]

This function applies the user-supplied function pointed to by ap to each member of the collection. This function should have the following prototype:

 void yourApplyFunction(RWCollectable* ctp, void* vp);

The function yourApplyFunction() can perform any operation on the item at address ctp that does not change the hash value or sorting order of the item. Client data may be passed to this function through the second argument vp.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual const RWCollectable* RWSequenceable::at ( size_t  i  )  const [pure virtual]

Allows access to the i th element of the collection. The return value cannot be used as an lvalue. The index i must be between zero and the number of items in the collection less one, or an exception of type RWBoundsErr will be thrown.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, and RWSortedVector.

virtual RWCollectable*& RWSequenceable::at ( size_t  i  )  [pure virtual]

Allows access to the i th element of the collection. The return value can be used as an lvalue. The index i must be between zero and the number of items in the collection less one, or the function throws an exception of type RWBoundsErr.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, and RWSortedVector.

virtual void RWSequenceable::clear (  )  [pure virtual]

Removes all objects from the collection. Does not delete the objects themselves.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual size_t RWSequenceable::entries (  )  const [pure virtual]

Returns the total number of items in the collection.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual RWCollectable* RWSequenceable::find ( const RWCollectable target  )  const [pure virtual]

Returns a pointer to the first item in the collection which "matches" the object pointed to by target or rwnil if no item was found. For most collections, an item "matches" the target if either isEqual() or compareTo() find equivalence, whichever is appropriate for the actual collection type. However, the "identity collections" (i.e., RWIdentitySet and RWIdentityDictionary) look for an item with the same address (i.e., "is identical to").

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual RWCollectable* RWSequenceable::first (  )  const [pure virtual]

Returns the first item in the collection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual size_t RWSequenceable::index ( const RWCollectable c  )  const [pure virtual]

Returns the index number of the first item that "matches" the item pointed to by c. If there is no such item, returns RW_NPOS. For most collections, an item "matches" the target if either isEqual() or compareTo() find equivalence, whichever is appropriate for the actual collection type.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, and RWSortedVector.

virtual RWCollectable* RWSequenceable::insert ( RWCollectable e  )  [pure virtual]

Adds an item to the collection and returns a pointer to it. If the item is already in the collection, some collections derived from RWCollection return the old instance, others return rwnil.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, RWSortedVector, and RWSlistCollectablesStack.

virtual RWCollectable* RWSequenceable::insertAt ( size_t  indx,
RWCollectable e 
) [pure virtual]

Adds a new item to the collection at position indx. The item previously at position i is moved to i+1, etc. The index indx must be between 0 and the number of items in the collection, or an exception of type RWBoundsErr will be thrown.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, and RWSortedVector.

virtual bool RWSequenceable::isEmpty (  )  const [pure virtual]

Returns true if the collection is empty, otherwise returns false.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual RWCollectable* RWSequenceable::last (  )  const [pure virtual]

Returns the last item in the collection.

Implemented in RWDlistCollectables, RWOrdered, and RWSlistCollectables.

virtual size_t RWSequenceable::occurrencesOf ( const RWCollectable t  )  const [pure virtual]

Returns the number of items in the collection which are "matches" for t. See function find() for a definition of matches.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectables, and RWSortedVector.

virtual RWCollectable* RWSequenceable::prepend ( RWCollectable c  )  [pure virtual]

Adds c to the beginning of the collection and returns it. Returns rwnil if the insertion was unsuccessful.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectablesQueue, RWSlistCollectables, and RWSortedVector.

virtual RWCollectable* RWSequenceable::remove ( const RWCollectable target  )  [pure virtual]

Removes and returns a pointer to the first item in the collection which "matches" the object pointed to by target. Returns nil if no object was found. Does not delete the object. See function find() for a definition of matches.

Implements RWCollection.

Implemented in RWDlistCollectables, RWOrdered, RWSlistCollectablesQueue, RWSlistCollectables, and RWSlistCollectablesStack.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.