Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

Describable Class Reference

#include <coherence/util/Describable.hpp>

Inherits Object.

Inherited by AbstractMap, EventObject, and AbstractProcessor.

List of all members.


Detailed Description

Abstract Object extension that simplifies the implementation of toStream() for class hierarchies.

Subclasses of Describable should implement the outputDescription() method by outputing a delimited list of name-value pair(s) representing the class' state. Further subclasses should override the outputDescription() by first delegating to the parent class' implementation and then outputing their own state.

For example, consider a class hiearchy consisting of parent class A and child class B. Class A should implement outputDescription() as follows:

 void A::outputDescription(std::ostream& out) const
     {
     super::outputDescription(out); // noop
     out << "Member1=" << m_hMember1 << ... << ", MemberN=" << m_hMemberN;
     }
 
Class B would then override this method as follows:
 void B::outputDescription(std::ostream& out) const
     {
     super::outputDescription(out);
     out << "MemberN+1=" << m_hMemberN1 << ... ;
     }
 
Author:
jh 2008.02.13

Public Types

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

Public Member Functions

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.
virtual String::View  getDescription () const
  Return a human-readable description of the state of this class in the form of a delimited list of name-value pairs.
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


Member Function Documentation

virtual void outputDescription ( std::ostream &  out  )  const [virtual]

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

Reimplemented in CacheEvent, EventObject, MapEvent, MapListenerSupport::FilterEvent, NumberIncrementor, and NumberMultiplier.

virtual String::View getDescription (  )  const [virtual]

Return a human-readable description of the state of this class in the form of a delimited list of name-value pairs.

The default implementation delegates to outputDescription


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