diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-09-24 21:30:51 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-09-24 21:30:51 +0400 |
commit | 4faab6c68fb47c79e101c5fc9146636f3173e50d (patch) | |
tree | c52bd0d821ed1b00170fcb10a9fb9399d1ab62ad /util/ersatz_progress.hh | |
parent | 0580c1ae9f7474a5a70a8b34f9a3bf4091324407 (diff) |
Extract kenlm into a submodule, referencing lazy
Diffstat (limited to 'util/ersatz_progress.hh')
-rw-r--r-- | util/ersatz_progress.hh | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/util/ersatz_progress.hh b/util/ersatz_progress.hh deleted file mode 100644 index f709dc516..000000000 --- a/util/ersatz_progress.hh +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef UTIL_ERSATZ_PROGRESS__ -#define UTIL_ERSATZ_PROGRESS__ - -#include <iostream> -#include <string> - -// Ersatz version of boost::progress so core language model doesn't depend on -// boost. Also adds option to print nothing. - -namespace util { -class ErsatzProgress { - public: - // No output. - ErsatzProgress(); - - // Null means no output. The null value is useful for passing along the ostream pointer from another caller. - explicit ErsatzProgress(std::size_t complete, std::ostream *to = &std::cerr, const std::string &message = ""); - - ~ErsatzProgress(); - - ErsatzProgress &operator++() { - if (++current_ >= next_) Milestone(); - return *this; - } - - ErsatzProgress &operator+=(std::size_t amount) { - if ((current_ += amount) >= next_) Milestone(); - return *this; - } - - void Set(std::size_t to) { - if ((current_ = to) >= next_) Milestone(); - Milestone(); - } - - void Finished() { - Set(complete_); - } - - private: - void Milestone(); - - std::size_t current_, next_, complete_; - unsigned char stones_written_; - std::ostream *out_; - - // noncopyable - ErsatzProgress(const ErsatzProgress &other); - ErsatzProgress &operator=(const ErsatzProgress &other); -}; - -} // namespace util - -#endif // UTIL_ERSATZ_PROGRESS__ |