RWSlistCollectablesStack(3C++) RWSlistCollectablesStack(3C++)
NameRWSlistCollectablesStack - Rogue Wave library class
Synopsis
// Smalltalk typedef:
typedef RWSlistCollectablesStack Stack;
#include <rw/stackcol.h>
RWSlistCollectablesStack a;
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
abstract base class RWCollectable. The virtual function isEqual() (see
class RWCollectable) is required, to find a match between a target and an
item in the stack. This class corresponds to the Smalltalk class Stack.
Persistence
Polymorphic
Public ConstructorsRWSlistCollectablesStack();
Construct an empty stack.
RWSlistCollectablesStack(RWCollectable* a);
Construct a stack with one entry a.
RWSlistCollectablesStack(const RWSlistCollectablesStack& s);
Copy constructor. A shallow copy of the stack s is made.
Assignment Operator
void
operator=(const RWSlistCollectablesStack& s);
Page 1
RWSlistCollectablesStack(3C++) RWSlistCollectablesStack(3C++)
Assignment operator. A shallow copy of the stack s is made.
Public Member Functions
virtual void
apply(RWapplyCollectable ap, void*);
virtual RWspace
binaryStoreSize() const;
virtual void
clear();
Inherited from class RWSlistCollectables.
virtual void
clearAndDestroy();
virtual RWBoolean
contains(const RWCollectable* target) const;
Inherited from class RWCollection.
RWBoolean
containsReference(const RWCollectable* e) const;
virtual size_t
entries() const;
Inherited from class RWSlistCollectables.
virtual RWCollectable*
first() const;
Inherited from class RWSlistCollectables. Same as top().
virtual RWCollectable*
insert(RWCollectable* c);
Inherited from class RWSlistCollectables. Same as push().
virtual RWClassID
isA() const;
Redefined from class RWCollectable to return __RWSLISTCOLLECTABLESSTACK.
virtual RWBoolean
isEmpty()const;
Inherited from class RWSlistCollectables.
Page 2
RWSlistCollectablesStack(3C++) RWSlistCollectablesStack(3C++)
virtual RWCollectable*
last() const;
Inherited from class RWSlistCollectables. Returns the item at the bottom
of the stack.
virtual size_t
occurrencesOf(const RWCollectable* target) const;
size_t
occurrencesOfReference(const RWCollectable* e) const;
Inherited from class RWSlistCollectables.
virtual RWCollectable*
remove(const RWCollectable*);
Redefined from class RWSlistCollectables. Calls pop(). The argument is
ignored.
RWCollectable*
pop();
Removes and returns the item at the top of the stack, or returns nil if
the stack is empty.
void
push(RWCollectable*);
Adds an item to the top of the stack.
RWCollectable*
top() const;
Returns the item at the top of the stack or nil if the stack is empty.
Page 3