SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWIdentityDictionary Class Reference

A hash table for key-value pairs. Items are found by requiring them to be identical. More...

#include <rw/idendict.h>

Inheritance diagram for RWIdentityDictionary:
RWHashDictionary RWSet RWHashTable RWCollection RWCollectable

Public Member Functions

 RWIdentityDictionary ()
 
 RWIdentityDictionary (size_t n)
 
 RWIdentityDictionary (const RWIdentityDictionary &h)
 
 RWIdentityDictionary (RWIdentityDictionary &&h)
 
virtual RWCollectablecopy () const
 
virtual RWClassID isA () const
 
virtual bool isEqual (const RWCollectable *) const
 
virtual RWCollectablenewSpecies () const
 
bool operator<= (const RWIdentityDictionary &h) const
 
RWIdentityDictionaryoperator= (const RWIdentityDictionary &h)
 
RWIdentityDictionaryoperator= (RWIdentityDictionary &&h)
 
- Public Member Functions inherited from RWHashDictionary
 RWHashDictionary ()
 
 RWHashDictionary (size_t n)
 
 RWHashDictionary (const RWHashDictionary &hd)
 
 RWHashDictionary (RWHashDictionary &&hd)
 
virtual ~RWHashDictionary ()
 
void applyToKeyAndValue (RWapplyKeyAndValue ap, void *x)
 
virtual void clear ()
 
virtual void clearAndDestroy ()
 
virtual RWCollectablefind (const RWCollectable *target) const
 
RWCollectablefindKeyAndValue (const RWCollectable *target, RWCollectable *&v) const
 
RWCollectablefindValue (const RWCollectable *target) const
 
RWCollectablefindValue (const RWCollectable *target, RWCollectable *newValue) const
 
virtual RWCollectableinsert (RWCollectable *a)
 
RWCollectableinsertKeyAndValue (RWCollectable *key, RWCollectable *value)
 
virtual RWConstIteratornewConstIterator () const
 
virtual RWIteratornewIterator ()
 
bool operator<= (const RWHashDictionary &hd) const
 
RWHashDictionaryoperator= (const RWHashDictionary &hd)
 
RWHashDictionaryoperator= (RWHashDictionary &&hd)
 
bool operator== (const RWHashDictionary &hd) const
 
virtual RWCollectableremove (const RWCollectable *target)
 
virtual void removeAndDestroy (const RWCollectable *target)
 
RWCollectableremoveKeyAndValue (const RWCollectable *target, RWCollectable *&v)
 
virtual void restoreGuts (RWFile &)
 
virtual void restoreGuts (RWvistream &)
 
virtual RWCollectionselect (RWtestCollectable tst, void *x) const
 
virtual RWCollectionselect (RWtestCollectablePair testfunc, void *x) const
 
- Public Member Functions inherited from RWSet
 RWSet ()
 
 RWSet (size_t n)
 
 RWSet (const RWSet &h)
 
 RWSet (RWSet &&h)
 
virtual ~RWSet ()
 
void intersectWith (const RWSet &h, RWSet &ret) const
 
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 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 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
 

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

The class RWIdentityDictionary is implemented as a hash table, for the storage and retrieval of key-value pairs. Class RWIdentityDictionary is similar to class RWHashDictionary 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()).

Both keys and values must inherit from the abstract base class RWCollectable.

The iterator for this class is RWHashDictionaryIterator.

Synopsis
#include <rw/idendict.h>
// Smalltalk typedef:
typedef RWIdentityDictionary IdentityDictionary;
Persistence
None

Constructor & Destructor Documentation

RWIdentityDictionary::RWIdentityDictionary ( )

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

RWIdentityDictionary::RWIdentityDictionary ( size_t  n)

Constructs an empty identity dictionary with n hashing buckets.

RWIdentityDictionary::RWIdentityDictionary ( const RWIdentityDictionary h)

Copy constructor. Makes a shallow copy of h.

RWIdentityDictionary::RWIdentityDictionary ( RWIdentityDictionary &&  h)
inline

Move constructor. The constructed RWIdentityDictionary takes ownership of the data owned by h.

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

Member Function Documentation

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

virtual RWClassID RWIdentityDictionary::isA ( ) const
virtual

Returns __RWIDENTITYDICTIONARY.

Reimplemented from RWHashDictionary.

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

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

Reimplemented from RWHashDictionary.

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

bool RWIdentityDictionary::operator<= ( const RWIdentityDictionary h) const
inline

Returns true if self is a subset of h, that is, every element of self has a counterpart in h which isEqual().

RWIdentityDictionary& RWIdentityDictionary::operator= ( const RWIdentityDictionary h)

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

RWIdentityDictionary& RWIdentityDictionary::operator= ( RWIdentityDictionary &&  h)
inline

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

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

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