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:
authorNicola Bertoldi <bertoldi@fbk.eu>2014-01-14 11:50:18 +0400
committerNicola Bertoldi <bertoldi@fbk.eu>2014-01-14 11:50:18 +0400
commit50970b2b598c5ff5194df23163f380b1c0ca6ee0 (patch)
tree5369e8eff8bbb40088771b1f911736b704d8945a /moses/TargetPhraseCollection.h
parentedc8fa8bd6146f3c4ed986839e5ac8b3a37c0003 (diff)
parentaf6b1f2b4e40a95b0a606459dfffe6e2b4c6da85 (diff)
merge master into this branch
Diffstat (limited to 'moses/TargetPhraseCollection.h')
-rw-r--r--moses/TargetPhraseCollection.h44
1 files changed, 36 insertions, 8 deletions
diff --git a/moses/TargetPhraseCollection.h b/moses/TargetPhraseCollection.h
index 117eb1f90..8244c4b4b 100644
--- a/moses/TargetPhraseCollection.h
+++ b/moses/TargetPhraseCollection.h
@@ -36,13 +36,13 @@ class TargetPhraseCollection
protected:
friend std::ostream& operator<<(std::ostream &, const TargetPhraseCollection &);
- // TODO boost::ptr_vector
- std::vector<TargetPhrase*> m_collection;
+ typedef std::vector<const TargetPhrase*> CollType;
+ CollType m_collection;
public:
// iters
- typedef std::vector<TargetPhrase*>::iterator iterator;
- typedef std::vector<TargetPhrase*>::const_iterator const_iterator;
+ typedef CollType::iterator iterator;
+ typedef CollType::const_iterator const_iterator;
iterator begin() {
return m_collection.begin();
@@ -57,11 +57,16 @@ public:
return m_collection.end();
}
+ TargetPhraseCollection()
+ {}
+
+ explicit TargetPhraseCollection(const TargetPhraseCollection &copy);
+
~TargetPhraseCollection() {
- Clear();
+ Remove();
}
- const std::vector<TargetPhrase*> &GetCollection() const {
+ const CollType &GetCollection() const {
return m_collection;
}
@@ -74,7 +79,7 @@ public:
}
//! return an entry of the collection
- TargetPhrase* GetTargetPhrase(const size_t pos) const {
+ const TargetPhrase* GetTargetPhrase(const size_t pos) const {
return m_collection[pos];
}
@@ -97,10 +102,33 @@ public:
void Prune(bool adhereTableLimit, size_t tableLimit);
void Sort(bool adhereTableLimit, size_t tableLimit);
- void Clear() {
+ void Remove() {
RemoveAllInColl(m_collection);
}
+ void Detach() {
+ m_collection.clear();
+ }
+
+};
+
+
+// LEGACY
+// DO NOT USE. NOT LEGACY CODE
+class TargetPhraseCollectionWithSourcePhrase : public TargetPhraseCollection
+{
+protected:
+ //friend std::ostream& operator<<(std::ostream &, const TargetPhraseCollectionWithSourcePhrase &);
+
+ // TODO boost::ptr_vector
+ std::vector<Phrase> m_sourcePhrases;
+
+public:
+ const std::vector<Phrase> &GetSourcePhrases() const {
+ return m_sourcePhrases;
+ }
+ void Add(TargetPhrase *targetPhrase);
+ void Add(TargetPhrase *targetPhrase, const Phrase &sourcePhrase);
};
}