SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Member Functions
RWDlistCollectables Class Reference

Represents a group of ordered items, not accessible by an external key. More...

#include <rw/dlistcol.h>

Inheritance diagram for RWDlistCollectables:
RWSequenceable RWCollection RWCollectable

Public Member Functions

 RWDlistCollectables ()
 
 RWDlistCollectables (RWCollectable *a)
 
 RWDlistCollectables (const RWDlistCollectables &lst)
 
 RWDlistCollectables (RWDlistCollectables &&lst)
 
virtual ~RWDlistCollectables ()
 
virtual RWCollectableappend (RWCollectable *a)
 
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 *a) const
 
bool containsReference (const RWCollectable *e) const
 
virtual RWCollectablecopy () 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 RWCollectableinsert (RWCollectable *c)
 
virtual RWCollectableinsertAt (size_t inx, RWCollectable *e)
 
virtual RWClassID isA () const
 
virtual bool isEmpty () const
 
virtual bool isEqual (const RWCollectable *) const
 
virtual RWCollectablelast () const
 
virtual RWConstIteratornewConstIterator () const
 
virtual RWIteratornewIterator ()
 
virtual RWCollectablenewSpecies () const
 
virtual size_t occurrencesOf (const RWCollectable *target) const
 
size_t occurrencesOfReference (const RWCollectable *e) const
 
RWDlistCollectablesoperator= (RWDlistCollectables &&rhs)
 
RWDlistCollectablesoperator= (const RWDlistCollectables &rhs)
 
bool operator== (const RWDlistCollectables &d) const
 
virtual RWCollectableprepend (RWCollectable *a)
 
virtual RWCollectableremove (const RWCollectable *target)
 
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 removeAndDestroy (const RWCollectable *target)
 
virtual void restoreGuts (RWvistream &)
 
virtual void restoreGuts (RWFile &)
 
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
 

Static Public Member Functions

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

Additional Inherited Members

- Static Public Attributes inherited from RWCollection
static size_t DEFAULT_CAPACITY
 

Detailed Description

Class RWDlistCollectables represents a group of ordered items, not accessible by an external key. Duplicates are allowed. The ordering of elements is determined externally, generally by the order of insertion and removal. An object stored by RWDlistCollectables must inherit the abstract base class RWCollectable.

Class RWDlistCollectables is implemented as a doubly-linked list, which allows for efficient insertion and removal, as well as for movement in either direction.

Synopsis
#include <rw/dlistcol.h>
Persistence
Polymorphic

Constructor & Destructor Documentation

RWDlistCollectables::RWDlistCollectables ( )
inline

Constructs an empty doubly-linked list.

RWDlistCollectables::RWDlistCollectables ( RWCollectable a)
inline

Constructs a linked list with a single item a.

RWDlistCollectables::RWDlistCollectables ( const RWDlistCollectables lst)
inline

Makes a shallow copy of lst.

virtual RWDlistCollectables::~RWDlistCollectables ( )
inlinevirtual

Empty Destructor.

RWDlistCollectables::RWDlistCollectables ( RWDlistCollectables &&  lst)
inline

Move constructor. The constructed RWDlistCollectables takes ownership of the data owned by lst.

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

Member Function Documentation

virtual RWCollectable* RWDlistCollectables::append ( RWCollectable a)
inlinevirtual

Inserts the item at the end of the collection and returns it. Returns rwnil if the insertion was unsuccessful.

Implements RWSequenceable.

virtual void RWDlistCollectables::apply ( RWapplyCollectable  ap,
void *  x 
)
inlinevirtual

Invokes the function pointer ap on each member in the collection, in order, from first to last.

Implements RWSequenceable.

virtual RWCollectable*& RWDlistCollectables::at ( size_t  i)
inlinevirtual

Allows access to the i th element of the collection. The value i must be between zero and the number of items in the collection less one, or the function throws an exception of type RWBoundsErr. Note that for a linked list, these functions must traverse all the links, making them particularly inefficient.

Implements RWSequenceable.

virtual const RWCollectable* RWDlistCollectables::at ( size_t  i) const
inlinevirtual

Allows access to the i th element of the collection. The value i must be between zero and the number of items in the collection less one, or the function throws an exception of type RWBoundsErr. Note that for a linked list, these functions must traverse all the links, making them particularly inefficient.

Implements RWSequenceable.

static RWClassID RWDlistCollectables::classIsA ( )
static

Returns the RWClassID of this class.

virtual void RWDlistCollectables::clear ( )
inlinevirtual

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

Implements RWSequenceable.

virtual bool RWDlistCollectables::contains ( const RWCollectable target) const
inlinevirtual

Returns true if the collection contains an item where the virtual function find() returns non-nil.

Reimplemented from RWCollection.

bool RWDlistCollectables::containsReference ( const RWCollectable e) const
inline

Returns true if the list contains an item that is identical to the item pointed to by e (that is, that has the address e).

virtual RWCollectable* RWDlistCollectables::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 RWCollectable.

virtual size_t RWDlistCollectables::entries ( ) const
inlinevirtual

Returns the total number of items in the collection.

Implements RWSequenceable.

virtual RWCollectable* RWDlistCollectables::find ( const RWCollectable target) const
inlinevirtual

Returns the first item that RWCollecatble::isEqual() to the item pointed to by target, or rwnil if no item is found.

Implements RWSequenceable.

RWCollectable* RWDlistCollectables::findReference ( const RWCollectable e) const
inline

Returns the first item that is identical to the item pointed to by e (that is, that has the address e), or rwnil if none is found.

virtual RWCollectable* RWDlistCollectables::first ( ) const
inlinevirtual

Returns the item at the beginning of the list.

Implements RWSequenceable.

RWCollectable* RWDlistCollectables::get ( )
inline

Returns and removes the item at the beginning of the list.

virtual size_t RWDlistCollectables::index ( const RWCollectable c) const
inlinevirtual

Returns the index of the first item that isEqual() to the item pointed to by c, or RW_NPOS if there is no such index.

Implements RWSequenceable.

virtual RWCollectable* RWDlistCollectables::insert ( RWCollectable c)
inlinevirtual

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

Implements RWSequenceable.

virtual RWCollectable* RWDlistCollectables::insertAt ( size_t  inx,
RWCollectable e 
)
inlinevirtual

Adds a new item to the collection at position inx. The item previously at position i is moved to i + 1, and so forth. The index inx must be between zero and the number of items in the collection, or the function throws an exception of type RWBoundsErr.

Implements RWSequenceable.

virtual RWClassID RWDlistCollectables::isA ( ) const
virtual

Returns the unique ID for RWDlistCollectables.

Reimplemented from RWCollection.

virtual bool RWDlistCollectables::isEmpty ( ) const
inlinevirtual

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

Implements RWSequenceable.

virtual bool RWDlistCollectables::isEqual ( const RWCollectable t) const
virtual

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

Reimplemented from RWCollectable.

virtual RWCollectable* RWDlistCollectables::last ( ) const
inlinevirtual

Returns the item at the end of the list.

Implements RWSequenceable.

virtual RWConstIterator* RWDlistCollectables::newConstIterator ( ) const
virtual

Returns a const pointer to a dynamically allocated iterator for the collection.

Implements RWCollection.

virtual RWIterator* RWDlistCollectables::newIterator ( )
virtual

Returns a dynamically allocated iterator for the collection.

Implements RWCollection.

virtual RWCollectable* RWDlistCollectables::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 RWCollectable.

virtual size_t RWDlistCollectables::occurrencesOf ( const RWCollectable target) const
inlinevirtual

Returns the number of items that isEqual() to the item pointed to by target.

Implements RWSequenceable.

size_t RWDlistCollectables::occurrencesOfReference ( const RWCollectable e) const
inline

Returns the number of items that are identical to the item pointed to by e (that is, that have the address e).

RWDlistCollectables& RWDlistCollectables::operator= ( RWDlistCollectables &&  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.
RWDlistCollectables& RWDlistCollectables::operator= ( const RWDlistCollectables rhs)
inline

Assignment operator. Makes a shallow copy of rhs.

bool RWDlistCollectables::operator== ( const RWDlistCollectables d) const

Returns true if self and d have the same number of items and if, for every item in self, the corresponding item in the same position in d isEqual() to the item in self.

virtual RWCollectable* RWDlistCollectables::prepend ( RWCollectable a)
inlinevirtual

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

Implements RWSequenceable.

virtual RWCollectable* RWDlistCollectables::remove ( const RWCollectable target)
inlinevirtual

Removes and returns the first item that isEqual() to the item pointed to by target. Returns rwnil if there is no such item.

Implements RWSequenceable.

RWCollectable* RWDlistCollectables::removeReference ( const RWCollectable e)
inline

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.

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