#include <coherence/util/InvocableMap.hpp>
It allows non-existent entries to be represented, thus allowing their optional creation. It allows existent entries to be removed from the Map. It supports a number of optimizations that can ultimately be mapped through to indexes and other data structures of the underlying Map.
Public Types | |
typedef spec::Handle | Handle |
Entry Handle definition. | |
typedef spec::View | View |
Entry View definition. | |
typedef spec::Holder | Holder |
Entry Holder definition. | |
Public Member Functions | |
virtual Object::Holder | setValue (Object::Holder ohValue, bool fSynthetic)=0 |
Store the value corresponding to this entry. | |
virtual void | update (ValueUpdater::View vUpdater, Object::Holder ohValue)=0 |
Update the Entry's value. | |
virtual bool | isPresent () const =0 |
Determine if this Entry exists in the Map. | |
virtual void | remove (bool fSynthetic)=0 |
Remove this Entry from the Map if it is present in the Map. | |
virtual Object::Holder | extract (ValueExtractor::View vExtractor) const =0 |
virtual Object::Holder setValue | ( | Object::Holder | ohValue, | |
bool | fSynthetic | |||
) | [pure virtual] |
Store the value corresponding to this entry.
If the entry does not exist, then the entry will be created by invoking this method, even with a NULL value (assuming the Map supports NULL values).
Unlike the other form of setValue, this form does not return the previous value, and as a result may be significantly less expensive (in terms of cost of execution) for certain Map implementations.
ohValue | the new value for this Entry | |
fSynthetic | pass true only if the insertion into or modification of the Map should be treated as a synthetic event |
virtual void update | ( | ValueUpdater::View | vUpdater, | |
Object::Holder | ohValue | |||
) | [pure virtual] |
Update the Entry's value.
Calling this method is semantically equivalent to:
Object::Handle hTarget = cast<Object::Handle>( hEntry->getValue()); vUpdater->update(hTarget, ohValue); hEntry->setValue(hTarget, false);The benefit of using this method is that it may allow the Entry implementation to significantly optimize the operation, such as for purposes of delta updates and backup maintenance.
vUpdater | a ValueUpdater used to modify the Entry's value | |
ohValue | the new value to use |
virtual bool isPresent | ( | ) | const [pure virtual] |
virtual void remove | ( | bool | fSynthetic | ) | [pure virtual] |
Remove this Entry from the Map if it is present in the Map.
This method supports both the operation corresponding to Map::remove as well as synthetic operations such as eviction. If the containing Map does not differentiate between the two, then this method will always be identical to calling remove(getKey())
on the containing Map.
fSynthetic | pass true only if the removal from the Map should be treated as a synthetic event |