print.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2016
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include <iostream>
#include <sstream>
namespace Gecode {
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os,
const ViewTraceInfo& vti) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
switch (vti.what()) {
case ViewTraceInfo::PROPAGATOR:
s << "propagator(id:" << vti.propagator().id();
if (vti.propagator().group().in())
s << ",g:" << vti.propagator().group().id();
s << ')';
break;
case ViewTraceInfo::BRANCHER:
s << "brancher(id:" << vti.brancher().id();
if (vti.brancher().group().in())
s << ",g:" << vti.brancher().group().id();
s << ')';
break;
case ViewTraceInfo::POST:
s << "post(";
if (vti.post().in())
s << "g:" << vti.post().id();
s << ')';
break;
case ViewTraceInfo::OTHER:
s << '-';
break;
default:
GECODE_NEVER;
}
return os << s.str();
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os,
const PropagateTraceInfo& pti) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << "propagate(id:" << pti.id();
if (pti.group().in())
s << ",g:" << pti.group().id();
s << ",s:";
switch (pti.status()) {
case PropagateTraceInfo::FIX:
s << "fix"; break;
case PropagateTraceInfo::NOFIX:
s << "nofix"; break;
case PropagateTraceInfo::FAILED:
s << "failed"; break;
case PropagateTraceInfo::SUBSUMED:
s << "subsumed"; break;
default:
GECODE_NEVER;
}
s << ')';
return os << s.str();
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os,
const CommitTraceInfo& cti) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << "commit(id:" << cti.id();
if (cti.group().in())
s << ",g:" << cti.group().id();
s << ')';
return os << s.str();
}
template<class Char, class Traits>
std::basic_ostream<Char,Traits>&
operator <<(std::basic_ostream<Char,Traits>& os,
const PostTraceInfo& pti) {
std::basic_ostringstream<Char,Traits> s;
s.copyfmt(os); s.width(0);
s << "post(";
if (pti.group().in())
s << "g:" << pti.group().id() << ",";
s << "s:";
switch (pti.status()) {
case PostTraceInfo::POSTED:
s << "posted(" << pti.propagators() << ")"; break;
case PostTraceInfo::FAILED:
s << "failed"; break;
case PostTraceInfo::SUBSUMED:
s << "subsumed"; break;
default:
GECODE_NEVER;
}
s << ')';
return os << s.str();
}
}
// STATISTICS: kernel-trace
Gecode::CommitTraceInfo
Commit trace information.
Definition core.hpp:1005
Gecode::CommitTraceInfo::group
BrancherGroup group(void) const
Return brancher group.
Definition core.hpp:3412
Gecode::CommitTraceInfo::id
unsigned int id(void) const
Return brancher identifier.
Definition core.hpp:3408
Gecode::Group::id
unsigned int id(void) const
Return a unique id for the group.
Definition core.hpp:4974
Gecode::Group::in
bool in(Group a) const
Check whether actor group a is included in this group.
Definition core.hpp:4956
Gecode::PostTraceInfo
Post trace information.
Definition core.hpp:1032
Gecode::PostTraceInfo::propagators
unsigned int propagators(void) const
Return number of posted propagators.
Definition core.hpp:3445
Gecode::PostTraceInfo::group
PropagatorGroup group(void) const
Return propagator group.
Definition core.hpp:3437
Gecode::PostTraceInfo::SUBSUMED
@ SUBSUMED
Propagator not posted as already subsumed.
Definition core.hpp:1040
Gecode::PostTraceInfo::FAILED
@ FAILED
Posting failed.
Definition core.hpp:1039
Gecode::PostTraceInfo::POSTED
@ POSTED
Propagator was posted.
Definition core.hpp:1038
Gecode::PostTraceInfo::status
Status status(void) const
Return post status.
Definition core.hpp:3441
Gecode::PropagateTraceInfo
Propagate trace information.
Definition core.hpp:969
Gecode::PropagateTraceInfo::SUBSUMED
@ SUBSUMED
Propagator is subsumed.
Definition core.hpp:977
Gecode::PropagateTraceInfo::FIX
@ FIX
Propagator computed fixpoint.
Definition core.hpp:974
Gecode::PropagateTraceInfo::NOFIX
@ NOFIX
Propagator did not compute fixpoint.
Definition core.hpp:975
Gecode::PropagateTraceInfo::FAILED
@ FAILED
Propagator failed.
Definition core.hpp:976
Gecode::PropagateTraceInfo::id
unsigned int id(void) const
Return propagator identifier.
Definition core.hpp:3382
Gecode::PropagateTraceInfo::status
Status status(void) const
Return propagator status.
Definition core.hpp:3394
Gecode::PropagateTraceInfo::group
PropagatorGroup group(void) const
Return propagator group.
Definition core.hpp:3386
Gecode::ViewTraceInfo
View trace information.
Definition core.hpp:908
Gecode::ViewTraceInfo::what
What what(void) const
Return what is currently executing.
Definition core.hpp:3332
Gecode::ViewTraceInfo::brancher
void brancher(Brancher &b)
Record that brancher b is executing.
Definition core.hpp:3320
Gecode::ViewTraceInfo::BRANCHER
@ BRANCHER
A brancher is executing.
Definition core.hpp:917
Gecode::ViewTraceInfo::OTHER
@ OTHER
Unknown.
Definition core.hpp:921
Gecode::ViewTraceInfo::POST
@ POST
A post function is executing.
Definition core.hpp:919
Gecode::ViewTraceInfo::PROPAGATOR
@ PROPAGATOR
A propagator is currently executing.
Definition core.hpp:915
Gecode::ViewTraceInfo::propagator
void propagator(Propagator &p)
Record that propagator p is executing.
Definition core.hpp:3316
Gecode::ViewTraceInfo::post
void post(PropagatorGroup g)
Record that a post function with propagator group g is executing.
Definition core.hpp:3324
Gecode
Gecode toplevel namespace
Gecode::operator<<
Archive & operator<<(Archive &e, FloatNumBranch nl)
Definition val-sel.hpp:39
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56