activemq-cpp-3.6.0
|
This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface. More...
#include <src/main/decaf/util/AbstractMap.h>
Public Member Functions | |
AbstractMap () | |
AbstractMap (const Map< K, V > &map) | |
AbstractMap (const AbstractMap< K, V > &map) | |
virtual | ~AbstractMap () |
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 bool | equals (const Map &source) const =0 |
Compares the specified object with this map for equality. | |
virtual void | copy (const Map &source)=0 |
Copies the content of the source map into this map. | |
virtual void | clear ()=0 |
Removes all of the mappings from this map (optional operation). | |
virtual bool | containsKey (const K &key) const =0 |
Returns true if this map contains a mapping for the specified key. | |
virtual bool | containsValue (const V &value) const =0 |
Returns true if this map maps one or more keys to the specified value. | |
virtual bool | isEmpty () const =0 |
virtual int | size () const =0 |
virtual V & | get (const K &key)=0 |
Gets the value mapped to the specified key in the Map. | |
virtual const V & | get (const K &key) const =0 |
Gets the value mapped to the specified key in the Map. | |
virtual bool | put (const K &key, const V &value)=0 |
Associates the specified value with the specified key in this map (optional operation). | |
virtual bool | put (const K &key, const V &value, V &oldValue)=0 |
Associates the specified value with the specified key in this map (optional operation). | |
virtual void | putAll (const Map< K, V > &other)=0 |
Copies all of the mappings from the specified map to this map (optional operation). | |
virtual V | remove (const K &key)=0 |
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. | |
virtual Set< MapEntry< K, V > > & | entrySet ()=0 |
Returns a Set view of the mappings contained in this map. | |
virtual const Set< MapEntry< K, V > > & | entrySet () const =0 |
virtual Set< K > & | keySet ()=0 |
Returns a Set view of the keys contained in this map. | |
virtual const Set< K > & | keySet () const =0 |
virtual Collection< V > & | values ()=0 |
Returns a Collection view of the values contained in this map. | |
virtual const Collection< V > & | values () const =0 |
![]() | |
virtual | ~Synchronizable () |
Protected Attributes | |
util::concurrent::Mutex | mutex |
This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.
To implement an unmodifiable map, the programmer needs only to extend this class and provide an implementation for the entrySet method, which returns a set-view of the map's mappings. Typically, the returned set will, in turn, be implemented atop AbstractSet. This set should not support the add or remove methods, and its iterator should not support the remove method.
To implement a modifiable map, the programmer must additionally override this class's put method (which otherwise throws an UnsupportedOperationException), and the iterator returned by entrySet().iterator() must additionally implement its remove method.
The programmer should generally provide a void (no argument) and map constructor, as per the recommendation in the Map interface specification.
The documentation for each non-abstract method in this class describes its implementation in detail. Each of these methods may be overridden if the map being implemented admits a more efficient implementation.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Locks the object.
RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::concurrent::Mutex::lock(), and decaf::util::AbstractMap< K, V >::mutex.
|
inlinevirtual |
Signals a waiter on this object that it can now wake up and continue.
Must have this object locked before calling.
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
RuntimeException | if an error occurs while notifying one of the waiting threads. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::notify().
|
inlinevirtual |
Signals the waiters on this object that it can now wake up and continue.
Must have this object locked before calling.
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
RuntimeException | if an error occurs while notifying the waiting threads. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::notifyAll().
|
inlinevirtual |
Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::tryLock().
|
inlinevirtual |
Unlocks the object.
RuntimeException | if an error occurs while unlocking the object. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::unlock().
|
inlinevirtual |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling.
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if the wait is interrupted before it completes. |
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::wait().
|
inlinevirtual |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling. This wait will timeout after the specified time interval.
millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if the wait is interrupted before it completes. |
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::wait().
|
inlinevirtual |
Waits on a signal from this object, which is generated by a call to Notify.
Must have this object locked before calling. This wait will timeout after the specified time interval. This method is similar to the one argument wait function except that it add a finer grained control over the amount of time that it waits by adding in the additional nanosecond argument.
NOTE: The ability to wait accurately at a nanosecond scale depends on the platform and OS that the Decaf API is running on, some systems do not provide an accurate enough clock to provide this level of granularity.
millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
nanos | additional time in nanoseconds with a range of 0-999999 |
IllegalArgumentException | if an error occurs or the nanos argument is not in the range of [0-999999] |
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if the wait is interrupted before it completes. |
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
Implements decaf::util::concurrent::Synchronizable.
References decaf::util::AbstractMap< K, V >::mutex, and decaf::util::concurrent::Mutex::wait().
|
mutableprotected |