00001 #ifndef moses_TranslationOptionList_h 00002 #define moses_TranslationOptionList_h 00003 00004 #include <vector> 00005 #include "util/check.hh" 00006 #include <iostream> 00007 #include "Util.h" 00008 00009 namespace Moses 00010 { 00011 00012 class TranslationOption; 00013 00014 class TranslationOptionList 00015 { 00016 friend std::ostream& operator<<(std::ostream& out, const TranslationOptionList& coll); 00017 00018 protected: 00019 typedef std::vector<TranslationOption*> CollType; 00020 CollType m_coll; 00021 00022 public: 00023 typedef CollType::iterator iterator; 00024 typedef CollType::const_iterator const_iterator; 00025 const_iterator begin() const { 00026 return m_coll.begin(); 00027 } 00028 const_iterator end() const { 00029 return m_coll.end(); 00030 } 00031 iterator begin() { 00032 return m_coll.begin(); 00033 } 00034 iterator end() { 00035 return m_coll.end(); 00036 } 00037 00038 TranslationOptionList() { 00039 } 00040 TranslationOptionList(const TranslationOptionList ©); 00041 ~TranslationOptionList(); 00042 00043 void resize(size_t newSize) { 00044 m_coll.resize(newSize); 00045 } 00046 size_t size() const { 00047 return m_coll.size(); 00048 } 00049 00050 const TranslationOption *Get(size_t ind) const { 00051 CHECK(ind < m_coll.size()); 00052 return m_coll[ind]; 00053 } 00054 void Remove( size_t ind ) { 00055 CHECK(ind < m_coll.size()); 00056 m_coll.erase( m_coll.begin()+ind ); 00057 } 00058 void Add(TranslationOption *transOpt) { 00059 m_coll.push_back(transOpt); 00060 } 00061 00062 TO_STRING(); 00063 00064 }; 00065 00066 } 00067 00068 #endif
1.5.9