activemq-cpp-3.6.0
decaf::util::concurrent::ConcurrentMap< K, V > Class Template Reference

Interface for a Map type that provides additional atomic putIfAbsent, remove, and replace methods alongside the already available Map interface. More...

#include <src/main/decaf/util/concurrent/ConcurrentMap.h>

Inheritance diagram for decaf::util::concurrent::ConcurrentMap< K, V >:

Public Member Functions

virtual ~ConcurrentMap ()
virtual bool putIfAbsent (const K &key, const V &value)=0
 If the specified key is not already associated with a value, associate it with the given value.
virtual bool remove (const K &key, const V &value)=0
 Remove entry for key only if currently mapped to given value.
virtual bool replace (const K &key, const V &oldValue, const V &newValue)=0
 Replace entry for key only if currently mapped to given value.
virtual V replace (const K &key, const V &value)=0
 Replace entry for key only if currently mapped to some value.
- 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 ()
virtual void lock ()=0
 Locks the object.
virtual bool tryLock ()=0
 Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
virtual void unlock ()=0
 Unlocks the object.
virtual void wait ()=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs)=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs, int nanos)=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void notify ()=0
 Signals a waiter on this object that it can now wake up and continue.
virtual void notifyAll ()=0
 Signals the waiters on this object that it can now wake up and continue.

Detailed Description

template<typename K, typename V>
class decaf::util::concurrent::ConcurrentMap< K, V >

Interface for a Map type that provides additional atomic putIfAbsent, remove, and replace methods alongside the already available Map interface.

Since
1.0

Constructor & Destructor Documentation

template<typename K, typename V>
virtual decaf::util::concurrent::ConcurrentMap< K, V >::~ConcurrentMap ( )
inlinevirtual

Member Function Documentation

template<typename K, typename V>
virtual bool decaf::util::concurrent::ConcurrentMap< K, V >::putIfAbsent ( const K &  key,
const V &  value 
)
pure virtual

If the specified key is not already associated with a value, associate it with the given value.

This is equivalent to

    if( !map.containsKey( key ) ) {
        map.put( key, value );
        return true;
    } else {
        return false;
    }

except that the action is performed atomically.

Parameters
keyThe key to map the value to.
valueThe value to map to the given key.
Returns
true if the put operation was performed otherwise return false which indicates there was a value previously mapped to the key.
Exceptions
UnsupportedOperationExceptionif the put operation is not supported by this map

Implemented in decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< MessageId >, Pointer< Command >, MessageId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< ConnectionId >, Pointer< ConnectionState >, ConnectionId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< std::string, Pointer< Command > >, decaf::util::concurrent::ConcurrentStlMap< Pointer< ConsumerId >, Pointer< ConsumerState >, ConsumerId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< SessionId >, Pointer< SessionState >, SessionId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< LocalTransactionId >, Pointer< TransactionState >, LocalTransactionId::COMPARATOR >, and decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >.

template<typename K, typename V>
virtual bool decaf::util::concurrent::ConcurrentMap< K, V >::replace ( const K &  key,
const V &  oldValue,
const V &  newValue 
)
pure virtual
template<typename K, typename V>
virtual V decaf::util::concurrent::ConcurrentMap< K, V >::replace ( const K &  key,
const V &  value 
)
pure virtual

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