rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWIdentitySet Class Reference
[RWCollectable-derived]

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

#include <rw/idenset.h>

Inheritance diagram for RWIdentitySet:
RWSet RWHashTable RWCollection RWCollectable

List of all members.

Public Member Functions

virtual RWCollectablenewSpecies () const
virtual RWClassID isA () const
 RWIdentitySet (size_t N=RWCollection::DEFAULT_CAPACITY)
 RWIdentitySet (const RWIdentitySet &s)
 RWIdentitySet (RWIdentitySet &&s)
RWIdentitySetoperator= (const RWIdentitySet &s)
RWIdentitySetoperator= (RWIdentitySet &&s)
virtual RWCollectablefind (const RWCollectable *) const
virtual RWCollectableinsert (RWCollectable *)
virtual RWCollectableremove (const RWCollectable *)
virtual bool isEqual (const RWCollectable *) const

Static Public Member Functions

static RWClassID classIsA ()

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
 RWIdentitySet a;

Persistence

Polymorphic


Constructor & Destructor Documentation

RWIdentitySet::RWIdentitySet ( size_t  N = RWCollection::DEFAULT_CAPACITY  ) 

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 only available on platforms with rvalue reference support.

Member Function Documentation

static RWClassID RWIdentitySet::classIsA (  )  [static]

Returns the RWClassID of this class.

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.

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]

Returns true if the collectable object "matches" the object at address t. The default definition is:

 return this == t;

i.e., both objects have the same address (a test for identity). The definition may be redefined in any consistent way.

Reimplemented from RWSet.

virtual RWCollectable* RWIdentitySet::newSpecies (  )  const [virtual]

Allocates a new object off the heap of the same type as self and returns a pointer to it. You are responsible for deleting the object when done with it.

Reimplemented from RWSet.

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

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

Condition:
This method is only available on platforms with rvalue reference support.
RWIdentitySet& RWIdentitySet::operator= ( const RWIdentitySet s  )  [inline]

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

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.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.