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