diff options
author | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2015-03-21 19:12:52 +0300 |
---|---|---|
committer | Ulrich Germann <ugermann@inf.ed.ac.uk> | 2015-03-21 19:12:52 +0300 |
commit | 8ca11d941d99df42664b32c101020283cc83054e (patch) | |
tree | eac36b128d9bfe22ff598458635ae66cdecbf57b /moses/IOWrapper.h | |
parent | 85d2567b57af592a3a902209c7b0f3675576aac7 (diff) |
1. Lifetime of tasks in ThreadPool is now managed via shared pointers.
2. Code cleanup in IOWrapper and a bit elsewhere.
Diffstat (limited to 'moses/IOWrapper.h')
-rw-r--r-- | moses/IOWrapper.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/moses/IOWrapper.h b/moses/IOWrapper.h index dd9c9d785..8ed9a02e5 100644 --- a/moses/IOWrapper.h +++ b/moses/IOWrapper.h @@ -35,6 +35,10 @@ POSSIBILITY OF SUCH DAMAGE. #pragma once +#ifdef WITH_THREADS +#include <boost/thread.hpp> +#endif + #include <cassert> #include <fstream> #include <ostream> @@ -74,7 +78,6 @@ struct SHyperedge; class IOWrapper { protected: - const std::vector<Moses::FactorType> *m_inputFactorOrder; std::string m_inputFilePath; Moses::InputFileStream *m_inputFile; @@ -100,14 +103,20 @@ protected: bool m_surpressSingleBestOutput; +#ifdef WITH_THREADS + boost::mutex m_lock; +#endif + size_t m_currentLine; /* line counter, initialized from static data at construction + * incremented with every call to ReadInput */ + + InputTypeEnum m_inputType; // initialized from StaticData at construction public: IOWrapper(); ~IOWrapper(); - Moses::InputType* GetInput(Moses::InputType *inputType); - bool ReadInput(Moses::InputTypeEnum inputType, - Moses::InputType*& source, TranslationTask const* ttask=NULL); + // Moses::InputType* GetInput(Moses::InputType *inputType); + boost::shared_ptr<InputType> ReadInput(); Moses::OutputCollector *GetSingleBestOutputCollector() { return m_singleBestOutputCollector.get(); |