2010-04-08 21:16:10 +04:00
|
|
|
|
|
|
|
#include "HypothesisStack.h"
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
HypothesisStack::~HypothesisStack()
|
|
|
|
{
|
2011-02-24 16:14:42 +03:00
|
|
|
// delete all hypos
|
|
|
|
while (m_hypos.begin() != m_hypos.end()) {
|
|
|
|
Remove(m_hypos.begin());
|
|
|
|
}
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Remove hypothesis pointed to by iterator but don't delete the object. */
|
|
|
|
void HypothesisStack::Detach(const HypothesisStack::iterator &iter)
|
|
|
|
{
|
2011-02-24 16:14:42 +03:00
|
|
|
m_hypos.erase(iter);
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void HypothesisStack::Remove(const HypothesisStack::iterator &iter)
|
|
|
|
{
|
2011-02-24 16:14:42 +03:00
|
|
|
Hypothesis *h = *iter;
|
|
|
|
Detach(iter);
|
|
|
|
FREEHYPO(h);
|
2010-04-08 21:16:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|