00001 #ifndef moses_HypothesisStack_h 00002 #define moses_HypothesisStack_h 00003 00004 #include <vector> 00005 #include <set> 00006 #include "Hypothesis.h" 00007 #include "WordsBitmap.h" 00008 00009 namespace Moses 00010 { 00011 00012 class Manager; 00013 00014 class HypothesisStack 00015 { 00016 00017 protected: 00018 typedef std::set< Hypothesis*, HypothesisRecombinationOrderer > _HCType; 00019 _HCType m_hypos; 00020 Manager& m_manager; 00021 00022 public: 00023 HypothesisStack(Manager& manager): m_manager(manager) {} 00024 typedef _HCType::iterator iterator; 00025 typedef _HCType::const_iterator const_iterator; 00027 const_iterator begin() const { 00028 return m_hypos.begin(); 00029 } 00030 const_iterator end() const { 00031 return m_hypos.end(); 00032 } 00033 size_t size() const { 00034 return m_hypos.size(); 00035 } 00036 virtual inline float GetWorstScore() const { 00037 return -std::numeric_limits<float>::infinity(); 00038 }; 00039 virtual float GetWorstScoreForBitmap( WordsBitmapID ) { 00040 return -std::numeric_limits<float>::infinity(); 00041 }; 00042 virtual float GetWorstScoreForBitmap( WordsBitmap ) { 00043 return -std::numeric_limits<float>::infinity(); 00044 }; 00045 00046 virtual ~HypothesisStack(); 00047 virtual bool AddPrune(Hypothesis *hypothesis) = 0; 00048 virtual const Hypothesis *GetBestHypothesis() const = 0; 00049 virtual std::vector<const Hypothesis*> GetSortedList() const = 0; 00050 00052 virtual void Detach(const HypothesisStack::iterator &iter); 00054 virtual void Remove(const HypothesisStack::iterator &iter); 00055 00056 }; 00057 00058 } 00059 00060 #endif
1.5.9