SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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 (const RWSlistCollectablesStack &stk)
 
 RWSlistCollectablesStack (RWCollectable *a)
 
 RWSlistCollectablesStack (RWSlistCollectablesStack &&stk)
 
virtual RWCollectablecopy () const
 
virtual RWCollectableinsert (RWCollectable *a)
 
virtual RWClassID isA () const
 
virtual bool isEqual (const RWCollectable *) const
 
virtual RWCollectablenewSpecies () const
 
RWSlistCollectablesStackoperator= (const RWSlistCollectablesStack &rhs)
 
RWSlistCollectablesStackoperator= (RWSlistCollectablesStack &&rhs)
 
RWCollectablepop ()
 
void push (RWCollectable *a)
 
virtual RWCollectableremove (const RWCollectable *)
 
virtual void restoreGuts (RWFile &)
 
virtual void restoreGuts (RWvistream &)
 
RWCollectabletop () const
 
- Public Member Functions inherited from RWSlistCollectables
 RWSlistCollectables ()
 
 RWSlistCollectables (const RWSlistCollectables &lst)
 
 RWSlistCollectables (RWCollectable *a)
 
 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= (const RWSlistCollectables &rhs)
 
RWSlistCollectablesoperator= (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 (RWFile &) const
 
virtual void saveGuts (RWvostream &) 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>
A restricted interface to class RWSlistCollectables to implement a last in first out (LIFO) stack.
Definition stackcol.h:59
Persistence
Polymorphic

Constructor & Destructor Documentation

◆ RWSlistCollectablesStack() [1/4]

RWSlistCollectablesStack::RWSlistCollectablesStack ( )

Constructs an empty stack.

◆ RWSlistCollectablesStack() [2/4]

RWSlistCollectablesStack::RWSlistCollectablesStack ( RWCollectable * a)
inline

Constructs a stack with one entry a.

◆ RWSlistCollectablesStack() [3/4]

RWSlistCollectablesStack::RWSlistCollectablesStack ( const RWSlistCollectablesStack & stk)
inline

Makes a shallow copy of stk.

◆ RWSlistCollectablesStack() [4/4]

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

◆ append()

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.

◆ copy()

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.

◆ insert()

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

Same as push().

Reimplemented from RWSlistCollectables.

◆ isA()

virtual RWClassID RWSlistCollectablesStack::isA ( ) const
virtual

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

Reimplemented from RWSlistCollectables.

◆ isEqual()

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.

◆ newSpecies()

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.

◆ operator=() [1/2]

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

Assignment operator. Makes a shallow copy of rhs.

◆ operator=() [2/2]

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.

◆ pop()

RWCollectable * RWSlistCollectablesStack::pop ( )
inline

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

◆ push()

void RWSlistCollectablesStack::push ( RWCollectable * a)
inline

Adds an item to the top of the stack.

◆ remove()

virtual RWCollectable * RWSlistCollectablesStack::remove ( const RWCollectable * )
inlinevirtual

Calls pop(). The argument is ignored.

Reimplemented from RWSlistCollectables.

◆ removeAndDestroy()

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.

◆ restoreGuts() [1/2]

virtual void RWSlistCollectablesStack::restoreGuts ( RWFile & )
virtual

Repeatedly calls the global operator:

RWFile& operator>>(RWFile&, RWCollectable*&);
Contains virtual functions for identifying, hashing, comparing, storing and retrieving collectable ob...
Definition collect.h:441
Represents an abstraction of a filesystem regular file.
Definition rwfile.h:68

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

Reimplemented from RWCollection.

◆ restoreGuts() [2/2]

virtual void RWSlistCollectablesStack::restoreGuts ( RWvistream & )
virtual

Repeatedly calls the global operator:

Abstract base class providing an interface for format-independent retrieval of fundamental types and ...
Definition vstream.h:244

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

Reimplemented from RWCollection.

◆ top()

RWCollectable * RWSlistCollectablesStack::top ( ) const
inline

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

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