RWTValMultiMap man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

Name
     RWTValMultiMap<K,T,C> - Rogue Wave library class

Synopsis
	      #include <rw/tvmmap.h>
	  RWTValMultiMap<K,T,C> m;

Standard C++ Library Dependent!

     RWTValMultiMap requires the Standard C++ Library.

Description
     This class maintains a collection of keys, each with an associated item
     of type T.	 Order is determined by the key according to a comparison
     object of type C.	C must induce a total ordering on elements of type K
     via a public member
	  bool operator()(const K& x, const K& y) const which returns true if
     x and its partner should precede y and its partner within the collection.
     The structure less<T> from the C++-standard header file <functional> is
     an example.  RWTValMultiMap<K,T,C> may contain multiple keys that compare
     equal to each other.  (RWTValMap<K,T,C> will not accept a key that
     compares equal to any key already in the collection.)  Equality is based
     on the comparison object and not on the == operator.  Given a comparison
     object comp, keys a and b are equal if
	  !comp(a,b) && !comp(b,a).

Persistence
     Isomorphic.

Examples
     In this example, a map of RWCStrings and RWDates is exercised.

	      //

	      // tvmmbday.cpp
	  //
	  #include <rw/tvmmap.h>
	  #include <rw/cstring.h>
	  #include <rw/rwdate.h>
	  #include <iostream.h>
	  #include <function.h>
	  main(){
	    typedef RWTValMultiMap<RWCString, RWDate, less<RWCString> >
	       RWMMap;
	    RWMMap birthdays;

									Page 1

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

	    birthdays.insert("John", RWDate(12, "April",1975));
	    birthdays.insert("Ivan", RWDate(2, "Nov", 1980));
	    birthdays.insert("Mary", RWDate(22, "Oct", 1987));
	    birthdays.insert("Ivan", RWDate(19, "June", 1971));
	    birthdays.insert("Sally",RWDate(15, "March",1976));
	    birthdays.insert("Ivan",  RWDate(6, "July", 1950));
	    // How many "Ivan"s?
	    RWMMap::size_type n = birthdays.occurrencesOf("Ivan");
	    RWMMap::size_type idx = 0;
	    cout << "There are " << n << " Ivans:" << endl;
	    RWMMap::iterator iter = birthdays.std().lower_bound("Ivan");
	    while (++idx <= n)
	      cout << idx << ".	 " << (*iter++).second << endl;
	    return 0;
	  }
	  Program Output:
	  There are 3 Ivans:
	  1.  11/02/80
	  2.  06/19/71

Related Classes
     3.	 07/06/50

     Class RWTValMap<K,T,C> offers the same interface to a collection that
     will not accept multiple keys that compare equal to each other.
     RWTValMultiSet<T,C> maintains a collection of keys without the associated
     values.  Class multimap<K,T,C,allocator> is the C++-standard collection
     that serves as the underlying implementation for this collection.

Public Typedefs
	      typedef multimap<K,T,C,allocator>		    container_type;
	  typedef container_type::iterator		iterator;
	  typedef container_type::const_iterator	const_iterator;
	  typedef container_type::size_type		size_type;
	  typedef pair <const K,T>			 value_type;
	  typedef pair <const K,T>&			 reference;
	  typedef const pair <const K,T>&		 const_reference;

Public Constructors
	      RWTValMultiMap<K,T,C>(const C& comp = C());

     Constructs an empty map with comparator comp.

	      RWTValMultiMap<K,T,C>(const container_type& m);

     Constructs a map by copying all elements of m.

									Page 2

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

	      RWTValMultiMap<K,T,C>(const RWTValMultiMap<K,T,C>& rwm);

     Copy constructor.

	      RWTValMultiMap<K,T,C>
	  (const value_type* first, const value_type* last,
	   const C& comp = C());

     Constructs a map by copying elements from the array of Ts pointed to by
     first, up to, but not including, the element pointed to by last.

Public Member Operators
	      RWTValMultiMap<K,T,C>&
	  operator=(const RWTValMultiMap<K,T,C>& m);
	  RWTValMultiMap<K,T,C>&
	  operator=(const container_type& m) const;

     Destroys all elements of self and replaces them by copying all
     associations from m.

	      bool
	  operator<(const RWTValMultiMap<K,T,C>& m);
	  bool
	  operator<(const container_type& m) const;

     Returns true if self compares lexicographically less than m, otherwise
     returns false.  Assumes that type K has well-defined less-than semantics
     (T::operator<(const K&) or equivalent).

	      bool
	  operator==(const RWTValMultiMap<K,T,C>& m) const;
	  bool
	  operator==(const container_type& m) const;

     Returns true if self compares equal to m, otherwise returns false.	 Two
     collections are equal if both have the same number of entries, and
     iterating through both collections produces, in turn, individual pairs
     that compare equal to each other.

Public Member Functions
	      void
	  apply(void (*fn)(const K&, T&, void*),void* d);
	  void

									Page 3

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

	  apply(void (*fn)(const K&, const T&, void*),void* d) const;

     Applies the user-defined function pointed to by fn to every association
     in the collection.	 This function must have one of the prototypes:

		 void yourfun(const K& key, T& a, void* d);
	     void yourfun(const K& key, const T& a,void* d);

     Client data may be passed through parameter d.

	      void
	  applyToKeyAndValue(void (*fn)(const K&, T&, void*),void* d);
	  void
	  applyToKeyAndValue
	  (void (*fn)(const K&, const T&, void*),void* d) const;

     This is a deprecated version of the apply member above.  It behaves
     exactly the same as apply.

	      iterator
	  begin();
	  const_iterator
	  begin() const;

     Returns an iterator positioned at the first pair in self.

	      void
	  clear();

     Clears the collection by removing all items from self.  Each key and its
     associated item will have its destructor called.

	      bool
	  contains(const K& key) const;

     Returns true if there exists a key j in self that compares equal to key,
     otherwise returns false.

	      bool
	  contains
	  (bool (*fn)(const_reference,void*),void* d) const;

									Page 4

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

     Returns true if there exists an association a in self such that the
     expression ((*fn)(a,d)) is true, otherwise returns false.	fn points to a
     user-defined tester function which must have prototype:

		 bool yourTester(const_reference a, void* d);

     Client data may be passed through parameter d.

	      iterator
	  end();
	  const_iterator
	  end() const;

     Returns an iterator positioned "just past" the last association in self.

	      size_type
	  entries() const;

     Returns the number of associations in self.

	      bool
	  find(const K& key, Key& r) const;

     If there exists a key j in self that compares equal to key, assigns j to
     r and returns true.  Otherwise, returns false and leaves the value of r
     unchanged.

	      bool
	  find(bool (*fn)(const_reference,void*),void* d,
	       pair<K,T>& r) const;

     If there exists an association a in self such that the expression
     ((*fn)(a,d)) is true, assigns a to r and returns true.  Otherwise,
     returns false and leaves the value of k unchanged.	 fn points to a user-
     defined tester function which must have prototype:

		 bool yourTester(const_reference a, void* d);

									Page 5

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

     Client data may be passed through parameter d.

	      bool
	  findValue(const K& key, T& r) const;

     If there exists a key j in self that compares equal to key, assigns the
     item associated with j to r and returns true.  Otherwise, returns false
     and leaves the value of r unchanged.

	      bool
	  findKeyValue(const K& key, K& kr, T& tr) const;

     If there exists a key j in self that compares equal to key, assigns j to
     kr, assigns the item associated with j to tr, and returns true.
     Otherwise, returns false and leaves the values of kr and tr unchanged.

	      bool
	  insert(const K& key, const T& a);

     Adds key with associated item a to the collection.	 Returns true.

	      bool
	  insertKeyAndValue(const K& key, const T& a);

     This is a deprecated version of the insert member above.  It behaves
     exactly the same as insert.

	      bool
	  isEmpty() const;

     Returns true if there are no items in the collection, false otherwise.

	      size_type
	  occurrencesOf(const K& key) const;

     Returns the number of keys j in self that compare equal to key.

	      size_type
	  occurrencesOf(bool (*fn)(const_reference,void*),
			void* d) const;

     Returns the number of associations a in self such that the
     expression((*fn)(a,d)) is true.  fn points to a user-defined tester
     function which must have prototype:

									Page 6

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

		 bool yourTester(const_reference a, void* d);

     Client data may be passed through parameter d.

	      bool
	  remove(const K& key);

     Removes the first association with key j in self where j compares equal
     to key and returns true.  Returns false if there is no such association.

	      bool
	  remove(bool (*fn)(const_reference,void*), void* d);

     Removes the first association a in self such that the expression
     ((*fn)(a,d)) is true and returns true.  Returns false if there is no such
     element.  fn points to a user-defined tester function which must have
     prototype:

		 bool yourTester(const_reference a, void* d);

     Client data may be passed through parameter d.

	      size_type
	  removeAll(const K& key);

     Removes all associations in self that have a key j that compares equal to
     key.  Returns the number of items removed.

	      size_type
	  removeAll(bool (*fn)(const_reference,void*), void* d);

     Removes all associations a in self such that the expression
     ((*fn)(a,d))is true.  Returns the number of items removed.	 fn points to
     a user-defined tester function which must have prototype:

									Page 7

RWTValMultiMap(3C++)					  RWTValMultiMap(3C++)

		 bool yourTester(const_reference a, void* d);

     Client data may be passed through parameter d.

	      multimap<K,T,C,allocator>&
	  std();
	  const multimap<K,T,C,allocator>&
	  std() const;

     Returns a reference to the underlying C++-standard collection that serves
     as the implementation for self.  This reference may be used freely,
     providing access to the C++-standard interface as well as
     interoperability with other software components that make use of the
     C++-standard collections.

Related Global Operators
	      RWvostream&
	  operator<<(RWvostream& strm,
		 const RWTValMultiMap<K,T,C>& coll);
	  RWFile&
	  operator<<(RWFile& strm, const RWTValMultiMap<K,T,C>& coll);

     Saves the collection coll onto the output stream strm, or a reference to
     it if it has already been saved.

	      RWvistream&
	  operator>>(RWvistream& strm, RWTValMultiMap<K,T,C>& coll);
	  RWFile&
	  operator>>(RWFile& strm, RWTValMultiMap<K,T,C>& coll);

     Restores the contents of the collection coll from the input stream strm.

	      RWvistream&
	  operator>>(RWvistream& strm, RWTValMultiMap<K,T,C>*& p);
	  RWFile&
	  operator>>(RWFile& strm, RWTValMultiMap<K,T,C>*& p);

     Looks at the next object on the input stream strm and either creates a
     new collection off the heap and sets p to point to it, or sets p to point
     to a previously read instance.  If a collection is created off the heap,
     then you are responsible for deleting it.

									Page 8

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net