#include <coherence/util/filter/MapEventFilter.hpp>
Inherits Object, PortableObject, and Filter.
This filter is intended to be used by various ObservableMap listeners that are interested in particular subsets of MapEvent notifications emitted by the map.
Usage examples:
MapEventFilter::create(MapEventFilter.E_INSERT, EqualsFilter::create(ReflectionExtractor::create("isMarried"), Boolean::create(true));
MapEventFilter::create(MapEventFilter::E_DELETE);
MapEventFilter::create(MapEventFilter::E_UPDATE, EqualsFilter::create(ReflectionExtractor::create("LastName"), String::create("Smith")));
Set::View setKeys = HashSet::create(); Filter::View filterEvt = MapEventFilter::create(filterMap); MapListener::Handle listener = MapListener::create(); map.addMapListener(listener, filterEvt, true); setKeys.addAll(map.keySet(filterMap));
Public Types | ||||
typedef spec::Handle | Handle | |||
MapEventFilter Handle definition. | ||||
typedef spec::View | View | |||
MapEventFilter View definition. | ||||
typedef spec::Holder | Holder | |||
MapEventFilter Holder definition. | ||||
Public Member Functions | ||||
virtual bool | evaluate (Object::View v) const | |||
Apply the test to the object.
| ||||
virtual void | readExternal (PofReader::Handle hIn) | |||
virtual void | writeExternal (PofWriter::Handle hOut) const | |||
virtual bool | equals (Object::View v) const | |||
virtual size32_t | hashCode () const | |||
Return a hash code value for the Object. This method is supported for the benefit of hash-based containers.
The general contract of
The default implementation is identity based.
| ||||
virtual void | toStream (std::ostream &out) const | |||
Output a human-readable description of this Object to the given stream. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.
Object::View vKey = ... Object::View vValue = ... std::cout << vKey << " = " << vValue << std::endl; String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);
| ||||
virtual int32_t | getEventMask () const | |||
Obtain the event mask. | ||||
virtual Filter::View | getFilter () const | |||
Obtain the Filter object used to evaluate the event value(s). | ||||
Static Public Member Functions | ||||
static int32_t | getMask (size32_t iEvent) | |||
Event id to event mask translation. | ||||
Static Public Attributes | ||||
static const int32_t | E_INSERTED | |||
This value indicates that MapEvent::ENTRY_INSERTED ENTRY_INSERTED} events should be evaluated. | ||||
static const int32_t | E_UPDATED | |||
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated. | ||||
static const int32_t | E_DELETED | |||
This value indicates that MapEvent::ENTRY_DELETED ENTRY_DELETED events should be evaluated. | ||||
static const int32_t | E_UPDATED_ENTERED | |||
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated, but only if filter evaluation is false for the old value and true for the new value. | ||||
static const int32_t | E_UPDATED_LEFT | |||
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated, but only if filter evaluation is true for the old value and false for the new value. | ||||
static const int32_t | E_UPDATED_WITHIN | |||
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated, but only if filter evaluation is true for both the old and the new value. | ||||
static const int32_t | E_ALL | |||
This value indicates that all events should be evaluated. | ||||
static const int32_t | E_KEYSET | |||
This value indicates that all events that would affect the result of a coherence::util::QueryMap::keySet(coherence::util::Filter) query should be evaluated. | ||||
Protected Member Functions | ||||
MapEventFilter () | ||||
Default constructor (necessary for the PortableObject interface). | ||||
MapEventFilter (Filter::View vFilter) | ||||
Construct a MapEventFilter that evaluates MapEvent objects that would affect the results of a keySet filter issued by a previous call to coherence::util::QueryMap::keySet(coherence::util::Filter::View). | ||||
MapEventFilter (int32_t nMask, Filter::View vFilter=NULL) | ||||
Construct a MapEventFilter that evaluates MapEvent objects based on the specified combination of event types. | ||||
Protected Attributes | ||||
int32_t | m_nMask | |||
The event mask. | ||||
MemberView< Filter > | m_vFilter | |||
The event value(s) filter. |
MapEventFilter | ( | Filter::View | vFilter | ) | [protected] |
Construct a MapEventFilter that evaluates MapEvent objects that would affect the results of a keySet filter issued by a previous call to coherence::util::QueryMap::keySet(coherence::util::Filter::View).
It is possible to easily implement continuous query functionality.
Using this constructor is equivalent to: MapEventFilter::create(E_KEYSET, filter);
vFilter | the filter passed previously to a keySet() query method |
MapEventFilter | ( | int32_t | nMask, | |
Filter::View | vFilter = NULL | |||
) | [protected] |
Construct a MapEventFilter that evaluates MapEvent objects based on the specified combination of event types.
nMask | combination of any of the E_* values | |
vFilter | (optional) the filter used for evaluating event values |
virtual int32_t getEventMask | ( | ) | const [virtual] |
Obtain the event mask.
The mask value is concatenation of any of the E_* values.
virtual Filter::View getFilter | ( | ) | const [virtual] |
static int32_t getMask | ( | size32_t | iEvent | ) | [static] |
Event id to event mask translation.
iEvent | the event index |
const int32_t E_INSERTED [static] |
This value indicates that MapEvent::ENTRY_INSERTED ENTRY_INSERTED} events should be evaluated.
The event will be fired if there is no filter specified or the filter evaluates to true for a new value.
const int32_t E_UPDATED [static] |
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated.
The event will be fired if there is no filter specified or the filter evaluates to true when applied to either old or new value.
const int32_t E_DELETED [static] |
This value indicates that MapEvent::ENTRY_DELETED ENTRY_DELETED events should be evaluated.
The event will be fired if there is no filter specified or the filter evaluates to true for an old value.
const int32_t E_UPDATED_ENTERED [static] |
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated, but only if filter evaluation is false for the old value and true for the new value.
This corresponds to an item that was not in a keySet filter result changing such that it would now be in that keySet filter result.
const int32_t E_UPDATED_LEFT [static] |
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated, but only if filter evaluation is true for the old value and false for the new value.
This corresponds to an item that was in a keySet filter result changing such that it would no longer be in that keySet filter result.
const int32_t E_UPDATED_WITHIN [static] |
This value indicates that MapEvent::ENTRY_UPDATED ENTRY_UPDATED events should be evaluated, but only if filter evaluation is true for both the old and the new value.
This corresponds to an item that was in a keySet filter result changing but not leaving the keySet filter result.