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