#include <coherence/util/InvocableMap.hpp>
Inherits Map.
Inherited by NamedCache [virtual]
, and ConverterCollections::ConverterInvocableMap [virtual]
.
Public Types | |
typedef spec::Handle | Handle |
InvocableMap Handle definition. | |
typedef spec::View | View |
InvocableMap View definition. | |
typedef spec::Holder | Holder |
InvocableMap Holder definition. | |
Public Member Functions | |
virtual Object::Holder | invoke (Object::View vKey, EntryProcessor::Handle hAgent)=0 |
Invoke the passed EntryProcessor against the Entry specified by the passed key, returning the result of the invocation. | |
virtual Map::View | invokeAll (Collection::View vCollKeys, EntryProcessor::Handle hAgent)=0 |
Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each. | |
virtual Map::View | invokeAll (Filter::View vFilter, EntryProcessor::Handle hAgent)=0 |
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter, returning the result of the invocation for each. | |
virtual Object::Holder | aggregate (Collection::View vCollKeys, EntryAggregator::Handle hAgent) const =0 |
Perform an aggregating operation against the entries specified by the passed keys. | |
virtual Object::Holder | aggregate (Filter::View vFilter, EntryAggregator::Handle hAgent) const =0 |
Perform an aggregating operation against the set of entries that are selected by the given Filter. | |
virtual Object::Holder | getOrDefault (Object::View vKey, Object::Holder ohDefaultValue) const |
Get the value associated with the given key or return the default value if there is no value associated with the key. | |
virtual Object::Holder | putIfAbsent (Object::View vKey, Object::Holder ohValue) |
If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value. | |
virtual bool | removeValue (Object::View vKey, Object::View vValue) |
Removes the entry for the specified key only if it is currently mapped to the specified value. | |
virtual Object::Holder | replace (Object::View vKey, Object::Holder ohValue) |
Replaces the entry for the specified key only if it is currently mapped to some value. | |
virtual bool | replace (Object::View vKey, Object::View vOldValue, Object::Holder ohNewValue) |
Replaces the entry for the specified key only if currently mapped to the specified value. | |
Classes | |
class | Entry |
An InvocableMap::Entry contains additional information and exposes additional operations that the basic Map::Entry does not. More... | |
class | EntryAggregator |
An EntryAggregator represents processing that can be directed to occur against some subset of the entries in an InvocableMap, resulting in a aggregated result. More... | |
class | EntryProcessor |
An invocable agent that operates against the Entry objects within a Map. More... | |
class | ParallelAwareAggregator |
A ParallelAwareAggregator is an advanced extension to EntryAggregator that is explicitly capable of being run in parallel, for example in a distributed environment. More... |
virtual Object::Holder invoke | ( | Object::View | vKey, | |
EntryProcessor::Handle | hAgent | |||
) | [pure virtual] |
Invoke the passed EntryProcessor against the Entry specified by the passed key, returning the result of the invocation.
vKey | the key to process; it is not required to exist within the Map | |
hAgent | the EntryProcessor to use to process the specified key |
Implemented in ConverterCollections::ConverterInvocableMap, and ConverterCollections::ConverterNamedCache.
virtual Map::View invokeAll | ( | Collection::View | vCollKeys, | |
EntryProcessor::Handle | hAgent | |||
) | [pure virtual] |
Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.
vCollKeys | the keys to process; these keys are not required to exist within the Map | |
hAgent | the EntryProcessor to use to process the specified keys |
Implemented in ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterNamedCache, and ConverterCollections::ConverterNamedCache.
virtual Map::View invokeAll | ( | Filter::View | vFilter, | |
EntryProcessor::Handle | hAgent | |||
) | [pure virtual] |
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter, returning the result of the invocation for each.
Unless specified otherwise, InvocableMap implementations will perform this operation in two steps: (1) use the filter to retrieve a matching entry set; (2) apply the agent to every filtered entry. This algorithm assumes that the agent's processing does not affect the result of the specified filter evaluation, since the filtering and processing could be performed in parallel on different threads. If this assumption does not hold, the processor logic has to be idempotent, or at least re-evaluate the filter. This could be easily accomplished by wrapping the processor with a ConditionalProcessor.
vFilter | a Filter that results in the set of keys to be processed | |
hAgent | the EntryProcessor to use to process the specified keys |
Implemented in ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterNamedCache, and ConverterCollections::ConverterNamedCache.
virtual Object::Holder aggregate | ( | Collection::View | vCollKeys, | |
EntryAggregator::Handle | hAgent | |||
) | const [pure virtual] |
Perform an aggregating operation against the entries specified by the passed keys.
vCollKeys | the Collection of keys that specify the entries within this Map to aggregate across | |
hAgent | the EntryAggregator that is used to aggregate across the specified entries of this Map |
Implemented in ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterNamedCache, and ConverterCollections::ConverterNamedCache.
virtual Object::Holder aggregate | ( | Filter::View | vFilter, | |
EntryAggregator::Handle | hAgent | |||
) | const [pure virtual] |
Perform an aggregating operation against the set of entries that are selected by the given Filter.
vFilter | the Filter that is used to select entries within this Map to aggregate across | |
hAgent | the EntryAggregator that is used to aggregate across the selected entries of this Map |
Implemented in ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterInvocableMap, ConverterCollections::ConverterNamedCache, and ConverterCollections::ConverterNamedCache.
virtual Object::Holder getOrDefault | ( | Object::View | vKey, | |
Object::Holder | ohDefaultValue | |||
) | const [virtual] |
Get the value associated with the given key or return the default value if there is no value associated with the key.
vKey | the key | |
ohDefaultValue | the default value |
Reimplemented from Map.
virtual Object::Holder putIfAbsent | ( | Object::View | vKey, | |
Object::Holder | ohValue | |||
) | [virtual] |
If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value.
vKey | the key | |
vValue | the value |
Reimplemented from Map.
virtual bool removeValue | ( | Object::View | vKey, | |
Object::View | vValue | |||
) | [virtual] |
Removes the entry for the specified key only if it is currently mapped to the specified value.
vKey | the key | |
vValue | the value |
virtual Object::Holder replace | ( | Object::View | vKey, | |
Object::Holder | ohValue | |||
) | [virtual] |
Replaces the entry for the specified key only if it is currently mapped to some value.
vKey | the key | |
vValue | the value |
Reimplemented from Map.
virtual bool replace | ( | Object::View | vKey, | |
Object::View | vOldValue, | |||
Object::Holder | ohNewValue | |||
) | [virtual] |
Replaces the entry for the specified key only if currently mapped to the specified value.
vKey | the key | |
vOldValue | the old value | |
vNewValue | the new value |
Reimplemented from Map.