Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2013-11-19 22:52:15 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-11-19 22:52:15 +0400
commitc2ffc022eab102fc2e1593c435c1eaa389583278 (patch)
tree528d30540bde0dce46349b1e9a3f0cd122afcbbf /moses/ChartHypothesisCollection.cpp
parent22864c2b4b154b2c69518bf773fe73f4c557af0a (diff)
replace CHECK with UTIL_THROW_IF in Moses
Diffstat (limited to 'moses/ChartHypothesisCollection.cpp')
-rw-r--r--moses/ChartHypothesisCollection.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/moses/ChartHypothesisCollection.cpp b/moses/ChartHypothesisCollection.cpp
index f3116fb43..a4def91a1 100644
--- a/moses/ChartHypothesisCollection.cpp
+++ b/moses/ChartHypothesisCollection.cpp
@@ -87,7 +87,8 @@ bool ChartHypothesisCollection::AddHypothesis(ChartHypothesis *hypo, ChartManage
// equiv hypo exists, recombine with other hypo
HCType::iterator &iterExisting = addRet.first;
ChartHypothesis *hypoExisting = *iterExisting;
- CHECK(iterExisting != m_hypos.end());
+ UTIL_THROW_IF(iterExisting == m_hypos.end(), util::Exception,
+ "Adding a hypothesis should have returned a valid iterator");
//StaticData::Instance().GetSentenceStats().AddRecombination(*hypo, **iterExisting);
@@ -251,7 +252,9 @@ void ChartHypothesisCollection::PruneToSize(ChartManager &manager)
for (iter = hyposOrdered.begin() + (m_maxHypoStackSize * 2); iter != hyposOrdered.end(); ++iter) {
ChartHypothesis *hypo = *iter;
HCType::iterator iterFindHypo = m_hypos.find(hypo);
- CHECK(iterFindHypo != m_hypos.end());
+ UTIL_THROW_IF(iterFindHypo == m_hypos.end(), util::Exception,
+ "Adding a hypothesis should have returned a valid iterator");
+
Remove(iterFindHypo);
}
}
@@ -261,7 +264,7 @@ void ChartHypothesisCollection::PruneToSize(ChartManager &manager)
//! sort hypothses by descending score. Put these hypos into a vector m_hyposOrdered to be returned by function GetSortedHypotheses()
void ChartHypothesisCollection::SortHypotheses()
{
- CHECK(m_hyposOrdered.empty());
+ UTIL_THROW_IF(!m_hyposOrdered.empty(), util::Exception, "Hypotheses already sorted");
if (!m_hypos.empty()) {
// done everything for this cell.
// sort