00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MERT_SCORE_DATA_ITERATOR_H_
00021 #define MERT_SCORE_DATA_ITERATOR_H_
00022
00023
00024
00025
00026 #include <vector>
00027
00028
00029 #include <boost/iterator/iterator_facade.hpp>
00030 #include <boost/shared_ptr.hpp>
00031
00032 #include "util/string_piece.hh"
00033
00034 #include "FeatureDataIterator.h"
00035
00036 namespace util
00037 {
00038 class FilePiece;
00039 }
00040
00041 namespace MosesTuning
00042 {
00043
00044
00045 typedef std::vector<float> ScoreDataItem;
00046
00047 class ScoreDataIterator :
00048 public boost::iterator_facade<ScoreDataIterator,
00049 const std::vector<ScoreDataItem>,
00050 boost::forward_traversal_tag>
00051 {
00052 public:
00053 ScoreDataIterator();
00054 explicit ScoreDataIterator(const std::string& filename);
00055
00056 ~ScoreDataIterator();
00057
00058 static ScoreDataIterator end() {
00059 return ScoreDataIterator();
00060 }
00061
00062 private:
00063 friend class boost::iterator_core_access;
00064
00065 void increment();
00066 bool equal(const ScoreDataIterator& rhs) const;
00067 const std::vector<ScoreDataItem>& dereference() const;
00068
00069 void readNext();
00070
00071 boost::shared_ptr<util::FilePiece> m_in;
00072 std::vector<ScoreDataItem> m_next;
00073 };
00074
00075 }
00076
00077
00078 #endif // MERT_SCORE_DATA_ITERATOR_H_