activemq-cpp-3.6.0
|
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>
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. |
Interface for a Map type that provides additional atomic putIfAbsent, remove, and replace methods alongside the already available Map interface.
|
inlinevirtual |
|
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.
key | The key to map the value to. |
value | The value to map to the given key. |
UnsupportedOperationException | if 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 >.
|
pure virtual |
Remove entry for key only if currently mapped to given value.
Acts as
if( ( map.containsKey( key ) && ( map.get( key ) == value ) ) ) { map.remove( key ); return true; } else { return false; }
except that the action is performed atomically.
key | key with which the specified value is associated. |
value | value associated with the specified key. |
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 >.
|
pure virtual |
Replace entry for key only if currently mapped to given value.
Acts as
if( ( map.containsKey( key ) && ( map.get( key ) == oldValue ) ) { map.put( key, newValue ); return true; } else { return false; }
except that the action is performed atomically.
key | key with which the specified value is associated. |
oldValue | value expected to be associated with the specified key. |
newValue | value to be associated with the specified key. |
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 >.
|
pure virtual |
Replace entry for key only if currently mapped to some value.
Acts as
if( ( map.containsKey( key ) ) { return map.put( key, value ); } else { throw NoSuchElementException(...); };
except that the action is performed atomically.
key | key with which the specified value is associated. |
value | value to be associated with the specified key. |
NoSuchElementException | if there was no previous mapping. |
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 >.