Program for playing Hex. More...
#include <HexProgram.hpp>
Public Member Functions | |
| virtual void | Initialize (int argc, char **argv) |
| Parses cmd-line arguments, starts up Hex system, etc. | |
| virtual void | Shutdown () |
| Shuts down the program and the Hex system. | |
| void | SetInfo (std::string name, std::string version, std::string date) |
| Sets the name, version, etc, for this program. | |
| void | PrintStartupMessage () |
| Prints program information and some license details. | |
| std::string | getName () const |
| Returns the name of the program. | |
| std::string | getVersion () const |
| Returns the version string of the program. | |
| std::string | getBuild () const |
| Returns the build number of the program. | |
| std::string | getDate () const |
| Returns the build date of the program. | |
| int | BoardSize () const |
| Boardsize as parsed from the cmd-line options. | |
| std::string | ConfigFileToExecute () const |
| Returns the configuration file that should be parsed. | |
Static Public Member Functions | |
| static HexProgram & | Get () |
| Creates new HexProgram if non exists, or returns existing instance. | |
Protected Member Functions | |
| virtual void | RegisterCmdLineArguments () |
| Registers all command-line arguments. | |
| void | Usage () const |
| Prints all registered cmd-line arguments and their usage. | |
Protected Attributes | |
| std::string | m_name |
| std::string | m_version |
| std::string | m_date |
| std::string | m_executable_name |
| std::string | m_executable_path |
| bool | m_initialized |
| Cmd-line options. | |
| boost::program_options::options_description | m_options_desc |
| int | m_boardsize |
| int | m_random_seed |
| bool | m_use_logfile |
| std::string | m_logfile_name |
| std::string | m_logfile_level |
| std::string | m_config_file |
| LogLevel | m_stderr_level |
Private Member Functions | |
| HexProgram () | |
| Constructor. | |
| virtual | ~HexProgram () |
| Destructor. | |
| void | InitLog () |
| void | InitRandom () |
| void | InitializeHexSystem () |
| Start the Hex system. | |
| void | ProcessCmdLineArguments (int argc, char **argv) |
| void | ShutdownLog () |
Program for playing Hex.
Parses command-line arguments and initializes the Hex system.
Definition at line 24 of file HexProgram.hpp.
| HexProgram::HexProgram | ( | ) | [private] |
Constructor.
Definition at line 32 of file HexProgram.cpp.
| HexProgram::~HexProgram | ( | ) | [private, virtual] |
Destructor.
Definition at line 38 of file HexProgram.cpp.
| int HexProgram::BoardSize | ( | ) | const [inline] |
Boardsize as parsed from the cmd-line options.
Definition at line 137 of file HexProgram.hpp.
References m_boardsize.
Referenced by main().
| std::string HexProgram::ConfigFileToExecute | ( | ) | const [inline] |
Returns the configuration file that should be parsed.
This will be non-empty if the cmd-line option '--config' was parsed during the call to Initialize().
Definition at line 142 of file HexProgram.hpp.
References m_config_file.
Referenced by main().
| HexProgram & HexProgram::Get | ( | ) | [static] |
Creates new HexProgram if non exists, or returns existing instance.
Definition at line 42 of file HexProgram.cpp.
Referenced by HexAssertShutdown(), and main().
| std::string HexProgram::getBuild | ( | ) | const |
Returns the build number of the program.
| std::string HexProgram::getDate | ( | ) | const [inline] |
Returns the build date of the program.
Definition at line 132 of file HexProgram.hpp.
References m_date.
| std::string HexProgram::getName | ( | ) | const [inline] |
| std::string HexProgram::getVersion | ( | ) | const [inline] |
Returns the version string of the program.
Definition at line 127 of file HexProgram.hpp.
References m_version.
| void HexProgram::Initialize | ( | int | argc, | |
| char ** | argv | |||
| ) | [virtual] |
Parses cmd-line arguments, starts up Hex system, etc.
Does nothing if called a second time.
Definition at line 140 of file HexProgram.cpp.
References InitializeHexSystem(), m_executable_name, m_executable_path, m_initialized, ProcessCmdLineArguments(), and RegisterCmdLineArguments().
Referenced by InitializeHexSystem(), and main().
| void HexProgram::InitializeHexSystem | ( | ) | [private] |
Start the Hex system.
Definition at line 128 of file HexProgram.cpp.
References HexProp::Init(), Initialize(), BoardUtils::InitializeDecompositions(), InitLog(), InitRandom(), LogConfig(), m_date, m_name, and m_version.
Referenced by Initialize().
| void HexProgram::InitLog | ( | ) | [private] |
Definition at line 97 of file HexProgram.cpp.
References Logger::AddStream(), Logger::ClearStreams(), HexColorSetUtil::fromString(), Logger::Global(), LogWarning(), m_logfile_level, m_logfile_name, m_stderr_level, and m_use_logfile.
Referenced by InitializeHexSystem().
| void HexProgram::InitRandom | ( | ) | [private] |
Definition at line 118 of file HexProgram.cpp.
References LogConfig(), and m_random_seed.
Referenced by InitializeHexSystem().
| void HexProgram::PrintStartupMessage | ( | ) |
| void HexProgram::ProcessCmdLineArguments | ( | int | argc, | |
| char ** | argv | |||
| ) | [private] |
Definition at line 187 of file HexProgram.cpp.
References LOG_LEVEL_ALL, LOG_LEVEL_INFO, LOG_LEVEL_OFF, m_date, m_name, m_options_desc, m_stderr_level, m_version, Shutdown(), and Usage().
Referenced by Initialize().
| void HexProgram::RegisterCmdLineArguments | ( | ) | [protected, virtual] |
Registers all command-line arguments.
Definition at line 68 of file HexProgram.cpp.
References m_boardsize, m_config_file, m_logfile_level, m_logfile_name, m_options_desc, m_random_seed, and m_use_logfile.
Referenced by Initialize().
| void HexProgram::SetInfo | ( | std::string | name, | |
| std::string | version, | |||
| std::string | date | |||
| ) |
| void HexProgram::Shutdown | ( | ) | [virtual] |
Shuts down the program and the Hex system.
Definition at line 179 of file HexProgram.cpp.
References LogConfig(), and ShutdownLog().
Referenced by HexAssertShutdown(), main(), and ProcessCmdLineArguments().
| void HexProgram::ShutdownLog | ( | ) | [private] |
Definition at line 168 of file HexProgram.cpp.
References Logger::Flush(), and Logger::Global().
Referenced by Shutdown().
| void HexProgram::Usage | ( | ) | const [protected] |
Prints all registered cmd-line arguments and their usage.
Definition at line 226 of file HexProgram.cpp.
References m_executable_name, and m_options_desc.
Referenced by ProcessCmdLineArguments().
int HexProgram::m_boardsize [protected] |
Definition at line 92 of file HexProgram.hpp.
Referenced by BoardSize(), and RegisterCmdLineArguments().
std::string HexProgram::m_config_file [protected] |
Definition at line 97 of file HexProgram.hpp.
Referenced by ConfigFileToExecute(), and RegisterCmdLineArguments().
std::string HexProgram::m_date [protected] |
Definition at line 83 of file HexProgram.hpp.
Referenced by getDate(), InitializeHexSystem(), PrintStartupMessage(), ProcessCmdLineArguments(), and SetInfo().
std::string HexProgram::m_executable_name [protected] |
Definition at line 85 of file HexProgram.hpp.
Referenced by Initialize(), and Usage().
std::string HexProgram::m_executable_path [protected] |
Definition at line 86 of file HexProgram.hpp.
Referenced by Initialize().
bool HexProgram::m_initialized [protected] |
std::string HexProgram::m_logfile_level [protected] |
Definition at line 96 of file HexProgram.hpp.
Referenced by InitLog(), and RegisterCmdLineArguments().
std::string HexProgram::m_logfile_name [protected] |
Definition at line 95 of file HexProgram.hpp.
Referenced by InitLog(), and RegisterCmdLineArguments().
std::string HexProgram::m_name [protected] |
Definition at line 81 of file HexProgram.hpp.
Referenced by getName(), InitializeHexSystem(), PrintStartupMessage(), ProcessCmdLineArguments(), and SetInfo().
boost::program_options::options_description HexProgram::m_options_desc [protected] |
Definition at line 90 of file HexProgram.hpp.
Referenced by ProcessCmdLineArguments(), RegisterCmdLineArguments(), and Usage().
int HexProgram::m_random_seed [protected] |
Definition at line 93 of file HexProgram.hpp.
Referenced by InitRandom(), and RegisterCmdLineArguments().
LogLevel HexProgram::m_stderr_level [protected] |
Definition at line 98 of file HexProgram.hpp.
Referenced by InitLog(), and ProcessCmdLineArguments().
bool HexProgram::m_use_logfile [protected] |
Definition at line 94 of file HexProgram.hpp.
Referenced by InitLog(), and RegisterCmdLineArguments().
std::string HexProgram::m_version [protected] |
Definition at line 82 of file HexProgram.hpp.
Referenced by getVersion(), InitializeHexSystem(), PrintStartupMessage(), ProcessCmdLineArguments(), and SetInfo().