SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Private Member Functions
RWSlistCollectablesStack Class Reference

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

Public Member Functions

 RWSlistCollectablesStack ()
 
 RWSlistCollectablesStack (RWCollectable *a)
 
 RWSlistCollectablesStack (const RWSlistCollectablesStack &stk)
 
 RWSlistCollectablesStack (RWSlistCollectablesStack &&stk)
 
virtual RWCollectablecopy () const
 
virtual RWCollectableinsert (RWCollectable *a)
 
virtual RWClassID isA () const
 
virtual bool isEqual (const RWCollectable *) const
 
virtual RWCollectablenewSpecies () const
 
RWSlistCollectablesStackoperator= (RWSlistCollectablesStack &&rhs)
 
RWSlistCollectablesStackoperator= (const RWSlistCollectablesStack &rhs)
 
RWCollectablepop ()
 
void push (RWCollectable *a)
 
virtual RWCollectableremove (const RWCollectable *)
 
virtual void restoreGuts (RWvistream &)
 
virtual void restoreGuts (RWFile &)
 
RWCollectabletop () const
 
- Public Member Functions inherited from RWSlistCollectables
 RWSlistCollectables ()
 
 RWSlistCollectables (RWCollectable *a)
 
 RWSlistCollectables (const RWSlistCollectables &lst)
 
 RWSlistCollectables (RWSlistCollectables &&lst)
 
virtual void apply (RWapplyCollectable ap, void *x)
 
virtual RWCollectable *& at (size_t i)
 
virtual const RWCollectableat (size_t i) const
 
virtual void clear ()
 
virtual bool contains (const RWCollectable *target) const
 
bool containsReference (const RWCollectable *e) const
 
virtual size_t entries () const
 
virtual RWCollectablefind (const RWCollectable *target) const
 
RWCollectablefindReference (const RWCollectable *e) const
 
virtual RWCollectablefirst () const
 
RWCollectableget ()
 
virtual size_t index (const RWCollectable *c) const
 
virtual RWCollectableinsertAt (size_t indx, RWCollectable *e)
 
virtual bool isEmpty () const
 
virtual RWCollectablelast () const
 
virtual RWConstIteratornewConstIterator () const
 
virtual RWIteratornewIterator ()
 
virtual size_t occurrencesOf (const RWCollectable *target) const
 
size_t occurrencesOfReference (const RWCollectable *e) const
 
RWSlistCollectablesoperator= (RWSlistCollectables &&rhs)
 
RWSlistCollectablesoperator= (const RWSlistCollectables &rhs)
 
bool operator== (const RWSlistCollectables &s) const
 
virtual RWCollectableprepend (RWCollectable *a)
 
RWCollectableremoveReference (const RWCollectable *e)
 
- Public Member Functions inherited from RWCollection
virtual ~RWCollection ()
 
RWBag asBag () const
 
RWBinaryTree asBinaryTree () const
 
RWOrdered asOrderedCollection () const
 
RWSet asSet () const
 
RWBinaryTree asSortedCollection () const
 
virtual RWspace binaryStoreSize () const
 
virtual void clearAndDestroy ()
 
void operator+= (const RWCollection &c)
 
void operator-= (const RWCollection &c)
 
virtual void saveGuts (RWvostream &) const
 
virtual void saveGuts (RWFile &) const
 
RWCollectionselect (RWtestCollectable tst, void *vp) const
 
- Public Member Functions inherited from RWCollectable
virtual ~RWCollectable ()
 
virtual int compareTo (const RWCollectable *) const
 
virtual unsigned hash () const
 
RWspace recursiveStoreSize () const
 
RWStringID stringID () const
 

Private Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from RWCollectable
static RWClassID classID (const RWStringID &name)
 
static RWClassID classIsA ()
 
static bool isAtom (RWClassID id)
 
static RWspace nilStoreSize ()
 
- Static Public Attributes inherited from RWCollection
static size_t DEFAULT_CAPACITY
 

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:
#include <rw/stackcol.h>
Persistence
Polymorphic

Constructor & Destructor Documentation

RWSlistCollectablesStack::RWSlistCollectablesStack ( )

Constructs an empty stack.

RWSlistCollectablesStack::RWSlistCollectablesStack ( RWCollectable a)
inline

Constructs a stack with one entry a.

RWSlistCollectablesStack::RWSlistCollectablesStack ( const RWSlistCollectablesStack stk)
inline

Makes a shallow copy of stk.

RWSlistCollectablesStack::RWSlistCollectablesStack ( RWSlistCollectablesStack &&  stk)
inline

Move constructor. The constructed RWSlistCollectablesStack takes ownership of the data owned by stk.

Condition:
This method is available only on platforms with rvalue reference support.

Member Function Documentation

virtual RWCollectable* RWSlistCollectablesStack::append ( RWCollectable a)
inlineprivatevirtual

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

Reimplemented from RWSlistCollectables.

virtual RWCollectable* RWSlistCollectablesStack::copy ( ) const
virtual

Returns a new, copy-constructed object of the same type as self. The caller is responsible for deleting the object.

Reimplemented from RWSlistCollectables.

virtual RWCollectable* RWSlistCollectablesStack::insert ( RWCollectable a)
inlinevirtual

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

Behaves as if compareTo(t) was invoked, returning true if the result equals 0, false otherwise.

Reimplemented from RWSlistCollectables.

virtual RWCollectable* RWSlistCollectablesStack::newSpecies ( ) const
virtual

Returns a new, default-constructed object of the same type as self. The caller is responsible for deleting the object.

Reimplemented from RWSlistCollectables.

RWSlistCollectablesStack& RWSlistCollectablesStack::operator= ( RWSlistCollectablesStack &&  rhs)
inline

Move assignment. Self takes ownership of the data owned by rhs.

Condition:
This method is available only on platforms with rvalue reference support.
RWSlistCollectablesStack& RWSlistCollectablesStack::operator= ( const RWSlistCollectablesStack rhs)
inline

Assignment operator. Makes a shallow copy of rhs.

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 )
inlinevirtual

Calls pop(). The argument is ignored.

Reimplemented from RWSlistCollectables.

virtual void RWSlistCollectablesStack::removeAndDestroy ( const RWCollectable target)
inlineprivatevirtual

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

Reimplemented from RWCollection.

virtual void RWSlistCollectablesStack::restoreGuts ( RWvistream )
virtual

Repeatedly calls the global operator:

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

Reimplemented from RWCollection.

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.

RWCollectable* RWSlistCollectablesStack::top ( ) const
inline

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

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.