Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Tool.h « compact-rule-table « training « scripts - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4a7e1e0e1302925ffb0a949e1235f04e4e96543b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#ifndef TOOL_H_
#define TOOL_H_

#include <cstdlib>
#include <iostream>
#include <string>

namespace moses {

class Tool {
 public:
  Tool(const std::string &name) : m_name(name) {}

  const std::string &getName() const { return m_name; }

  virtual int main(int argc, char *argv[]) = 0;

  void warn(const std::string &msg) const {
    std::cerr << m_name << ": warning: " << msg << std::endl;
  }

  void error(const std::string &msg) const {
    std::cerr << m_name << ": error: " << msg << std::endl;
    std::exit(1);
  }

 private:
  std::string m_name;
};

}  // namespace moses

#endif