Assignments Assignments

ProgressBar.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2009, Michael Kazhdan and Ming Chuang
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer. Redistributions in binary form must reproduce
10 the above copyright notice, this list of conditions and the following disclaimer
11 in the documentation and/or other materials provided with the distribution.
12
13 Neither the name of the Johns Hopkins University nor the names of its contributors
14 may be used to endorse or promote products derived from this software without specific
15 prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
20 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26 DAMAGE.
27*/
28#ifndef PROGRESS_BAR_INCLUDED
29#define PROGRESS_BAR_INCLUDED
30
31#include <atomic>
32#include "Util/timer.h"
33
34 namespace Util
35{
36 class ProgressBar
37 {
38 int _bins;
39 size_t _total;
40 std::atomic< size_t > _idx;
41 const char* _header;
42 std::chrono::high_resolution_clock::time_point _startTime;
43 double _previousTime;
44 public:
45 ProgressBar( int bins , size_t total , const char* header );
46 ~ProgressBar( void );
47 void update( bool output=true );
48 void print( void );
49 };
50#include "ProgressBar.inl"
51}
52
53#endif // PROGRESS_BAR_INCLUDED
ProgressBar.inl
Util::ProgressBar::print
void print(void)
Definition ProgressBar.h:48
Util::ProgressBar::_idx
std::atomic< size_t > _idx
Definition ProgressBar.h:40
Util::ProgressBar::_previousTime
double _previousTime
Definition ProgressBar.h:43
Util::ProgressBar::_total
size_t _total
Definition ProgressBar.h:39
Util::ProgressBar::_header
const char * _header
Definition ProgressBar.h:41
Util::ProgressBar::_bins
int _bins
Definition ProgressBar.h:38
Util::ProgressBar::update
void update(bool output=true)
Definition ProgressBar.h:43
Util::ProgressBar::~ProgressBar
~ProgressBar(void)
Definition ProgressBar.h:66
Util::ProgressBar::ProgressBar
ProgressBar(int bins, size_t total, const char *header)
Definition ProgressBar.h:33
Util::ProgressBar::_startTime
std::chrono::high_resolution_clock::time_point _startTime
Definition ProgressBar.h:42
Util
Definition algebra.h:7
timer.h