From b1ed81ef3216b212295afa76c5d20a56fb647204 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 13 Oct 2014 00:42:37 -0400 Subject: new kenlm --- klm/util/stream/sort.hh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'klm/util/stream/sort.hh') diff --git a/klm/util/stream/sort.hh b/klm/util/stream/sort.hh index 16aa6a03..9082cfdd 100644 --- a/klm/util/stream/sort.hh +++ b/klm/util/stream/sort.hh @@ -15,8 +15,8 @@ * sort. Use a hash table for that. */ -#ifndef UTIL_STREAM_SORT__ -#define UTIL_STREAM_SORT__ +#ifndef UTIL_STREAM_SORT_H +#define UTIL_STREAM_SORT_H #include "util/stream/chain.hh" #include "util/stream/config.hh" @@ -182,7 +182,7 @@ template class MergeQueue { amount = remaining_; buffer_end_ = current_ + remaining_; } - PReadOrThrow(fd, current_, amount, offset_); + ErsatzPRead(fd, current_, amount, offset_); offset_ += amount; assert(current_ <= buffer_end_); remaining_ -= amount; @@ -307,10 +307,10 @@ template class MergingReader { const uint64_t block_size = position.GetChain().BlockSize(); Link l(position); for (; offset + block_size < end; ++l, offset += block_size) { - PReadOrThrow(in_, l->Get(), block_size, offset); + ErsatzPRead(in_, l->Get(), block_size, offset); l->SetValidSize(block_size); } - PReadOrThrow(in_, l->Get(), end - offset, offset); + ErsatzPRead(in_, l->Get(), end - offset, offset); l->SetValidSize(end - offset); (++l).Poison(); return; @@ -388,8 +388,10 @@ class BadSortConfig : public Exception { ~BadSortConfig() throw() {} }; +/** Sort */ template class Sort { public: + /** Constructs an object capable of sorting */ Sort(Chain &in, const SortConfig &config, const Compare &compare = Compare(), const Combine &combine = Combine()) : config_(config), data_(MakeTemp(config.temp_prefix)), @@ -545,4 +547,4 @@ template uint64_t BlockingSort(Chain &chain, cons } // namespace stream } // namespace util -#endif // UTIL_STREAM_SORT__ +#endif // UTIL_STREAM_SORT_H -- cgit v1.2.3