#include <coherence/util/MapListenerSupport.hpp>
Inherits Object.
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);
|
||||
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... |
||||
| virtual void addListener | ( | MapListener::Handle | hListener, | |
| Filter::View | vFilter, | |||
| bool | fLite | |||
| ) | [virtual] |
Add a map listener that receives events based on a filter evaluation.
| 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.
| 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] |
| virtual void removeListener | ( | MapListener::View | vListener, | |
| Object::View | vKey | |||
| ) | [virtual] |
Remove a map listener that previously signed up for events about a specific key.
| 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.
| virtual bool isEmpty | ( | Filter::View | vFilter | ) | const [virtual] |
Checks whether or not this MapListenerSupport object contains any listeners for a given filter.
| vFilter | the filter |
| virtual bool isEmpty | ( | Object::View | vKey | ) | const [virtual] |
Checks whether or not this MapListenerSupport object contains any listeners for a given key.
| vKey | the key |
| 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.
| vFilter | the filter |
| 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.
| vKey | the key |
| 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.
| 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.
| virtual Listeners::View getListeners | ( | Filter::View | vFilter | ) | const [virtual] |
| virtual Listeners::View getListeners | ( | Object::View | vKey | ) | const [virtual] |
| virtual Listeners::View collectListeners | ( | MapEvent::View | vEvent | ) | [virtual] |
| virtual void fireEvent | ( | MapEvent::Handle | hEvent, | |
| bool | fStrict | |||
| ) | [virtual] |
Fire the specified map event.
| 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.
| vEvent | the map event | |
| hmapConv | the source for the converted event | |
| vConvKey | (optional) the key Converter | |
| vConvVal | (optional) the value converter |
| 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.
| 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.
| 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.
| 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.
| hmapStandardListeners | map of standard listeners | |
| vKey | key of the listener | |
| vListener | the listener to remove |
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.