Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

MapEvent Class Reference

#include <coherence/util/MapEvent.hpp>

Inherits EventObject.

Inherited by CacheEvent, and ConverterCollections::ConverterMapEvent.

List of all members.


Detailed Description

An event which indicates that the content of a map has changed:. A MapEvent object is sent as an argument to the MapListener interface methods. NULL values may be provided for the old and the new values.
Author:
js 2008.06.03

Public Types

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

Public Member Functions

virtual TypedHandle
< ObservableMap
getMap () const
  Return an ObservableMap object on which this event has actually occured.
virtual int32_t  getId () const
  Return this event's id.
virtual Object::View  getKey () const
  Return a key associated with this event.
virtual Object::View  getOldValue () const
  Return an old value associated with this event.
virtual Object::View  getNewValue () const
  Return a new value associated with this 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

virtual void  dispatch (Listeners::View vListeners) const
  Dispatch this event to the specified listeners collection.
virtual void  dispatch (Listeners::View vListeners, bool fStrict) const
  Dispatch this event to the specified listeners collection.
virtual void  dispatch (TypedHandle< MapListener > hListener) const
  Dispatch this event to the specified MapListener.
virtual void  outputDescription (std::ostream &out) const
  Output a human-readable description of the state of this class in the form of a delimited list of name-value pairs.

Generally it is also advisable to start with a call to super::outputDescription(out)

The default implementation does not output anything to the stream.

Parameters:
out  the stream to output the description to


Static Public Member Functions

static String::View  getDescription (int32_t nId)
  Convert an event ID into a human-readable string.

Static Public Attributes

static const int32_t  ENTRY_INSERTED
  This event indicates that an entry has been added to the map.
static const int32_t  ENTRY_UPDATED
  This event indicates that an entry has been updated in the map.
static const int32_t  ENTRY_DELETED
  This event indicates that an entry has been removed from the map.

Protected Member Functions

  MapEvent (TypedHandle< ObservableMap > hMap, int32_t nId, Object::View vKey, Object::View vValueOld, Object::View vValueNew)
  Create a MapEvent.

Protected Attributes

int32_t  m_nId
  The event's id.
MemberView< Object m_voKey
  A key.
MemberView< Object m_voValueOld
  A previous value.
MemberView< Object m_voValueNew
  A new value.

Constructor & Destructor Documentation

MapEvent ( TypedHandle< ObservableMap hMap,
int32_t  nId,
Object::View  vKey,
Object::View  vValueOld,
Object::View  vValueNew  
) [protected]

Create a MapEvent.

Parameters:
hMap  the map on which the Event initially occurred
nId  the events id (ENTRY_INSERTED | ENTRY_UPDATED | ENTRY_DELETED)
vKey  the key into the map
vValueOld  the old value (for update and delete events)
vValueNew  the new value (for insert and update events)

Member Function Documentation

virtual TypedHandle<ObservableMap> getMap (  )  const [virtual]

Return an ObservableMap object on which this event has actually occured.

Returns:
an ObservableMap object

virtual int32_t getId (  )  const [virtual]

Return this event's id.

The event id is one of the ENTRY_* enumerated constants.

Returns:
an id

virtual Object::View getKey (  )  const [virtual]

Return a key associated with this event.

Returns:
a key

Reimplemented in ConverterCollections::ConverterCacheEvent, and ConverterCollections::ConverterMapEvent.

virtual Object::View getOldValue (  )  const [virtual]

Return an old value associated with this event.

The old value represents a value deleted from or updated in a map. It is always NULL for "insert" notifications.

Returns:
an old value

Reimplemented in ConverterCollections::ConverterCacheEvent, and ConverterCollections::ConverterMapEvent.

virtual Object::View getNewValue (  )  const [virtual]

Return a new value associated with this event.

The new value represents a new value inserted into or updated in a map. It is always NULL for "delete" notifications.

Returns:
a new value

Reimplemented in ConverterCollections::ConverterCacheEvent, and ConverterCollections::ConverterMapEvent.

virtual void dispatch ( Listeners::View  vListeners  )  const [virtual]

Dispatch this event to the specified listeners collection.

This call is equivalent to

   dispatch(listeners, true);
 
Parameters:
vListeners  the listeners collection
Exceptions:
ClassCastException  if any of the targets is not an instance of MapListener interface

virtual void dispatch ( Listeners::View  vListeners,
bool  fStrict  
) const [virtual]

Dispatch this event to the specified listeners collection.

Parameters:
vListeners  the listeners collection
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
Exceptions:
ClassCastException  if any of the targets is not an instance of MapListener interface

virtual void dispatch ( TypedHandle< MapListener hListener  )  const [virtual]

Dispatch this event to the specified MapListener.

Parameters:
hListener  the listener

static String::View getDescription ( int32_t  nId  )  [static]

Convert an event ID into a human-readable string.

Parameters:
nId  an event ID, one of the ENTRY_* enumerated values
Returns:
a corresponding human-readable string, for example "inserted"

Member Data Documentation

MemberView<Object> m_voKey [mutable, protected]

A key.

This is mutable because subclasses may lazily initialize this value from an accessor.

MemberView<Object> m_voValueOld [mutable, protected]

A previous value.

May be NULL if not known. This is mutable because subclasses may lazily initialize this value from an accessor.

MemberView<Object> m_voValueNew [mutable, protected]

A new value.

May be NULL if not known. This is mutable because subclasses may lazily initialize this value from an accessor.


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