00001 // -*- c++ -*- 00002 //***************************************************************************** 00027 //***************************************************************************** 00028 // include standard stream capabilities 00029 #include <iostream> 00030 00031 // include basic definitions 00032 #include "pbori_defs.h" 00033 00034 #ifndef CPrint_Operation_h_ 00035 #define CPrint_Operation_h_ 00036 00037 BEGIN_NAMESPACE_PBORI 00038 00042 template <class ValueType, class LiteralType, class StreamType = std::ostream> 00043 class CPrintOperation { 00044 public: 00045 00047 typedef StreamType stream_type; 00048 00050 typedef ValueType value_type; 00051 00053 typedef LiteralType literal_type; 00054 00056 CPrintOperation(stream_type& os_): os(os_){} 00057 00059 value_type& operator()(value_type& val, ...) const { 00060 os << literal_type()(); 00061 return val; 00062 } 00064 const value_type& operator()(const value_type& val, ...) const { 00065 os << literal_type()(); 00066 return val; 00067 } 00068 protected: 00069 std::ostream& os; 00070 }; 00071 00072 00073 00074 END_NAMESPACE_PBORI 00075 00076 #endif