MosesTraining::Syntax::Tool Class Reference

#include <tool.h>

Inheritance diagram for MosesTraining::Syntax::Tool:

Inheritance graph
[legend]

List of all members.

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 ()


Detailed Description

Base class for command-line based tools.

Definition at line 13 of file tool.h.


Constructor & Destructor Documentation

virtual MosesTraining::Syntax::Tool::~Tool (  )  [inline, virtual]

Definition at line 15 of file tool.h.

MosesTraining::Syntax::Tool::Tool ( const std::string &  name  )  [inline, protected]

Definition at line 24 of file tool.h.


Member Function Documentation

void MosesTraining::Syntax::Tool::Error ( const std::string &  msg  )  const [protected]

virtual int MosesTraining::Syntax::Tool::Main ( int  argc,
char *  argv[] 
) [pure virtual]

int MosesTraining::Syntax::Tool::MosesOptionStyle (  )  [static, protected]

Returns a boost::program_options style that is consistent with other Moses tools (extract-rules, score, etc.).

Definition at line 12 of file tool.cc.

const std::string& MosesTraining::Syntax::Tool::name (  )  const [inline]

Get the name of the tool.

Definition at line 18 of file tool.h.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:


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

Generated on Thu Jul 6 00:34:09 2017 for Moses by  doxygen 1.5.9