diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-11-18 21:08:58 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-11-18 21:08:58 +0400 |
commit | c8f19220e99131ee4e2fe5f2f6608f90e4206b18 (patch) | |
tree | e5173cdb920dd0f75c6aa12dfb323d6436804da0 /OnDiskPt/OnDiskWrapper.cpp | |
parent | 1accc75d14829ca5545d58635c316a06d98ce6aa (diff) |
replace CHECK with UTIL_THROW_IFin OnDiskPt
Diffstat (limited to 'OnDiskPt/OnDiskWrapper.cpp')
-rw-r--r-- | OnDiskPt/OnDiskWrapper.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/OnDiskPt/OnDiskWrapper.cpp b/OnDiskPt/OnDiskWrapper.cpp index 700b62678..5e44f5743 100644 --- a/OnDiskPt/OnDiskWrapper.cpp +++ b/OnDiskPt/OnDiskWrapper.cpp @@ -43,18 +43,17 @@ OnDiskWrapper::~OnDiskWrapper() delete m_rootSourceNode; } -bool OnDiskWrapper::BeginLoad(const std::string &filePath) +void OnDiskWrapper::BeginLoad(const std::string &filePath) { - if (!OpenForLoad(filePath)) - return false; + if (!OpenForLoad(filePath)) { + UTIL_THROW(util::FileOpenException, "Couldn't open for loading: " << filePath); + } if (!m_vocab.Load(*this)) - return false; + UTIL_THROW(util::FileOpenException, "Couldn't load vocab"); UINT64 rootFilePos = GetMisc("RootNodeOffset"); m_rootSourceNode = new PhraseNode(rootFilePos, *this); - - return true; } bool OnDiskWrapper::OpenForLoad(const std::string &filePath) @@ -110,7 +109,7 @@ bool OnDiskWrapper::LoadMisc() return true; } -bool OnDiskWrapper::BeginSave(const std::string &filePath +void OnDiskWrapper::BeginSave(const std::string &filePath , int numSourceFactors, int numTargetFactors, int numScores) { m_numSourceFactors = numSourceFactors; @@ -175,8 +174,6 @@ bool OnDiskWrapper::BeginSave(const std::string &filePath counts[0] = DEFAULT_COUNT; m_rootSourceNode = new PhraseNode(); m_rootSourceNode->AddCounts(counts); - - return true; } void OnDiskWrapper::EndSave() |