#include <tool.h>
Public Member Functions | |
virtual | ~Tool () |
const std::string & | name () const |
Get the name of the tool. | |
virtual int | Main (int argc, char *argv[])=0 |
Virtual main function to be provided by subclass. | |
Protected Member Functions | |
Tool (const std::string &name) | |
void | Warn (const std::string &) const |
Write a formatted warning message to standard error. | |
void | Error (const std::string &msg) const |
Write a formatted error message to standard error and call exit(1). | |
void | OpenInputFileOrDie (const std::string &, std::ifstream &) |
void | OpenOutputFileOrDie (const std::string &, std::ofstream &) |
void | OpenOutputFileOrDie (const std::string &, Moses::OutputFileStream &) |
Static Protected Member Functions | |
static int | MosesOptionStyle () |
Definition at line 13 of file tool.h.
virtual MosesTraining::Syntax::Tool::~Tool | ( | ) | [inline, virtual] |
MosesTraining::Syntax::Tool::Tool | ( | const std::string & | name | ) | [inline, protected] |
void MosesTraining::Syntax::Tool::Error | ( | const std::string & | msg | ) | const [protected] |
Write a formatted error message to standard error and call exit(1).
Definition at line 21 of file tool.cc.
Referenced by MosesTraining::Syntax::PostprocessEgretForests::PostprocessEgretForests::Main(), MosesTraining::Syntax::PCFG::PcfgScore::Main(), MosesTraining::Syntax::PCFG::PcfgExtract::Main(), MosesTraining::Syntax::FilterRuleTable::FilterRuleTable::Main(), MosesTraining::Syntax::GHKM::ExtractGHKM::Main(), OpenInputFileOrDie(), and OpenOutputFileOrDie().
virtual int MosesTraining::Syntax::Tool::Main | ( | int | argc, | |
char * | argv[] | |||
) | [pure virtual] |
Virtual main function to be provided by subclass.
Implemented in MosesTraining::Syntax::GHKM::ExtractGHKM, MosesTraining::Syntax::FilterRuleTable::FilterRuleTable, MosesTraining::Syntax::PCFG::PcfgExtract, MosesTraining::Syntax::PCFG::PcfgScore, MosesTraining::Syntax::PostprocessEgretForests::PostprocessEgretForests, and MosesTraining::Syntax::ScoreStsg::ScoreStsg.
int MosesTraining::Syntax::Tool::MosesOptionStyle | ( | ) | [static, protected] |
const std::string& MosesTraining::Syntax::Tool::name | ( | ) | const [inline] |
void MosesTraining::Syntax::Tool::OpenInputFileOrDie | ( | const std::string & | filename, | |
std::ifstream & | stream | |||
) | [protected] |
Opens the named input file using the supplied ifstream. Calls Error() if the file cannot be opened for reading.
Definition at line 26 of file tool.cc.
References Error().
Referenced by MosesTraining::Syntax::PostprocessEgretForests::PostprocessEgretForests::Main(), and MosesTraining::Syntax::PCFG::PcfgScore::Main().
void MosesTraining::Syntax::Tool::OpenOutputFileOrDie | ( | const std::string & | filename, | |
Moses::OutputFileStream & | stream | |||
) | [protected] |
Opens the named output file using the supplied OutputFileStream. Calls Error() if the file cannot be opened for writing.
Definition at line 46 of file tool.cc.
References Error(), and Moses::OutputFileStream::Open().
void MosesTraining::Syntax::Tool::OpenOutputFileOrDie | ( | const std::string & | filename, | |
std::ofstream & | stream | |||
) | [protected] |
Opens the named output file using the supplied ofstream. Calls Error() if the file cannot be opened for writing.
Definition at line 36 of file tool.cc.
References Error().
Referenced by MosesTraining::Syntax::ScoreStsg::ScoreStsg::Main(), and MosesTraining::Syntax::GHKM::ExtractGHKM::Main().
void MosesTraining::Syntax::Tool::Warn | ( | const std::string & | msg | ) | const [protected] |
Write a formatted warning message to standard error.
Definition at line 17 of file tool.cc.
Referenced by MosesTraining::Syntax::PCFG::PcfgScore::Main(), MosesTraining::Syntax::PCFG::PcfgExtract::Main(), and MosesTraining::Syntax::FilterRuleTable::FilterRuleTable::Main().