Puma Reference Manual Puma::Printable Class Reference



Puma::Printable Class Reference

Provides that possibility for an object to be used with output streams (std::ostream). More...

#include <Puma/Printable.h>

Inheritance diagram for Puma::Printable:
Inheritance graph

List of all members.

Public Member Functions

virtual ~Printable ()
 Destructor.
virtual void print (ostream &os) const =0
 Print something on the given output stream.

Detailed Description

Provides that possibility for an object to be used with output streams (std::ostream).

Derived classes have to implement method Printable::print().

Example:

class Name : public Puma::Printable {
const char* the_name;
public:
Name(const char* n) : the_name(n) {}
void print(ostream &os) {
os << "[name: " << the_name << "]";
}
};
Name adam("adam");
std::cout << adam << std::endl; // prints "[name: adam]\n"

Constructor & Destructor Documentation

virtual Puma::Printable::~Printable ( )
inlinevirtual

Destructor.


Member Function Documentation

virtual void Puma::Printable::print ( ostream &  os) const
pure virtual

Print something on the given output stream.

Parameters:
osThe output stream.

Implemented in Puma::CT_QualName, Puma::CT_SimpleName, Puma::CTypeInfo, Puma::ManipError, Puma::Unit, and Puma::Filename.




Puma Reference Manual. Created on Sat Jun 30 2012.