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