rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWSlistCollectablesStack Class Reference
[RWCollectable-derived]

A restricted interface to class RWSlistCollectables to implement a last in first out (LIFO) stack. More...

#include <rw/stackcol.h>

Inheritance diagram for RWSlistCollectablesStack:
RWSlistCollectables RWSequenceable RWCollection RWCollectable

List of all members.

Public Member Functions

virtual RWCollectablenewSpecies () const
virtual RWClassID isA () const
 RWSlistCollectablesStack ()
 RWSlistCollectablesStack (RWCollectable *a)
virtual RWCollectableinsert (RWCollectable *a)
virtual bool isEqual (const RWCollectable *) const
virtual void restoreGuts (RWvistream &)
virtual void restoreGuts (RWFile &)
virtual RWCollectableremove (const RWCollectable *)
void push (RWCollectable *a)
RWCollectablepop ()
RWCollectabletop () const

Static Public Member Functions

static RWClassID classIsA ()

Private Member Functions

virtual RWCollectableappend (RWCollectable *)
RWCollectableremoveReference (const RWCollectable *)
virtual void removeAndDestroy (const RWCollectable *)

Detailed Description

Class RWSlistCollectablesStack represents a restricted interface to class RWSlistCollectables to implement a last in first out (LIFO) stack. A stack is a sequential list for which all insertions and deletions are made at one end (the beginning of the list). Hence, the ordering is determined externally by the ordering of the insertions. Duplicates are allowed.

An object stored by RWSlistCollectablesStack must inherit from abstract base class RWCollectable. You must use the virtual function isEqual() (see class RWCollectable) to find a match between a target and an item in the stack.

This class corresponds to the Smalltalk class Stack.

Synopsis

 // Smalltalk typedef:
 typedef RWSlistCollectablesStack Stack;
 #include <rw/stackcol.h>
 RWSlistCollectablesStack a;

Persistence

Polymorphic


Constructor & Destructor Documentation

RWSlistCollectablesStack::RWSlistCollectablesStack (  ) 

Constructs an empty stack.

RWSlistCollectablesStack::RWSlistCollectablesStack ( RWCollectable a  )  [inline]

Constructs a stack with one entry a.


Member Function Documentation

virtual RWCollectable* RWSlistCollectablesStack::append ( RWCollectable a  )  [inline, private, virtual]

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

Reimplemented from RWSlistCollectables.

static RWClassID RWSlistCollectablesStack::classIsA (  )  [static]

Returns the RWClassID of this class.

Reimplemented from RWSlistCollectables.

virtual RWCollectable* RWSlistCollectablesStack::insert ( RWCollectable a  )  [inline, virtual]

Same as push().

Reimplemented from RWSlistCollectables.

virtual RWClassID RWSlistCollectablesStack::isA (  )  const [virtual]

Returns __RWSLISTCOLLECTABLESSTACK, i.e. a class identifier, that identifies this object's class.

Reimplemented from RWSlistCollectables.

virtual bool RWSlistCollectablesStack::isEqual ( const RWCollectable t  )  const [virtual]

Returns true if the collectable object "matches" the object at address t. The default definition is:

 return this == t;

i.e., both objects have the same address (a test for identity). The definition may be redefined in any consistent way.

Reimplemented from RWSlistCollectables.

virtual RWCollectable* RWSlistCollectablesStack::newSpecies (  )  const [virtual]

Allocates a new object off the heap of the same type as self and returns a pointer to it. You are responsible for deleting the object when done with it.

Reimplemented from RWSlistCollectables.

RWCollectable* RWSlistCollectablesStack::pop (  )  [inline]

Removes and returns the item at the top of the stack, or returns rwnil if the stack is empty.

void RWSlistCollectablesStack::push ( RWCollectable a  )  [inline]

Adds an item to the top of the stack.

virtual RWCollectable* RWSlistCollectablesStack::remove ( const RWCollectable  )  [inline, virtual]

Calls pop(). The argument is ignored.

Reimplemented from RWSlistCollectables.

virtual void RWSlistCollectablesStack::removeAndDestroy ( const RWCollectable target  )  [inline, private, virtual]

Removes and deletes the first item in the collection which "matches" the object pointed to by target.

Reimplemented from RWCollection.

RWCollectable* RWSlistCollectablesStack::removeReference ( const RWCollectable e  )  [inline, private]

Removes and returns the first item that is identical to the item pointed to by e (that is, that has the address e). Returns rwnil if there is no such item.

Reimplemented from RWSlistCollectables.

virtual void RWSlistCollectablesStack::restoreGuts ( RWFile  )  [virtual]

Repeatedly calls the global operator:

 RWFile&  operator>>(RWFile&, RWCollectable*&);

followed by insert(RWCollectable*) for each item in the collection.

Reimplemented from RWCollection.

virtual void RWSlistCollectablesStack::restoreGuts ( RWvistream  )  [virtual]

Repeatedly calls the global operator:

 RWvistream& operator>>(RWvistream&, RWCollectable*&);

followed by insert(RWCollectable*) for each item in the collection.

Reimplemented from RWCollection.

RWCollectable* RWSlistCollectablesStack::top (  )  const [inline]

Returns the item at the top of the stack or returns nil if the stack is empty.

 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.