Public Member Functions |
| StlMap () |
| Default constructor - does nothing.
|
| StlMap (const StlMap &source) |
| Copy constructor - copies the content of the given map into this one.
|
| StlMap (const Map< K, V > &source) |
| Copy constructor - copies the content of the given map into this one.
|
virtual | ~StlMap () |
virtual bool | equals (const StlMap &source) const |
|
|
virtual bool | equals (const Map< K, V > &source) const |
| Compares the specified object with this map for equality.Returns true if the two maps represent the same mappings. More formally, two maps m1 and m2 represent the same mappings if m1.entrySet().equals(m2.entrySet()). This ensures that the equals method works properly across different implementations of the Map interface.- Parameters
-
source | Map to compare to this one. |
- Returns
- true if the Map passed is equal in value to this one.
|
virtual void | copy (const StlMap &source) |
|
|
virtual void | copy (const Map< K, V > &source) |
| Copies the content of the source map into this map.Erases all existing mappings in this map. The copy is performed by using the entrySet of the source Map and iterating over those entries, inserting each into the target.- Parameters
-
source | The source object to copy from. |
|
virtual void | clear () |
| Removes all of the mappings from this map (optional operation).The map will be empty after this call returns.- Exceptions
-
UnsupportedOperationException | if the clear operation is not supported by this map. |
|
virtual bool | containsKey (const K &key) const |
| Returns true if this map contains a mapping for the specified key.More formally, returns true if and only if this map contains a mapping for a key k such that (key == k). (There can be at most one such mapping.)- Parameters
-
- Returns
- true if this map contains the key mapping, otherwise false.
|
virtual bool | containsValue (const V &value) const |
| Returns true if this map maps one or more keys to the specified value.More formally, returns true if and only if this map contains at least one mapping to a value v such that (value==v). This operation will probably require time linear in the map size for most implementations of the Map interface.- Parameters
-
value | The Value to look up in this Map. |
- Returns
- true if this map contains at least one mapping for the value, otherwise false.
|
virtual bool | isEmpty () const |
| - Returns
- if the Map contains any element or not, TRUE or FALSE
|
virtual int | size () const |
| - Returns
- The number of elements (key/value pairs) in this map.
|
virtual V & | get (const K &key) |
| Gets the value mapped to the specified key in the Map.If there is no element in the map whose key is equivalent to the key provided then a NoSuchElementException is thrown.- Parameters
-
key | The search key whose value should be returned if present. |
- Returns
- A reference to the value for the given key if present in the Map.
- Exceptions
-
|
virtual const V & | get (const K &key) const |
| Gets the value mapped to the specified key in the Map.If there is no element in the map whose key is equivalent to the key provided then a NoSuchElementException is thrown.- Parameters
-
key | The search key whose value should be returned if present. |
- Returns
- A const reference to the value for the given key if present in the Map.
- Exceptions
-
|
virtual bool | put (const K &key, const V &value) |
| Associates the specified value with the specified key in this map (optional operation).If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)- Parameters
-
key | The target key. |
value | The value to be set. |
- Returns
- true if the put operation replaced a value that was associated with an existing mapping to the given key or false otherwise.
- Exceptions
-
UnsupportedOperationException | if this map is unmodifiable. |
IllegalArgumentException | if some property of the specified key or value prevents it from being stored in this map |
|
virtual bool | put (const K &key, const V &value, V &oldValue) |
| Associates the specified value with the specified key in this map (optional operation).If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)This method accepts a reference to a value which will be assigned the previous value for the given key (if any). If there was no previous mapping for the given key the out value is not written to. A return of true indicates that a value was replaced by this put operation.- Parameters
-
key | The target key. |
value | The value to be set. |
oldValue | (out) The value previously held in the mapping for this key. . |
- Returns
- true if the put operation replaced a value that was associated with an existing mapping to the given key or false otherwise.
- Exceptions
-
UnsupportedOperationException | if this map is unmodifiable. |
IllegalArgumentException | if some property of the specified key or value prevents it from being stored in this map |
|
virtual void | putAll (const StlMap< K, V, COMPARATOR > &other) |
|
|
virtual void | putAll (const Map< K, V > &other) |
| Copies all of the mappings from the specified map to this map (optional operation).The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.- Parameters
-
other | A Map instance whose elements are to all be inserted in this Map. |
- Exceptions
-
UnsupportedOperationException | If the implementing class does not support the putAll operation. |
|
virtual V | remove (const K &key) |
| Removes the value (key/value pair) for the specified key from the map, returns a copy of the value that was mapped to the key.Care must be taken when using this operation as it will throw an exception if there is no mapping for the given key.- Parameters
-
key | The search key whose mapping is to be removed. |
- Returns
- a copy of the element that was previously mapped to the given key.
- Exceptions
-
|
virtual Set< MapEntry< K, V > > & | entrySet () |
| Returns a Set view of the mappings contained in this map.
|
virtual const Set< MapEntry< K,
V > > & | entrySet () const |
virtual Set< K > & | keySet () |
| Returns a Set view of the keys contained in this map.
|
virtual const Set< K > & | keySet () const |
virtual Collection< V > & | values () |
| Returns a Collection view of the values contained in this map.
|
virtual const Collection< V > & | values () const |
virtual void | lock () |
| Locks the object.
|
virtual bool | tryLock () |
| Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
|
virtual void | unlock () |
| Unlocks the object.
|
virtual void | wait () |
| Waits on a signal from this object, which is generated by a call to Notify.
|
virtual void | wait (long long millisecs) |
| Waits on a signal from this object, which is generated by a call to Notify.
|
virtual void | wait (long long millisecs, int nanos) |
| Waits on a signal from this object, which is generated by a call to Notify.
|
virtual void | notify () |
| Signals a waiter on this object that it can now wake up and continue.
|
virtual void | notifyAll () |
| Signals the waiters on this object that it can now wake up and continue.
|
| Map () |
| Default constructor - does nothing.
|
virtual | ~Map () |
virtual | ~Synchronizable () |
template<typename K, typename V, typename COMPARATOR = std::less<K>>
class decaf::util::StlMap< K, V, COMPARATOR >
Map template that wraps around a std::map to provide a more user-friendly interface and to provide common functions that do not exist in std::map.
- Since
- 1.0
template<typename K, typename V, typename COMPARATOR = std::less<K>>
Returns a Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
- Returns
- a reference to a Set<MapEntry<K,V>> that is backed by this Map.
Implements decaf::util::Map< K, V >.
template<typename K, typename V, typename COMPARATOR = std::less<K>>
Returns a Set view of the keys contained in this map.
The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
- Returns
- a set view of the keys contained in this map,
Implements decaf::util::Map< K, V >.
Referenced by decaf::util::StlMap< std::string, cms::Topic * >::equals().