Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

MapListenerSupport Class Reference

#include <coherence/util/MapListenerSupport.hpp>

Inherits Object.

List of all members.


Detailed Description

This class provides support for advanced MapListener functionality.
Author:
js 2008.06.10

Public Types

typedef spec::Handle  Handle
  MapListenerSupport Handle definition.
typedef spec::View  View
  MapListenerSupport View definition.
typedef spec::Holder  Holder
  MapListenerSupport Holder definition.

Public Member Functions

virtual void  addListener (MapListener::Handle hListener, Filter::View vFilter, bool fLite)
  Add a map listener that receives events based on a filter evaluation.
virtual void  addListener (MapListener::Handle hListener, Object::View vKey, bool fLite)
  Add a map listener for a specific key.
virtual void  removeListener (MapListener::View vListener, Filter::View vFilter)
  Remove a map listener that previously signed up for events based on a filter evaluation.
virtual void  removeListener (MapListener::View vListener, Object::View vKey)
  Remove a map listener that previously signed up for events about a specific key.
virtual void  clear ()
  Remove all signed up listeners.
virtual bool  isEmpty () const
  Checks whether or not this MapListenerSupport object contains any listeners.
virtual bool  isEmpty (Filter::View vFilter) const
  Checks whether or not this MapListenerSupport object contains any listeners for a given filter.
virtual bool  isEmpty (Object::View vKey) const
  Checks whether or not this MapListenerSupport object contains any listeners for a given key.
virtual bool  containsStandardListeners (Filter::View vFilter) const
  Checks whether or not this MapListenerSupport object contains any standard (not lite) listeners for a given filter.
virtual bool  containsStandardListeners (Object::View vKey) const
  Checks whether or not this MapListenerSupport object contains any standard (not lite) listeners for a given key.
virtual Set::View  getFilterSet () const
  Obtain a set of all filters that have assosiated global listeners.
virtual Set::View  getKeySet () const
  Obtain a set of all keys that have assosiated key listeners.
virtual Listeners::View  getListeners (Filter::View vFilter) const
  Obtain the Listeners object for a given filter.
virtual Listeners::View  getListeners (Object::View vKey) const
  Obtain the Listeners object for a given key.
virtual Listeners::View  collectListeners (MapEvent::View vEvent)
  Collect all Listeners that should be notified for a given event.
virtual void  fireEvent (MapEvent::Handle hEvent, bool fStrict)
  Fire the specified map event.
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


Static Public Member Functions

static MapEvent::Handle  convertEvent (MapEvent::View vEvent, ObservableMap::Handle hmapConv, Converter::View vConvKey=NULL, Converter::View vConvVal=NULL)
  Convert the specified map event into another MapEvent that ensures the lazy event data conversion using the specified converters.

Protected Types

enum   Plan
  Optimization Plan enum.

Protected Member Functions

  MapListenerSupport ()
  Create a new MapListenerSupport.

Static Protected Member Functions

static void  addSafeListener (Map::Handle hmapListeners, Object::View vKey, MapListener::Handle hListener)
  Ensure that the specified map has a Listeners object assosiated with the specified key and add the specified listener to it.
static void  removeSafeListener (Map::Handle hmapListeners, Object::View vKey, MapListener::View vListener)
  Remove the specified listener from the Listeners object assosiated with the specified key.
static void  addListenerState (Map::Handle hmapStandardListeners, Object::View vKey, MapListener::Handle hListener, bool fLite)
  Add a state information (lite or standard) associated with specified key and listener.
static void  removeListenerState (Map::Handle hmapStandardListeners, Object::View vKey, MapListener::View vListener)
  Remove a state information (lite or standard) assosiated with specified key and listener.

Protected Attributes

MemberHandle< Map m_hmapListeners
  The collections of MapListener objects that have signed up for notifications from an ObservableMap implementation keyed by the corresponding Filter objects.
MemberHandle< Map m_hmapKeyListeners
  The collections of MapListener objects that have signed up for key based notifications from an ObservableMap implementation keyed by the corresponding key objects.
MemberHandle< Map m_hmapStandardListeners
  The subset of standard (not lite) global listeners.
MemberHandle< Map m_hmapStandardKeyListeners
  The subset of standard (not lite) key listeners.
Plan  m_optimizationPlan
  The optimization plan which indicates the fastest way to put together a set of listeners.
MemberView< Listeners m_vListenersCached
  A cached set of Listeners.

Classes

class   FilterEvent
  An extension of the CacheEvent which may carry no values (old or new), but instead holds an array of Filter objects being the "cause" of the event. More...
class   SynchronousListener
  A tag interface indicating that tagged MapListener implementation has to receive the MapEvent notifications in a synchronous manner. More...
class   WrapperSynchronousListener
  A wrapper class that turns the specified MapListener into a synchronous listener. More...

Member Function Documentation

virtual void addListener ( MapListener::Handle  hListener,
Filter::View  vFilter,
bool  fLite  
) [virtual]

Add a map listener that receives events based on a filter evaluation.

Parameters:
hListener  the listener to add
vFilter  a filter that will be passed MapEvent objects to select from; a MapEvent will be delivered to the listener only if the filter evaluates to true for that MapEvent; NULL is equivalent to a filter that alway returns true
fLite  true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations

virtual void addListener ( MapListener::Handle  hListener,
Object::View  vKey,
bool  fLite  
) [virtual]

Add a map listener for a specific key.

Parameters:
hListener  the listener to add
vKey  the key that identifies the entry for which to raise events
fLite  true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values in order to allow optimizations

virtual void removeListener ( MapListener::View  vListener,
Filter::View  vFilter  
) [virtual]

Remove a map listener that previously signed up for events based on a filter evaluation.

Parameters:
vListener  the listener to remove
vFilter  a filter used to evaluate events

virtual void removeListener ( MapListener::View  vListener,
Object::View  vKey  
) [virtual]

Remove a map listener that previously signed up for events about a specific key.

Parameters:
vListener  the listener to remove
vKey  the key that identifies the entry for which to raise events

virtual bool isEmpty (  )  const [virtual]

Checks whether or not this MapListenerSupport object contains any listeners.

Returns:
true iff there are no listeners encapsulated by this MapListenerSupport object

virtual bool isEmpty ( Filter::View  vFilter  )  const [virtual]

Checks whether or not this MapListenerSupport object contains any listeners for a given filter.

Parameters:
vFilter  the filter
Returns:
true iff there are no listeners for the specified filter encapsulated by this MapListenerSupport object

virtual bool isEmpty ( Object::View  vKey  )  const [virtual]

Checks whether or not this MapListenerSupport object contains any listeners for a given key.

Parameters:
vKey  the key
Returns:
true iff there are no listeners for the specified filter encapsulated by this MapListenerSupport object

virtual bool containsStandardListeners ( Filter::View  vFilter  )  const [virtual]

Checks whether or not this MapListenerSupport object contains any standard (not lite) listeners for a given filter.

Parameters:
vFilter  the filter
Returns:
true iff there are no standard listeners for the specified filter encapsulated by this MapListenerSupport object

virtual bool containsStandardListeners ( Object::View  vKey  )  const [virtual]

Checks whether or not this MapListenerSupport object contains any standard (not lite) listeners for a given key.

Parameters:
vKey  the key
Returns:
true iff there are no standard listeners for the specified filter encapsulated by this MapListenerSupport object

virtual Set::View getFilterSet (  )  const [virtual]

Obtain a set of all filters that have assosiated global listeners.

Note: The returned value must be treated as an immutable.

Returns:
a set of all filters that have assosiated global listeners

virtual Set::View getKeySet (  )  const [virtual]

Obtain a set of all keys that have assosiated key listeners.

Note: The returned value must be treated as an immutable.

Returns:
a set of all keys that have assosiated key listeners

virtual Listeners::View getListeners ( Filter::View  vFilter  )  const [virtual]

Obtain the Listeners object for a given filter.

Parameters:
vFilter  the filter
Returns:
the Listeners object for the filter; NULL if none exists

virtual Listeners::View getListeners ( Object::View  vKey  )  const [virtual]

Obtain the Listeners object for a given key.

Parameters:
vKey  the key
Returns:
the Listeners object for the key; NULL if none exists

virtual Listeners::View collectListeners ( MapEvent::View  vEvent  )  [virtual]

Collect all Listeners that should be notified for a given event.

Note: The returned value must be treated as an immutable.

Parameters:
vEvent  the MapEvent object
Returns:
the Listeners object containing the relevant listeners

virtual void fireEvent ( MapEvent::Handle  hEvent,
bool  fStrict  
) [virtual]

Fire the specified map event.

Parameters:
hEvent  the map event
fStrict  if true then any RuntimeException thrown by event handlers stops all further event processing and the exception is re-thrown; if false then all exceptions are logged and the process continues

static MapEvent::Handle convertEvent ( MapEvent::View  vEvent,
ObservableMap::Handle  hmapConv,
Converter::View  vConvKey = NULL,
Converter::View  vConvVal = NULL  
) [static]

Convert the specified map event into another MapEvent that ensures the lazy event data conversion using the specified converters.

Parameters:
vEvent  the map event
hmapConv  the source for the converted event
vConvKey  (optional) the key Converter
vConvVal  (optional) the value converter
Returns:
the converted MapEvent object

static void addSafeListener ( Map::Handle  hmapListeners,
Object::View  vKey,
MapListener::Handle  hListener  
) [static, protected]

Ensure that the specified map has a Listeners object assosiated with the specified key and add the specified listener to it.

Parameters:
hmapListeners  map of listeners
vKey  key of the listener
hListener  the listener to add

static void removeSafeListener ( Map::Handle  hmapListeners,
Object::View  vKey,
MapListener::View  vListener  
) [static, protected]

Remove the specified listener from the Listeners object assosiated with the specified key.

Parameters:
hmapListeners  map of listeners
vKey  key of the listener
vListener  the listener to remove

static void addListenerState ( Map::Handle  hmapStandardListeners,
Object::View  vKey,
MapListener::Handle  hListener,
bool  fLite  
) [static, protected]

Add a state information (lite or standard) associated with specified key and listener.

Parameters:
hmapStandardListeners  map of standard listeners
vKey  key of the listener
hListener  the listener to add
fLite  true to indicate that the MapEvent objects do not have to include the OldValue and NewValue property values

static void removeListenerState ( Map::Handle  hmapStandardListeners,
Object::View  vKey,
MapListener::View  vListener  
) [static, protected]

Remove a state information (lite or standard) assosiated with specified key and listener.

Parameters:
hmapStandardListeners  map of standard listeners
vKey  key of the listener
vListener  the listener to remove

Member Data Documentation

MemberHandle<Map> m_hmapStandardListeners [protected]

The subset of standard (not lite) global listeners.

The keys are the Filter objects, the values are sets of corresponding standard listeners.

MemberHandle<Map> m_hmapStandardKeyListeners [protected]

The subset of standard (not lite) key listeners.

The keys are the key objects, the values are sets of corresponding standard listeners.


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