00001 //---------------------------------------------------------------------------- 00002 /** @file GtpInputStream.cpp */ 00003 //---------------------------------------------------------------------------- 00004 00005 #include "GtpInputStream.h" 00006 00007 using namespace std; 00008 00009 //---------------------------------------------------------------------------- 00010 00011 GtpInputStream::GtpInputStream(istream &in) 00012 : m_in(in) 00013 { 00014 // Tying of input to output stream (like used by std::cin/cout) is not 00015 // needed by GtpEngine and potentially harmful if threads are enabled 00016 // (see GTPENGINE_PONDER) and the standard library implementation does not 00017 // support simultaneous writes to output stream by multiple threads 00018 m_in.tie(0); 00019 } 00020 00021 GtpInputStream::~GtpInputStream() 00022 { 00023 } 00024 00025 bool GtpInputStream::EndOfInput() 00026 { 00027 return m_in.fail(); 00028 } 00029 00030 bool GtpInputStream::GetLine(string &line) 00031 { 00032 return ! getline(m_in, line).fail(); 00033 } 00034 00035 //----------------------------------------------------------------------------