diff options
author | MosesAdmin <moses-support-owner@mit.edu> | 2015-08-08 02:00:45 +0300 |
---|---|---|
committer | MosesAdmin <moses-support-owner@mit.edu> | 2015-08-08 02:00:45 +0300 |
commit | 21aa5af640946c0f00c717a0774d05441a4b6902 (patch) | |
tree | 263d9827fd439e6c909b771821776e40151b7fc8 /moses/OutputCollector.h | |
parent | 883c34aee9266cce72f9a8851e863cb4b910c718 (diff) |
daily automatic beautifier
Diffstat (limited to 'moses/OutputCollector.h')
-rw-r--r-- | moses/OutputCollector.h | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/moses/OutputCollector.h b/moses/OutputCollector.h index d66c16f20..0d6f37472 100644 --- a/moses/OutputCollector.h +++ b/moses/OutputCollector.h @@ -43,8 +43,8 @@ namespace Moses class OutputCollector { public: - OutputCollector(std::ostream* outStream= &std::cout, - std::ostream* debugStream=&std::cerr) + OutputCollector(std::ostream* outStream= &std::cout, + std::ostream* debugStream=&std::cerr) : m_nextOutput(0) , m_outStream(outStream) , m_debugStream(debugStream) @@ -52,37 +52,36 @@ public: , m_isHoldingDebugStream(false) {} OutputCollector(std::string xout, std::string xerr = "") - : m_nextOutput(0) - { - // TO DO open magic streams instead of regular ofstreams! [UG] - - if (xout == "/dev/stderr") { - m_outStream = &std::cerr; - m_isHoldingOutputStream = false; - } else if (xout.size() && xout != "/dev/stdout" && xout != "-") { - m_outStream = new std::ofstream(xout.c_str()); - UTIL_THROW_IF2(!m_outStream->good(), "Failed to open output file" - << xout); - m_isHoldingOutputStream = true; - } else { - m_outStream = &std::cout; - m_isHoldingOutputStream = false; - } - - if (xerr == "/dev/stdout") { - m_debugStream = &std::cout; - m_isHoldingDebugStream = false; - } else if (xerr.size() && xerr != "/dev/stderr") { - m_debugStream = new std::ofstream(xerr.c_str()); - UTIL_THROW_IF2(!m_debugStream->good(), "Failed to open debug stream" - << xerr); - m_isHoldingDebugStream = true; - } else { - m_debugStream = &std::cerr; - m_isHoldingDebugStream = false; - } + : m_nextOutput(0) { + // TO DO open magic streams instead of regular ofstreams! [UG] + + if (xout == "/dev/stderr") { + m_outStream = &std::cerr; + m_isHoldingOutputStream = false; + } else if (xout.size() && xout != "/dev/stdout" && xout != "-") { + m_outStream = new std::ofstream(xout.c_str()); + UTIL_THROW_IF2(!m_outStream->good(), "Failed to open output file" + << xout); + m_isHoldingOutputStream = true; + } else { + m_outStream = &std::cout; + m_isHoldingOutputStream = false; } + if (xerr == "/dev/stdout") { + m_debugStream = &std::cout; + m_isHoldingDebugStream = false; + } else if (xerr.size() && xerr != "/dev/stderr") { + m_debugStream = new std::ofstream(xerr.c_str()); + UTIL_THROW_IF2(!m_debugStream->good(), "Failed to open debug stream" + << xerr); + m_isHoldingDebugStream = true; + } else { + m_debugStream = &std::cerr; + m_isHoldingDebugStream = false; + } + } + ~OutputCollector() { if (m_isHoldingOutputStream) delete m_outStream; |