Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GtpEngine.h File Reference


Detailed Description

Basic implementation of the Go Text Protocol (GTP).

Depends only on the standard C++ library for maximum reusability. If ponder or interrupt functionality is enabled by setting the macros GTPENGINE_PONDER and/or GTPENGINE_INTERRUPT to 1, the Boost.Thread library is also needed.

GtpEngine implements a GTP engine with some basic commands. This class is typically used as a base class for other GTP engines. GtpEngine::Register allows to register additional commands. GtpEngine::MainLoop starts the main command loop. Command handlers implement the interface GtpCallbackBase. For class member functions, such a callback can be constructed with the GtpCallback template class. Each callback function is passed a GtpCommand argument, which can be queried for arguments and used for writing the response to. GTP error responses are created by throwing an instance of GtpFailure. All such exceptions are caught in the main loop and converted into a response with error status.

Definition in file GtpEngine.h.

#include <cstddef>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include "GtpInputStream.h"
#include "GtpOutputStream.h"

Go to the source code of this file.

Classes

class  GtpFailure
 GTP failure. More...
class  GtpCommand
 GTP command. More...
struct  GtpCommand::Argument
 Argument in command line. More...
class  GtpCallbackBase
 Abstract base class for command handlers. More...
class  GtpCallback
 Member function command handlers. More...
class  GtpEngine
 Base class for GTP (Go Text Protocol) engines. More...

Defines

#define GTPENGINE_PONDER   1
 Macro for enabling pondering.
#define GTPENGINE_INTERRUPT   1
 Macro for enabling interrupt ability.


Define Documentation

#define GTPENGINE_INTERRUPT   1

Macro for enabling interrupt ability.

If this macro is enabled, GtpEngine has the additional function Interrupt() to interrupt a running command. Enabling this macro adds a dependency on the Boost.Thread library.

See also:
GtpEngine::Interrupt()

Definition at line 57 of file GtpEngine.h.

#define GTPENGINE_PONDER   1

Macro for enabling pondering.

If this macro is enabled, GtpEngine has the additional functions Ponder(), InitPonder() and StopPonder(), which will be called while waiting for the next command. This can be used for thinking during the opponent's time. Enabling this macro adds a dependency on the Boost.Thread library.

See also:
GtpEngine::Ponder()

Definition at line 47 of file GtpEngine.h.


17 Jun 2010 Doxygen 1.4.7