Member Functions | ||
applyToKeyAndValue() clear() contains() entries() find() findKeyAndValue() |
findValue() insertKeyAndValue() isEmpty() operator=() operator[]() remove() |
#include <rw/tvsldict.h> RWTValSlistDictionary<K,V> slistDict;
This class maintains a value-based collection of values, implemented as an intrusive singly-linked list of key and value pairs. Class K and V are the types of the keys and values respectively.
Isomorphic
This class is used in the implementation of RWTValHashDictionary.
RWTValSlistDictionary<K,V>();
Constructs an empty, singly-linked dictionary to hold instances of K and V types.
RWTValSlist<K,V>(const RWTValSlistDictionary<K,V>&);
Copy constructor.
RWTValSlistDictionary<K,V>& operator=(const RWTValSlistDictionary<K,V>& lst);
Empties self, then inserts all elements of lst.
V& operator[](K key);
Returns a reference to the value associated with key. If there is no element with key key, then a new association with that key is created and inserted into self. Prior to assignment, the value part of this association is garbage.
void applyToKeyAndValue(void (*applyFun)(const K&, V& ,void* d), void*);
Applies the user-defined function pointed to by appFn to every item in the collection. Client data may be passed through parameter d.
clear();
Clears the collection by removing all pairs from self.
RWBoolean contains(const K& a) const;
Returns TRUE if there exists a pair in self with key k such that the expression(*k == *a) is TRUE. Otherwise, returns FALSE.
size_t entries() const;
Returns the number of items in self.
RWBoolean find(const K& a, K& retKey) const;
If there exists a pair in self with key k such that the expression (k == a) is TRUE, places the found key in retKey and returns TRUE. Otherwise, returns FALSE.
RWBoolean findKeyAndValue(const K& a, K& retKey, V& retval) const;
If there exists a pair in self with key k such that the expression (k == a) is TRUE, places the key part of the pair in retKey, the value part of the pair in retval and returns TRUE. Otherwise, returns FALSE.
RWBoolean findValue(const K& a, K& retVal) const;
If there exists a pair in self with key k such that the expression (k == a) is TRUE, places the value part of the pair in retVey. Otherwise, returns FALSE.
void insertKeyAndValue(const K& k, const V& v);
If find(k) would fail, inserts a new pair holding k and v; otherwise, replaces with v the value associated with k.
RWBoolean isEmpty() const;
Returns TRUE if there are no items in the collection, FALSE otherwise.
RWBoolean remove(const K& k);
If find(k) would succeed, removes the pair associated with k, and returns TRUE. Otherwise, returns FALSE.
RWBoolean remove(const K& k V& retVal);
If find(k) would succeed, removes the pair associated with k, places the value part in retVal, and returns TRUE. Otherwise, returns FALSE.