Commit 5a635461 authored by Damien Leroux's avatar Damien Leroux
Browse files

It works. The generalized table product.

parent c61cd7f0
......@@ -111,6 +111,8 @@ struct ostream_manager {
, prefix_insert_mode(false)
, prefix_ss()
{}
void rdbuf(std::streambuf* rb) { dest = rb; }
};
class ForbidOutput : public std::streambuf {
......@@ -153,6 +155,22 @@ struct ostream_manager {
std::cerr.rdbuf(old_cerr_rdbuf);
#endif
}
void
redirect(std::ostream& os)
{
hi.rdbuf(os.rdbuf());
cerr.rdbuf(os.rdbuf());
cout.rdbuf(os.rdbuf());
}
void
restore()
{
hi.rdbuf(old_clog_rdbuf);
cerr.rdbuf(old_cerr_rdbuf);
cout.rdbuf(old_cout_rdbuf);
}
};
struct message_queue : public ostream_manager {
......@@ -291,6 +309,9 @@ struct msg_handler_t {
static bool& quiet() { return instance().quiet; }
static lock_type mutex;
static void redirect(std::ostream& os) { instance().queue.redirect(os); }
static void restore() { instance().queue.restore(); }
};
inline
......
......@@ -76,5 +76,5 @@ test_graph: test_graph.cc ../static_data.o ../../include/bayes/graphnode.h
$C -O0 -ggdb $< ../static_data.o -o $@
generalized_product: generalized_product.cc
$C -O0 -ggdb $< -o $@.debug
$C -pg -O0 -ggdb $< -o $@.debug
$C $< -o $@
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment