activemq-cpp-3.6.0
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 >:

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.
- Public Member Functions inherited from decaf::util::Map< K, V >
 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
- Public Member Functions inherited from decaf::util::concurrent::Synchronizable
virtual ~Synchronizable ()

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 ( )
inlinevirtual

Member Function Documentation

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

Locks the object.

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

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

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.
RuntimeExceptionif 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().

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

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.
RuntimeExceptionif 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().

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

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
RuntimeExceptionif 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().

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

Unlocks the object.

Exceptions
RuntimeExceptionif 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().

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

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

Must have this object locked before calling.

Exceptions
RuntimeExceptionif an error occurs while waiting on the object.
InterruptedExceptionif 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().

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::wait ( long long  millisecs)
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.

Parameters
millisecsthe time in milliseconds to wait, or WAIT_INIFINITE
Exceptions
RuntimeExceptionif an error occurs while waiting on the object.
InterruptedExceptionif 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().

template<typename K, typename V>
virtual void decaf::util::AbstractMap< K, V >::wait ( long long  millisecs,
int  nanos 
)
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.

Parameters
millisecsthe time in milliseconds to wait, or WAIT_INIFINITE
nanosadditional time in nanoseconds with a range of 0-999999
Exceptions
IllegalArgumentExceptionif an error occurs or the nanos argument is not in the range of [0-999999]
RuntimeExceptionif an error occurs while waiting on the object.
InterruptedExceptionif 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().

Field Documentation


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