<commit_before>/*
 * Copyright (c) 2019 <NAME>
 * This code is licensed under MIT license (see LICENSE for details).
 */

#ifndef VCF2MULTIALIGN_UTILITY_PROGRESS_INDICATOR_MANAGER_HH
#define VCF2MULTIALIGN_UTILITY_PROGRESS_INDICATOR_MANAGER_HH

#include <libbio/progress_indicator.hh>


namespace vcf2multialign {

	// Maintain a progress indicator.
	class progress_indicator_manager
	{
	protected:
		libbio::progress_indicator			m_progress_indicator;

	public:
		libbio::progress_indicator &progress_indicator() { return m_progress_indicator; }

		void install_progress_indicator() { if (m_progress_indicator.is_stderr_interactive()) m_progress_indicator.install(); }
		void uninstall_progress_indicator() { m_progress_indicator.uninstall(); }

		void end_logging() { m_progress_indicator.end_logging(); }
		void finish();
		void finish_mt();
		
		void log_assertion_failure_and_exit(libbio::assertion_failure_exception const &exc);
		void log_exception_and_exit(std::exception const &exc);
		void log_unknown_exception_and_exit();
	};
}

#endif
<commit_msg>Allow ending logging without final update<commit_after>/*
 * Copyright (c) 2019 <NAME>
 * This code is licensed under MIT license (see LICENSE for details).
 */

#ifndef VCF2MULTIALIGN_UTILITY_PROGRESS_INDICATOR_MANAGER_HH
#define VCF2MULTIALIGN_UTILITY_PROGRESS_INDICATOR_MANAGER_HH

#include <libbio/progress_indicator.hh>


namespace vcf2multialign {

	// Maintain a progress indicator.
	class progress_indicator_manager
	{
	protected:
		libbio::progress_indicator			m_progress_indicator;

	public:
		libbio::progress_indicator &progress_indicator() { return m_progress_indicator; }

		void install_progress_indicator() { if (m_progress_indicator.is_stderr_interactive()) m_progress_indicator.install(); }
		void uninstall_progress_indicator() { m_progress_indicator.uninstall(); }

		void end_logging() { m_progress_indicator.end_logging(); }
		void end_logging_no_update() { m_progress_indicator.end_logging_no_update(); }
		void finish();
		void finish_mt();
		
		void log_assertion_failure_and_exit(libbio::assertion_failure_exception const &exc);
		void log_exception_and_exit(std::exception const &exc);
		void log_unknown_exception_and_exit();
	};
}

#endif

{'fraction_non_alphanumeric': 0.08890884598114054, 'fraction_numerical': 0.006286484059272564, 'mean_word_length': 6.845070422535211, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6438147', 'n_tokens_mistral': 775, 'n_tokens_neox': 727, 'n_words': 136}