mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-26 11:28:48 +03:00
move method body to cpp. Use unordered map
This commit is contained in:
parent
afc2942e37
commit
d2a6074b45
42
moses2/legacy/OutputCollector.cpp
Executable file
42
moses2/legacy/OutputCollector.cpp
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#include "OutputCollector.h"
|
||||||
|
|
||||||
|
namespace Moses2
|
||||||
|
{
|
||||||
|
OutputCollector::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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user