Generated on Tue Jan 19 2021 06:15:49 for Gecode by doxygen 1.8.13
print.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Copyright:
7  * Christian Schulte, 2016
8  *
9  * This file is part of Gecode, the generic constraint
10  * development environment:
11  * http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 #include <iostream>
35 #include <sstream>
36 
37 namespace Gecode {
38 
43  template<class Char, class Traits>
44  std::basic_ostream<Char,Traits>&
45  operator <<(std::basic_ostream<Char,Traits>& os,
46  const ViewTraceInfo& vti) {
47  std::basic_ostringstream<Char,Traits> s;
48  s.copyfmt(os); s.width(0);
49  switch (vti.what()) {
51  s << "propagator(id:" << vti.propagator().id();
52  if (vti.propagator().group().in())
53  s << ",g:" << vti.propagator().group().id();
54  s << ')';
55  break;
57  s << "brancher(id:" << vti.brancher().id();
58  if (vti.brancher().group().in())
59  s << ",g:" << vti.brancher().group().id();
60  s << ')';
61  break;
63  s << "post(";
64  if (vti.post().in())
65  s << "g:" << vti.post().id();
66  s << ')';
67  break;
69  s << '-';
70  break;
71  default:
73  }
74  return os << s.str();
75  }
76 
81  template<class Char, class Traits>
82  std::basic_ostream<Char,Traits>&
83  operator <<(std::basic_ostream<Char,Traits>& os,
84  const PropagateTraceInfo& pti) {
85  std::basic_ostringstream<Char,Traits> s;
86  s.copyfmt(os); s.width(0);
87  s << "propagate(id:" << pti.id();
88  if (pti.group().in())
89  s << ",g:" << pti.group().id();
90  s << ",s:";
91  switch (pti.status()) {
93  s << "fix"; break;
95  s << "nofix"; break;
97  s << "failed"; break;
99  s << "subsumed"; break;
100  default:
101  GECODE_NEVER;
102  }
103  s << ')';
104  return os << s.str();
105  }
106 
111  template<class Char, class Traits>
112  std::basic_ostream<Char,Traits>&
113  operator <<(std::basic_ostream<Char,Traits>& os,
114  const CommitTraceInfo& cti) {
115  std::basic_ostringstream<Char,Traits> s;
116  s.copyfmt(os); s.width(0);
117  s << "commit(id:" << cti.id();
118  if (cti.group().in())
119  s << ",g:" << cti.group().id();
120  s << ')';
121  return os << s.str();
122  }
123 
124 }
125 
126 // STATISTICS: kernel-trace
View trace information.
Definition: core.hpp:905
A propagator is currently executing.
Definition: core.hpp:912
Propagator failed.
Definition: core.hpp:966
A post function is executing.
Definition: core.hpp:916
Commit trace information.
Definition: core.hpp:995
Propagator computed fixpoint.
Definition: core.hpp:964
Propagate trace information.
Definition: core.hpp:959
Propagator did not compute fixpoint.
Definition: core.hpp:965
unsigned int id(void) const
Return brancher identifier.
Definition: core.hpp:3356
unsigned int id(void) const
Return propagator identifier.
Definition: core.hpp:3330
Gecode toplevel namespace
Propagator is subsumed.
Definition: core.hpp:967
A brancher is executing.
Definition: core.hpp:914
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:56