00001 #pragma once 00002 00003 #include <istream> 00004 #include <string> 00005 #include <vector> 00006 00007 #include "SplitPoint.h" 00008 00009 namespace MosesTraining 00010 { 00011 namespace Syntax 00012 { 00013 namespace PostprocessEgretForests 00014 { 00015 00016 class SplitPointFileParser 00017 { 00018 public: 00019 struct Entry { 00020 std::vector<SplitPoint> splitPoints; 00021 }; 00022 00023 SplitPointFileParser(); 00024 SplitPointFileParser(std::istream &); 00025 00026 const Entry &operator*() const { 00027 return m_entry; 00028 } 00029 const Entry *operator->() const { 00030 return &m_entry; 00031 } 00032 00033 SplitPointFileParser &operator++(); 00034 00035 friend bool operator==(const SplitPointFileParser &, 00036 const SplitPointFileParser &); 00037 00038 friend bool operator!=(const SplitPointFileParser &, 00039 const SplitPointFileParser &); 00040 00041 private: 00042 void ParseLine(const std::string &, std::vector<SplitPoint> &); 00043 00044 Entry m_entry; 00045 std::istream *m_input; 00046 std::string m_tmpLine; 00047 }; 00048 00049 } // namespace PostprocessEgretForests 00050 } // namespace Syntax 00051 } // namespace MosesTraining