print.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <iostream>
00035 #include <sstream>
00036
00037 namespace Gecode {
00038
00043 template<class Char, class Traits>
00044 std::basic_ostream<Char,Traits>&
00045 operator <<(std::basic_ostream<Char,Traits>& os,
00046 const ViewTraceInfo& vti) {
00047 std::basic_ostringstream<Char,Traits> s;
00048 s.copyfmt(os); s.width(0);
00049 switch (vti.what()) {
00050 case ViewTraceInfo::PROPAGATOR:
00051 s << "propagator(id:" << vti.propagator().id();
00052 if (vti.propagator().group().in())
00053 s << ",g:" << vti.propagator().group().id();
00054 s << ')';
00055 break;
00056 case ViewTraceInfo::BRANCHER:
00057 s << "brancher(id:" << vti.brancher().id();
00058 if (vti.brancher().group().in())
00059 s << ",g:" << vti.brancher().group().id();
00060 s << ')';
00061 break;
00062 case ViewTraceInfo::POST:
00063 s << "post(";
00064 if (vti.post().in())
00065 s << "g:" << vti.post().id();
00066 s << ')';
00067 break;
00068 case ViewTraceInfo::OTHER:
00069 s << '-';
00070 break;
00071 default:
00072 GECODE_NEVER;
00073 }
00074 return os << s.str();
00075 }
00076
00081 template<class Char, class Traits>
00082 std::basic_ostream<Char,Traits>&
00083 operator <<(std::basic_ostream<Char,Traits>& os,
00084 const PropagateTraceInfo& pti) {
00085 std::basic_ostringstream<Char,Traits> s;
00086 s.copyfmt(os); s.width(0);
00087 s << "propagate(id:" << pti.id();
00088 if (pti.group().in())
00089 s << ",g:" << pti.group().id();
00090 s << ",s:";
00091 switch (pti.status()) {
00092 case PropagateTraceInfo::FIX:
00093 s << "fix"; break;
00094 case PropagateTraceInfo::NOFIX:
00095 s << "nofix"; break;
00096 case PropagateTraceInfo::FAILED:
00097 s << "failed"; break;
00098 case PropagateTraceInfo::SUBSUMED:
00099 s << "subsumed"; break;
00100 default:
00101 GECODE_NEVER;
00102 }
00103 s << ')';
00104 return os << s.str();
00105 }
00106
00111 template<class Char, class Traits>
00112 std::basic_ostream<Char,Traits>&
00113 operator <<(std::basic_ostream<Char,Traits>& os,
00114 const CommitTraceInfo& cti) {
00115 std::basic_ostringstream<Char,Traits> s;
00116 s.copyfmt(os); s.width(0);
00117 s << "commit(id:" << cti.id();
00118 if (cti.group().in())
00119 s << ",g:" << cti.group().id();
00120 s << ')';
00121 return os << s.str();
00122 }
00123
00124 }
00125
00126