SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Public Member Functions

Finds items that have the same address as the key. More...

#include <rw/idenset.h>

Inheritance diagram for RWIdentitySet:
RWSet RWHashTable RWCollection RWCollectable

Public Member Functions

 RWIdentitySet ()
 
 RWIdentitySet (size_t N)
 
 RWIdentitySet (const RWIdentitySet &s)
 
 RWIdentitySet (RWIdentitySet &&s)
 
virtual RWCollectablecopy () const
 
virtual RWCollectablefind (const RWCollectable *) const
 
virtual RWCollectableinsert (RWCollectable *)
 
virtual RWClassID isA () const
 
virtual bool isEqual (const RWCollectable *) const
 
virtual RWCollectablenewSpecies () const
 
RWIdentitySetoperator= (const RWIdentitySet &s)
 
RWIdentitySetoperator= (RWIdentitySet &&s)
 
virtual RWCollectableremove (const RWCollectable *)
 
- Public Member Functions inherited from RWSet
 RWSet ()
 
 RWSet (size_t n)
 
 RWSet (const RWSet &h)
 
 RWSet (RWSet &&h)
 
virtual ~RWSet ()
 
virtual void clearAndDestroy ()
 
void intersectWith (const RWSet &h, RWSet &ret) const
 
virtual RWConstIteratornewConstIterator () const
 
virtual RWIteratornewIterator ()
 
virtual size_t occurrencesOf (const RWCollectable *target) const
 
RWSetoperator*= (const RWSet &h)
 
bool operator< (const RWSet &h) const
 
bool operator<= (const RWSet &h) const
 
RWSetoperator= (const RWSet &h)
 
RWSetoperator= (RWSet &&h)
 
- Public Member Functions inherited from RWHashTable
 RWHashTable ()
 
 RWHashTable (size_t N)
 
 RWHashTable (const RWHashTable &t)
 
 RWHashTable (RWHashTable &&t)
 
virtual void apply (RWapplyCollectable ap, void *)
 
virtual void clear ()
 
virtual size_t entries () const
 
virtual bool isEmpty () const
 
bool operator!= (const RWHashTable &) const
 
bool operator<= (const RWHashTable &t) const
 
RWHashTableoperator= (const RWHashTable &t)
 
RWHashTableoperator= (RWHashTable &&t)
 
bool operator== (const RWHashTable &t) const
 
virtual void resize (size_t n=0)
 
void swap (RWHashTable &t)
 
- 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 bool contains (const RWCollectable *target) const
 
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

The class RWIdentitySet is similar to class RWSet except that items are found by requiring that they be identical (i.e., have the same address) as the key, rather than being equal (i.e., test true for isEqual()).

The iterator for this class is RWSetIterator.

Synopsis
#include <rw/idenset.h>
typedef RWIdentitySet IdentitySet; // Smalltalk typedef
Persistence
Polymorphic

Constructor & Destructor Documentation

RWIdentitySet::RWIdentitySet ( )

Constructs an empty identity set with RWCollection::DEFAULT_CAPACITY hashing buckets.

RWIdentitySet::RWIdentitySet ( size_t  N)

Constructs an empty identity set with N hashing buckets.

RWIdentitySet::RWIdentitySet ( const RWIdentitySet s)
inline

Copy constructor. Makes a shallow copy of the collection s.

RWIdentitySet::RWIdentitySet ( RWIdentitySet &&  s)
inline

Move constructor. The constructed RWIdentitySet takes ownership of the data owned by s.

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

Member Function Documentation

static RWClassID RWIdentitySet::classIsA ( )
static

Returns the RWClassID of this class.

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

virtual RWCollectable* RWIdentitySet::find ( const RWCollectable target) const
virtual

Returns a pointer to the first item in the collection which "matches" the object pointed to by target or rwnil if no item was found. For most collections, an item "matches" the target if either isEqual() or compareTo() find equivalence, whichever is appropriate for the actual collection type. However, the "identity collections" (i.e., RWIdentitySet and RWIdentityDictionary) look for an item with the same address (i.e., "is identical to").

Reimplemented from RWHashTable.

virtual RWCollectable* RWIdentitySet::insert ( RWCollectable c)
virtual

Adds c to the collection and returns it. If an item is already in the collection which isEqual() to c, then the existing item is returned and the new item is not inserted.

Note
If self is a collection of key-value pairs (e.g. RWHashDictionary), this function throws std::bad_cast if c does not inherit from RWCollectableAssociation. If the collection does not contain an association with a key that "matches" the key of c, then a copy of the association is inserted and that association's key is returned. Otherwise, the insert fails by returning either rwnil or a pointer to the existing association's key.

Reimplemented from RWSet.

virtual RWClassID RWIdentitySet::isA ( ) const
virtual

Returns the unique ID for RWIdentitySet.

Reimplemented from RWSet.

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

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

Reimplemented from RWSet.

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

RWIdentitySet& RWIdentitySet::operator= ( const RWIdentitySet s)
inline

Assignment operator. Makes a shallow copy of the collection s.

RWIdentitySet& RWIdentitySet::operator= ( RWIdentitySet &&  s)
inline

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

Condition:
This method is available only on platforms with rvalue reference support.
virtual RWCollectable* RWIdentitySet::remove ( const RWCollectable target)
virtual

Removes and returns a pointer to the first item in the collection which "matches" the object pointed to by target. Returns nil if no object was found. Does not delete the object. See function find() for a definition of matches.

Reimplemented from RWHashTable.

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