Belofte version 2.1.8
A promising chess program using the UCI or Winboard interface
engineInterface Class Reference

implementation of user interface More...

#include <belofte.h>

+ Inheritance diagram for engineInterface:

Public Member Functions

 engineInterface (std::string const &n, std::string const &h="")
 Common commands to all modes.
 
virtual ~engineInterface ()
 
 engineInterface (engineInterface const &)=delete
 
 engineInterface (engineInterface &&)=delete
 
engineInterfaceoperator= (engineInterface const &)=delete
 
engineInterfaceoperator= (engineInterface &&)=delete
 
 operator std::string () const &
 
void execute (std::string const &command, std::string const &params)
 
virtual void setRunning (bool const r)
 
virtual bool isRunning () const
 
virtual void sendPrompt ()
 
virtual void sendResponse (std::string const &response)
 
virtual void sendInvalidMove (std::string const &info, std::string const &reason)
 
virtual void sendError (std::string const &error, std::string const &description)
 
virtual void sendHelp (std::string const &args)
 Send help on command or all commands.
 
virtual void sendInfo (std::string const &info)
 
virtual void sendDebug (int const l, std::string const &info)
 
virtual void sendMove (bBoard &b, bMove const &m)
 
virtual void sendResult (bBoard const &b, gameResult_t rs) const
 
virtual void sendInfoDepth (int depth, int seldepth, int64_t nodes, int nps)
 
virtual void sendInfoScore (long long timems, bBoard const &b, bScore const cp)
 
virtual void sendInfoSearching (bBoard const &b, int const nLogDepth, depth_t const nMaxDepth, std::string const &comment, bScore const sc, int64_t const t, int64_t const nodes) const
 
virtual void sendInfoCurrMove (bBoard const &b, depth_t const nLogDepth, depth_t const nMaxDepth, std::string const &comment, bMove const &m, movenum_t const moveid, int64_t const nodes) const
 
std::string const & getHint () const
 

Static Public Attributes

static engineCommands_t m_engineCommands = decltype(engineInterface::m_engineCommands){}
 

Protected Member Functions

void attachCommand (belofte::stringList const &sCommands, bool const published=true)
 

Detailed Description

implementation of user interface

Definition at line 183 of file belofte.h.

Constructor & Destructor Documentation

◆ engineInterface() [1/3]

engineInterface::engineInterface ( std::string const &  n,
std::string const &  h = "" 
)
explicit

Common commands to all modes.

Definition at line 313 of file belofte.cpp.

◆ ~engineInterface()

engineInterface::~engineInterface ( )
virtual

Definition at line 343 of file belofte.cpp.

◆ engineInterface() [2/3]

engineInterface::engineInterface ( engineInterface const &  )
delete

◆ engineInterface() [3/3]

engineInterface::engineInterface ( engineInterface &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

engineInterface & engineInterface::operator= ( engineInterface const &  )
delete

◆ operator=() [2/2]

engineInterface & engineInterface::operator= ( engineInterface &&  )
delete

◆ operator std::string()

engineInterface::operator std::string ( ) const &
inline

Definition at line 194 of file belofte.h.

◆ execute()

void engineInterface::execute ( std::string const &  command,
std::string const &  params 
)

Definition at line 145 of file belofte.cpp.

Referenced by cmd_setoption::execute(), cmd_usermove::execute(), cmd_again::execute(), cmd_protover::execute(), cmd_option::execute(), main(), and commandReader::runner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRunning()

virtual void engineInterface::setRunning ( bool const  r)
inlinevirtual

Definition at line 198 of file belofte.h.

Referenced by bel_debug::execute(), cmd_go::execute(), cmd_new::execute(), cmd_playother::execute(), cmd_force::execute(), and sendResult().

+ Here is the caller graph for this function:

◆ isRunning()

virtual bool engineInterface::isRunning ( ) const
inlinevirtual

Reimplemented in UCIMode.

Definition at line 199 of file belofte.h.

◆ sendPrompt()

virtual void engineInterface::sendPrompt ( )
inlinevirtual

Reimplemented in BelofteMode.

Definition at line 201 of file belofte.h.

Referenced by commandReader::runner().

+ Here is the caller graph for this function:

◆ sendResponse()

void engineInterface::sendResponse ( std::string const &  response)
virtual

Definition at line 150 of file usercmd.cpp.

Referenced by cmd_echo::execute(), cmd_uci::execute(), cmd_isready::execute(), cmd_protover::execute(), and cmd_ping::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInvalidMove()

virtual void engineInterface::sendInvalidMove ( std::string const &  info,
std::string const &  reason 
)
inlinevirtual

Reimplemented in XboardMode.

Definition at line 203 of file belofte.h.

Referenced by cmd_position::execute(), and cmd_usermove::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendError()

void engineInterface::sendError ( std::string const &  error,
std::string const &  description 
)
virtual

◆ sendHelp()

void engineInterface::sendHelp ( std::string const &  args)
virtual

Send help on command or all commands.

Parameters
args–all means all commands, '' or a single command unsupported means all plus unsupported commands hidden means all plus hidden commands

Definition at line 100 of file usercmd.cpp.

Referenced by cmd_help::execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInfo()

virtual void engineInterface::sendInfo ( std::string const &  info)
inlinevirtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 208 of file belofte.h.

Referenced by bSearchAlgorithm::SearchBestMove().

+ Here is the caller graph for this function:

◆ sendDebug()

virtual void engineInterface::sendDebug ( int const  l,
std::string const &  info 
)
inlinevirtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 209 of file belofte.h.

Referenced by bSearchAlgorithm::dumpMoveList().

+ Here is the caller graph for this function:

◆ sendMove()

void engineInterface::sendMove ( bBoard b,
bMove const &  m 
)
virtual

Reimplemented in UCIMode.

Definition at line 345 of file usercmd.cpp.

Referenced by bGame::WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendResult()

void engineInterface::sendResult ( bBoard const &  b,
gameResult_t  rs 
) const
virtual

Definition at line 351 of file usercmd.cpp.

Referenced by cmd_usermove::execute(), and bGame::WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInfoDepth()

virtual void engineInterface::sendInfoDepth ( int  depth,
int seldepth  ,
int64_t  nodes,
int  nps 
)
inlinevirtual

Reimplemented in UCIMode.

Definition at line 213 of file belofte.h.

◆ sendInfoScore()

virtual void engineInterface::sendInfoScore ( long long timems  ,
bBoard const &  b,
bScore const  cp 
)
inlinevirtual

Reimplemented in UCIMode.

Definition at line 215 of file belofte.h.

Referenced by bSearchAlgorithm::sendInfoScore().

+ Here is the caller graph for this function:

◆ sendInfoSearching()

virtual void engineInterface::sendInfoSearching ( bBoard const &  b,
int const  nLogDepth,
depth_t const nMaxDepth  ,
std::string const &  comment,
bScore const  sc,
int64_t const  t,
int64_t const  nodes 
) const
inlinevirtual

Reimplemented in UCIMode, and XboardMode.

Definition at line 217 of file belofte.h.

Referenced by bSearchAlgorithm::sendInfoSearching().

+ Here is the caller graph for this function:

◆ sendInfoCurrMove()

virtual void engineInterface::sendInfoCurrMove ( bBoard const &  b,
depth_t const  nLogDepth,
depth_t const nMaxDepth  ,
std::string const &  comment,
bMove const &  m,
movenum_t const  moveid,
int64_t const  nodes 
) const
inlinevirtual

Reimplemented in UCIMode.

Definition at line 220 of file belofte.h.

Referenced by bSearchAlgorithm::sendInfoCurrMove().

+ Here is the caller graph for this function:

◆ getHint()

std::string const & engineInterface::getHint ( ) const
inline

Definition at line 225 of file belofte.h.

◆ attachCommand()

void engineInterface::attachCommand ( belofte::stringList const &  sCommands,
bool const  published = true 
)
protected

Definition at line 171 of file belofte.cpp.

Referenced by BelofteMode::BelofteMode(), UCIMode::UCIMode(), and XboardMode::XboardMode().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_engineCommands

engineCommands_t engineInterface::m_engineCommands = decltype(engineInterface::m_engineCommands){}
static

Definition at line 139 of file belofte.h.

Referenced by execute(), sendHelp(), and ~engineInterface().