#include <coherence/util/Describable.hpp>
Inherits Object.
Inherited by AbstractMap, EventObject, MapEventFilter, and AbstractProcessor.
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 << ... ; }
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);
|
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.
out | the stream to output the description to |
Reimplemented in CacheEvent, EventObject, CacheEventFilter, MapEventFilter, 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