Printable.hpp

Go to the documentation of this file.
00001 #ifndef wali_PRINTABLE_GUARD
00002 #define wali_PRINTABLE_GUARD 1
00003 
00004 /*
00005  * @author Nicholas Kidd
00006  */
00007 
00008 #include <string>
00009 #include <iostream>
00010 
00011 namespace wali
00012 {
00013 
00014   /*!
00015    * @class Printable
00016    * @brief Interface defining the print method
00017    *
00018    * A Printable object must define a print method.
00019    *
00020    * The Printable class provides toString() methods
00021    * for any Printable object by passing a std::ostringstream
00022    * to the object's print method.
00023    */
00024   class Printable
00025   {
00026     public:
00027 
00028       virtual ~Printable() {}
00029 
00030       virtual std::ostream & print( std::ostream & ) const = 0;
00031 
00032       std::string to_string() const;
00033 
00034       std::string toString() const;
00035 
00036   }; // class Printable
00037 
00038 } // namespace wali
00039 
00040 #endif  // wali_PRINTABLE_GUARD
00041