diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-29 21:16:15 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-29 21:16:15 +0400 |
commit | 6249432407af8730c10bccc7894c0725fcaf5e47 (patch) | |
tree | 3ac1f094b9fdc199b04bc5ef209ce00e3596e37d /mert/FeatureDataIterator.h | |
parent | 59bd7deb4b6b9c4f7b3b7dbb055783528fbc31ca (diff) |
beautify
Diffstat (limited to 'mert/FeatureDataIterator.h')
-rw-r--r-- | mert/FeatureDataIterator.h | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/mert/FeatureDataIterator.h b/mert/FeatureDataIterator.h index 8bbb8d497..15a654182 100644 --- a/mert/FeatureDataIterator.h +++ b/mert/FeatureDataIterator.h @@ -37,18 +37,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "FeatureStats.h" -namespace util { class FilePiece; } +namespace util +{ +class FilePiece; +} namespace MosesTuning { - -class FileFormatException : public util::Exception + +class FileFormatException : public util::Exception { - public: - explicit FileFormatException(const std::string& filename, const std::string& line) { - *this << "Error in line \"" << line << "\" of " << filename; - } +public: + explicit FileFormatException(const std::string& filename, const std::string& line) { + *this << "Error in line \"" << line << "\" of " << filename; + } }; @@ -56,45 +59,45 @@ class FileFormatException : public util::Exception int ParseInt(const StringPiece& str ); /** Assumes a delimiter, so only apply to tokens */ -float ParseFloat(const StringPiece& str); +float ParseFloat(const StringPiece& str); -class FeatureDataItem +class FeatureDataItem { - public: - std::vector<float> dense; - SparseVector sparse; +public: + std::vector<float> dense; + SparseVector sparse; }; bool operator==(FeatureDataItem const& item1, FeatureDataItem const& item2); std::size_t hash_value(FeatureDataItem const& item); -class FeatureDataIterator : +class FeatureDataIterator : public boost::iterator_facade<FeatureDataIterator, - const std::vector<FeatureDataItem>, - boost::forward_traversal_tag> + const std::vector<FeatureDataItem>, + boost::forward_traversal_tag> { - public: - FeatureDataIterator(); - explicit FeatureDataIterator(const std::string& filename); - ~FeatureDataIterator(); +public: + FeatureDataIterator(); + explicit FeatureDataIterator(const std::string& filename); + ~FeatureDataIterator(); - static FeatureDataIterator end() { - return FeatureDataIterator(); - } + static FeatureDataIterator end() { + return FeatureDataIterator(); + } - private: - friend class boost::iterator_core_access; +private: + friend class boost::iterator_core_access; - void increment(); - bool equal(const FeatureDataIterator& rhs) const; - const std::vector<FeatureDataItem>& dereference() const; + void increment(); + bool equal(const FeatureDataIterator& rhs) const; + const std::vector<FeatureDataItem>& dereference() const; - void readNext(); + void readNext(); - boost::shared_ptr<util::FilePiece> m_in; - std::vector<FeatureDataItem> m_next; + boost::shared_ptr<util::FilePiece> m_in; + std::vector<FeatureDataItem> m_next; }; } |