diff --git a/contrib/other-builds/mira/.cproject b/contrib/other-builds/mira/.cproject index 72f66b5fb..b80748286 100644 --- a/contrib/other-builds/mira/.cproject +++ b/contrib/other-builds/mira/.cproject @@ -56,6 +56,7 @@ + diff --git a/moses-chart-cmd/IOWrapper.cpp b/moses-chart-cmd/IOWrapper.cpp index db12dcfd6..bd019cd99 100644 --- a/moses-chart-cmd/IOWrapper.cpp +++ b/moses-chart-cmd/IOWrapper.cpp @@ -412,10 +412,9 @@ void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, Applica OutputTranslationOption(out, applicationContext, hypo, sentence, translationId); const TargetPhrase &currTarPhr = hypo->GetCurrTargetPhrase(); - boost::shared_ptr property; out << " ||| "; - if (currTarPhr.GetProperty("Tree", property)) { + if (const PhraseProperty *property = currTarPhr.GetProperty("Tree")) { out << " " << property->GetValueString(); } else { out << " " << "noTreeInfo"; @@ -439,10 +438,9 @@ void IOWrapper::OutputTreeFragmentsTranslationOptions(std::ostream &out, Applica OutputTranslationOption(out, applicationContext, applied, sentence, translationId); const TargetPhrase &currTarPhr = *static_cast(applied->GetNote().vp); - boost::shared_ptr property; out << " ||| "; - if (currTarPhr.GetProperty("Tree", property)) { + if (const PhraseProperty *property = currTarPhr.GetProperty("Tree")) { out << " " << property->GetValueString(); } else { out << " " << "noTreeInfo"; diff --git a/moses/FF/TreeStructureFeature.cpp b/moses/FF/TreeStructureFeature.cpp index 25490a470..10578982a 100644 --- a/moses/FF/TreeStructureFeature.cpp +++ b/moses/FF/TreeStructureFeature.cpp @@ -271,8 +271,7 @@ FFState* TreeStructureFeature::EvaluateChart(const ChartHypothesis& cur_hypo , int featureID /* used to index the state in the previous hypotheses */ , ScoreComponentCollection* accumulator) const { - boost::shared_ptr property; - if (cur_hypo.GetCurrTargetPhrase().GetProperty("Tree", property)) { + if (const PhraseProperty *property = cur_hypo.GetCurrTargetPhrase().GetProperty("Tree")) { const std::string &tree = property->GetValueString(); TreePointer mytree (new InternalTree(tree)); diff --git a/moses/TargetPhrase.cpp b/moses/TargetPhrase.cpp index e2a325994..ede16293c 100644 --- a/moses/TargetPhrase.cpp +++ b/moses/TargetPhrase.cpp @@ -248,15 +248,15 @@ void TargetPhrase::SetProperty(const std::string &key, const std::string &value) m_properties[key] = phrasePropertyFactory.ProduceProperty(key,value); } -bool TargetPhrase::GetProperty(const std::string &key, boost::shared_ptr &value) const +const PhraseProperty *TargetPhrase::GetProperty(const std::string &key) const { std::map >::const_iterator iter; iter = m_properties.find(key); if (iter != m_properties.end()) { - value = iter->second; - return true; + const boost::shared_ptr &value = iter->second; + return value.get(); } - return false; + return NULL; } void TargetPhrase::SetRuleSource(const Phrase &ruleSource) const diff --git a/moses/TargetPhrase.h b/moses/TargetPhrase.h index 1f2fa96dd..5056d95c4 100644 --- a/moses/TargetPhrase.h +++ b/moses/TargetPhrase.h @@ -137,7 +137,7 @@ public: void SetProperties(const StringPiece &str); void SetProperty(const std::string &key, const std::string &value); - bool GetProperty(const std::string &key, boost::shared_ptr &value) const; + const PhraseProperty *GetProperty(const std::string &key) const; void Merge(const TargetPhrase ©, const std::vector& factorVec);