diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-18 23:27:58 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-18 23:27:58 +0300 |
commit | bdb0227ee9648ea96e8ee266d32581c63762b8b0 (patch) | |
tree | 5aff9707a743b3ec5f0e16cba70771b7299516f0 /moses/InputPath.h | |
parent | 7a85126a926c4ffdbd0a956b3b4cec07eea33ed2 (diff) |
Life cycle of TargetPhraseCollection is now managed via shared pointers.
Diffstat (limited to 'moses/InputPath.h')
-rw-r--r-- | moses/InputPath.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/moses/InputPath.h b/moses/InputPath.h index e8b5978ad..e379b8630 100644 --- a/moses/InputPath.h +++ b/moses/InputPath.h @@ -8,12 +8,12 @@ #include "WordsRange.h" #include "NonTerminal.h" #include "moses/FactorCollection.h" - +#include <boost/shared_ptr.hpp> +#include "TargetPhraseCollection.h" namespace Moses { class PhraseDictionary; -class TargetPhraseCollection; class ScoreComponentCollection; class TargetPhrase; class InputPath; @@ -32,7 +32,12 @@ class InputPath friend std::ostream& operator<<(std::ostream& out, const InputPath &obj); public: - typedef std::map<const PhraseDictionary*, std::pair<const TargetPhraseCollection*, const void*> > TargetPhrases; + + typedef std::pair<TargetPhraseCollection::shared_ptr, const void*> + TPCollStoreEntry; + + typedef std::map<const PhraseDictionary*, TPCollStoreEntry> + TargetPhrases; public: ttaskwptr const ttask; @@ -96,10 +101,14 @@ public: m_nextNode = nextNode; } - void SetTargetPhrases(const PhraseDictionary &phraseDictionary - , const TargetPhraseCollection *targetPhrases - , const void *ptNode); - const TargetPhraseCollection *GetTargetPhrases(const PhraseDictionary &phraseDictionary) const; + void + SetTargetPhrases(const PhraseDictionary &phraseDictionary, + TargetPhraseCollection::shared_ptr const& targetPhrases, + const void *ptNode); + + TargetPhraseCollection::shared_ptr + GetTargetPhrases(const PhraseDictionary &phraseDictionary) const; + const TargetPhrases &GetTargetPhrases() const { return m_targetPhrases; } |