RWTValHashSet(3C++)

RWTValHashSet<T> - Rogue Wave library class

As shipped in IRIX 6.5. First release of IRIX 6.5.

Name
     RWTValHashSet<T> - Rogue Wave library class

Synopsis
              #include <rw/tvhset.h>



              unsigned hashFun(const T&);
          RWTValHashSet(hashFun) set;

Please Note!
     If you do not have the Standard C++ Library, use the interface described
     here.  Otherwise, use the interface to RWTValHashSet described in the
     Class Reference.


Description
     RWTValHashSet<T> is a derived class of RWTValHashTable<T> where the
     insert() function has been overridden to accept only one item of a given
     value.  Hence, each item in the collection will be unique.  As with class
     RWTValHashTable<T>, you must supply a hashing function to the
     constructor. The class T must have:
          well-defined copy semantics (T::T(const T&) or equivalent);

          well-defined assignment semantics (T::operator=(const T&) or
          equivalent);

          well-defined equality semantics (T::operator==(const T&)).


Persistence
     None

Example
     This examples exercises a set of RWCStrings.

              #include <rw/tvhset.h>
          #include <rw/cstring.h>
          #include <rw/rstream.h>
          main(){
            RWTValHashSet<RWCString> set(RWCString::hash);
            set.insert("one");
            set.insert("two");
            set.insert("three");
            set.insert("one");  // Rejected: already in collection
            cout << set.entries() << endl;  // Prints "3"
            return 0;
          }


     Program output:
              3




Public Member Functions
              RWTValHashSet<T>&
          Union(const RWTValHashSet<T>& h);


     Computes the union of self and h, modifying self and returning self.

              RWTValHashSet<T>&
          difference(const RWTValHashSet<T>& h);


     Computes the disjunction of self and h, modifying self and returning
     self.

              RWTValHashSet<T>&
          intersection(const RWTValHashSet<T>& h);


     Computes the intersection of self and h, modifying self and returning
     self.

              RWTValHashSet<T>&
          symmetricDifference(const RWTValHashSet<T>& h);


     Computes the symmetric difference between self and h, modifying self and
     returning self.

              RWBoolean
          isSubsetOf(const RWTValHashSet<T>& h) const;


     Returns TRUE if self is a subset of h.

              RWBoolean
          isProperSubsetOf(const RWTValHashSet<T>& h) const;


     Returns TRUE if self is a proper subset of h.

              RWBoolean
          isEquivalent(const RWTValHashSet<T>& h) const;


     Returns TRUE if self and h are identical.

              void
          apply(void (*applyFun)(T&, void*), void* d);


     Inherited from class RWTValHashTable<T>.

              void
          clear();


     Inherited from class RWTValHashTable<T>.

              RWBoolean
          contains(const T& val) const;


     Inherited from class RWTValHashTable<T>.

              size_t
          entries() const;


     Inherited from class RWTValHashTable<T>.

              RWBoolean
          find(const T& target, T& k) const;


     Inherited from class RWTValHashTable<T>.

              void
          insert(const T& val);


     Redefined from class RWTValHashTable<T> to allow an object of a given
     value to be inserted only once.

              RWBoolean
          isEmpty() const;


     Inherited from class RWTValHashTable<T>.

              size_t
          occurrencesOf(const T& val) const;


     Inherited from class RWTValHashTable<T>.

              RWBoolean
          remove(const T& val);

     Inherited from class RWTValHashTable<T>.

              size_t
          removeAll(const T& val);


     Inherited from class RWTValHashTable<T>.

              void
          resize(size_t N);


     Inherited from class RWTValHashTable<T>.