Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgGtpClient Class Reference

#include <SgGtpClient.h>

List of all members.

Detailed Description

Client connection to an external GTP engine.

Usage example:

    // Run GNU Go and send a GTP command
        SgProcess process("gnugo --mode gtp");
        SgGtpClient gtp(process.Input(), process.Output());
        string result = gtp.Send("version");
        SgDebug() << "Success response: " << result << '\n';
    catch (const SgGtpFailure& e)
        SgDebug() << "Error response: " << e.what() << '\n';
    catch (const SgException& e)
        SgDebug() << "Error running GNU Go: " << e.what() << '\n';

Definition at line 52 of file SgGtpClient.h.

Public Member Functions

 SgGtpClient (std::istream &in, std::ostream &out, bool verbose=false)
virtual ~SgGtpClient ()
std::string Send (const std::string &command)
 Send a command.

Private Attributes

bool m_verbose
std::istream & m_in
std::ostream & m_out

Constructor & Destructor Documentation

SgGtpClient::SgGtpClient ( std::istream &  in,
std::ostream &  out,
bool  verbose = false 


in Input stream.
out Output stream.
verbose Log stream to SgDebug()

Definition at line 24 of file SgGtpClient.cpp.

SgGtpClient::~SgGtpClient (  )  [virtual]

Definition at line 31 of file SgGtpClient.cpp.

Member Function Documentation

string SgGtpClient::Send ( const std::string &  command  ) 

Send a command.

The response if command succeeds (without status character and whitespace after status character)
SgGtpFailure If command fails or connection is broken.

Definition at line 35 of file SgGtpClient.cpp.

References m_in, m_out, m_verbose, and SgDebug().

Member Data Documentation

std::istream& SgGtpClient::m_in [private]

Definition at line 74 of file SgGtpClient.h.

Referenced by Send().

std::ostream& SgGtpClient::m_out [private]

Definition at line 76 of file SgGtpClient.h.

Referenced by Send().

bool SgGtpClient::m_verbose [private]

Definition at line 72 of file SgGtpClient.h.

Referenced by Send().

The documentation for this class was generated from the following files:

17 Jun 2010 Doxygen 1.4.7