|
|
|||
File indexing completed on 2026-08-06 09:24:28
0001 // -*- C++ -*- 0002 // 0003 // Progress.h is a part of Herwig - A multi-purpose Monte Carlo event generator 0004 // 0005 0006 // boost progress.hpp header file ------------------------------------------// 0007 0008 // Copyright Beman Dawes 1994-99. Distributed under the Boost 0009 // Software License, Version 1.0. (See accompanying file 0010 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0011 0012 // See http://www.boost.org/libs/timer for documentation. 0013 0014 // Revision History 0015 0016 // 2017-10-14 Modified for Herwig (D. Grellscheid) 0017 0018 // 1 Dec 01 Add leading progress display strings (suggested by Toon Knapen) 0019 // 20 May 01 Introduce several static_casts<> to eliminate warning messages 0020 // (Fixed by Beman, reported by Herve Bronnimann) 0021 // 12 Jan 01 Change to inline implementation to allow use without library 0022 // builds. See docs for more rationale. (Beman Dawes) 0023 // 22 Jul 99 Name changed to .hpp 0024 // 16 Jul 99 Second beta 0025 // 6 Jul 99 Initial boost version 0026 0027 #ifndef HERWIG_PROGRESS_H 0028 #define HERWIG_PROGRESS_H 0029 0030 #include <iosfwd> // for ostream, cout, etc 0031 #include <string> // for string 0032 0033 namespace Herwig { 0034 0035 // progress_display --------------------------------------------------------// 0036 0037 // progress_display displays an appropriate indication of 0038 // progress at an appropriate place in an appropriate form. 0039 0040 // NOTE: (Jan 12, 2001) Tried to change unsigned long to boost::uintmax_t, but 0041 // found some compilers couldn't handle the required conversion to double. 0042 // Reverted to unsigned long until the compilers catch up. 0043 0044 class progress_display 0045 { 0046 public: 0047 explicit progress_display( unsigned long expected_count, 0048 std::ostream & os, 0049 const std::string & s1 = "\n", //leading strings 0050 const std::string & s2 = "", 0051 const std::string & s3 = "" ); 0052 progress_display( const progress_display& ) = delete; 0053 progress_display& operator=( const progress_display& ) = delete; 0054 void restart( unsigned long expected_count ); 0055 0056 unsigned long operator+=( unsigned long increment ); 0057 0058 unsigned long operator++() { return operator+=( 1 ); } 0059 unsigned long count() const { return _count; } 0060 unsigned long expected_count() const { return _expected_count; } 0061 0062 private: 0063 std::ostream & m_os; // may not be present in all imps 0064 const std::string m_s1; // string is more general, safer than 0065 const std::string m_s2; // const char *, and efficiency or size are 0066 const std::string m_s3; // not issues 0067 0068 unsigned long _count, _expected_count, _next_tic_count; 0069 unsigned int _tic; 0070 void display_tic(); 0071 }; 0072 0073 } // namespace Herwig 0074 0075 #endif // HERWIG_PROGRESS_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|