diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2012-11-12 23:56:18 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2012-11-12 23:56:18 +0400 |
commit | 5e3ef23cef6101d2c098eb3445f562e8f595655b (patch) | |
tree | b8c332b6fa82bae84ea4910967a10ba1b08a7107 /moses/TranslationOptionList.h | |
parent | 8c785cff2b1be3cccd76ea9026f71b649762dfc3 (diff) |
move moses/src/* to moses/
Diffstat (limited to 'moses/TranslationOptionList.h')
-rw-r--r-- | moses/TranslationOptionList.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/moses/TranslationOptionList.h b/moses/TranslationOptionList.h new file mode 100644 index 000000000..bde2212d7 --- /dev/null +++ b/moses/TranslationOptionList.h @@ -0,0 +1,70 @@ +#ifndef moses_TranslationOptionList_h +#define moses_TranslationOptionList_h + +#include <vector> +#include "util/check.hh" +#include <iostream> +#include "Util.h" + +namespace Moses +{ + +class TranslationOption; + +/** wrapper around vector of translation options + */ +class TranslationOptionList +{ + friend std::ostream& operator<<(std::ostream& out, const TranslationOptionList& coll); + +protected: + typedef std::vector<TranslationOption*> CollType; + CollType m_coll; + +public: + typedef CollType::iterator iterator; + typedef CollType::const_iterator const_iterator; + const_iterator begin() const { + return m_coll.begin(); + } + const_iterator end() const { + return m_coll.end(); + } + iterator begin() { + return m_coll.begin(); + } + iterator end() { + return m_coll.end(); + } + + TranslationOptionList() { + } + TranslationOptionList(const TranslationOptionList ©); + ~TranslationOptionList(); + + void resize(size_t newSize) { + m_coll.resize(newSize); + } + size_t size() const { + return m_coll.size(); + } + + const TranslationOption *Get(size_t ind) const { + CHECK(ind < m_coll.size()); + return m_coll[ind]; + } + void Remove( size_t ind ) { + CHECK(ind < m_coll.size()); + m_coll.erase( m_coll.begin()+ind ); + } + void Add(TranslationOption *transOpt) { + m_coll.push_back(transOpt); + } + + TO_STRING(); + +}; + +} + +#endif |