decaf::util::AbstractMap< K, V > Class Template Reference

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>

Inheritance diagram for decaf::util::AbstractMap< K, V >:
Inheritance graph
[legend]

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.

Protected Attributes

util::concurrent::Mutex mutex

Detailed Description

template<typename K, typename V>
class decaf::util::AbstractMap< K, V >

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.

Since:
1.0

Constructor & Destructor Documentation

template<typename K, typename V>
decaf::util::AbstractMap< K, V >::AbstractMap (  )  [inline]
template<typename K, typename V>
decaf::util::AbstractMap< K, V >::AbstractMap ( const Map< K, V > &  map  )  [inline]
template<typename K, typename V>
decaf::util::AbstractMap< K, V >::AbstractMap ( const AbstractMap< K, V > &  map  )  [inline]
template<typename K, typename V>
virtual decaf::util::AbstractMap< K, V >::~AbstractMap (  )  [inline, virtual]

Member Function Documentation

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::lock (  )  [inline, virtual]

Locks the object.

Exceptions:
RuntimeException if an error occurs while locking the object.

Implements decaf::util::concurrent::Synchronizable.

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::notify (  )  [inline, virtual]

Signals a waiter on this object that it can now wake up and continue.

Must have this object locked before calling.

Exceptions:
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.

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::notifyAll (  )  [inline, virtual]

Signals the waiters on this object that it can now wake up and continue.

Must have this object locked before calling.

Exceptions:
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.

template<typename K, typename V>
virtual bool decaf::util::AbstractMap< K, V >::tryLock (  )  [inline, virtual]

Attempts to Lock the object, if the lock is already held by another thread than this method returns false.

Returns:
true if the lock was acquired, false if it is already held by another thread.
Exceptions:
RuntimeException if an error occurs while locking the object.

Implements decaf::util::concurrent::Synchronizable.

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::unlock (  )  [inline, virtual]

Unlocks the object.

Exceptions:
RuntimeException if an error occurs while unlocking the object.

Implements decaf::util::concurrent::Synchronizable.

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::wait ( long long  millisecs,
int  nanos 
) [inline, virtual]

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.

Parameters:
millisecs the time in milliseconds to wait, or WAIT_INIFINITE
nanos additional time in nanoseconds with a range of 0-999999
Exceptions:
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.

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::wait ( long long  millisecs  )  [inline, virtual]

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.

Parameters:
millisecs the time in milliseconds to wait, or WAIT_INIFINITE
Exceptions:
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.

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::wait (  )  [inline, virtual]

Waits on a signal from this object, which is generated by a call to Notify.

Must have this object locked before calling.

Exceptions:
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.


Field Documentation

template<typename K, typename V>
util::concurrent::Mutex decaf::util::AbstractMap< K, V >::mutex [mutable, protected]

The documentation for this class was generated from the following file:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1