RSC  0.17.1
rsc::runtime::Printable Class Reference

A base class that defines utility functions for printing objects to streams. More...

#include <Printable.h>

Collaboration diagram for rsc::runtime::Printable:
Collaboration graph

Public Member Functions

virtual ~Printable ()
 
virtual std::string getClassName () const
 Implement this method and return a human-readable class name. More...
 
virtual void printContents (std::ostream &stream) const
 This method does the actual printing of class debug information and should be overridden in subclasses. More...
 
virtual void print (std::ostream &stream) const
 Constructs and prints the final debug output. More...
 

Detailed Description

A base class that defines utility functions for printing objects to streams.

The default output format is className[contents] where className is returned by getClassName and contents is printed by printContents. Moreover, if a pointer is printed, * is prepended to the name and at 0xXYZ is appended after the contents with the object's memory location.

In general it should be sufficient to override printContents but if you want to specify the whole output format, overriding print is needed.

It is advisable to always use virtual inheritance with this class to avoid problems with diamond-shaped inheritance later on.

Author
jwienke

Definition at line 60 of file Printable.h.

Constructor & Destructor Documentation

rsc::runtime::Printable::~Printable ( )
virtual

Definition at line 39 of file Printable.cpp.

Member Function Documentation

string rsc::runtime::Printable::getClassName ( ) const
virtual

Implement this method and return a human-readable class name.

This method should always return the same class name. Its existence is an admission to missing RTTI functionalities in C++.

Returns
human-readable name of the class.

Definition at line 42 of file Printable.cpp.

References rsc::runtime::typeName().

Here is the call graph for this function:

void rsc::runtime::Printable::print ( std::ostream &  stream) const
virtual

Constructs and prints the final debug output.

Parameters
streamstream to print on

Definition at line 50 of file Printable.cpp.

Referenced by rsc::runtime::operator<<().

Here is the caller graph for this function:

void rsc::runtime::Printable::printContents ( std::ostream &  stream) const
virtual

This method does the actual printing of class debug information and should be overridden in subclasses.

Parameters
streamstream to print on

Definition at line 46 of file Printable.cpp.


The documentation for this class was generated from the following files: