PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::Printable Class Referenceabstract

#include <Puma/Printable.h>

+ Inheritance diagram for Puma::Printable:

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"
Provides that possibility for an object to be used with output streams (std::ostream).
Definition Printable.h:49

Public Member Functions

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

Constructor & Destructor Documentation

◆ ~Printable()

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

Destructor.

Member Function Documentation

◆ print()

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

Print object information on the given output stream.

To be implemented by concrete objects.

Parameters
osThe output stream.

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