diff options
Diffstat (limited to 'moses/src/TranslationOptionList.h')
-rw-r--r-- | moses/src/TranslationOptionList.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/moses/src/TranslationOptionList.h b/moses/src/TranslationOptionList.h new file mode 100644 index 000000000..41ae10d8a --- /dev/null +++ b/moses/src/TranslationOptionList.h @@ -0,0 +1,55 @@ + +#pragma once + +#include <vector> +#include <cassert> + +namespace Moses +{ + +class TranslationOption; + +class TranslationOptionList +{ +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 + { + assert(ind < m_coll.size()); + return m_coll[ind]; + } + void Remove( size_t ind ) + { + assert(ind < m_coll.size()); + m_coll.erase( m_coll.begin()+ind ); + } + void Add(TranslationOption *transOpt) + { + m_coll.push_back(transOpt); + } + +}; + +} + |