Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

MapEventFilter Class Reference

#include <coherence/util/filter/MapEventFilter.hpp>

Inherits Object, PortableObject, and Filter.

List of all members.


Detailed Description

Filter which evaluates the content of a MapEvent object according to the specified criteria.

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:

see ValueChangeEventFilter

Author:
djl 2008.05.19
 

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.

Parameters:
 v the object to test
Returns:
true if the test passes, false otherwise
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 hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object
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);

Parameters:
 out the stream used to output the description
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< Filterm_vFilter
 The event value(s) filter.

Constructor & Destructor Documentation

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);

Parameters:
 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.

Parameters:
 nMask combination of any of the E_* values
 vFilter (optional) the filter used for evaluating event values


Member Function Documentation

virtual int32_t getEventMask (  )  const [virtual]

Obtain the event mask.

The mask value is concatenation of any of the E_* values.

Returns:
the event mask

virtual Filter::View getFilter (  )  const [virtual]

Obtain the Filter object used to evaluate the event value(s).

Returns:
the filter used to evaluate the event value(s)

static int32_t getMask ( size32_t  iEvent  )  [static]

Event id to event mask translation.

Parameters:
 iEvent the event index
Returns:
the translated event mask


Member Data Documentation

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.


The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.