MyraMath
MultipleProgressMeter.h
Go to the documentation of this file.
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_JOBGRAPH_MULTIPLEPROGRESSMETER_H
7 #define MYRAMATH_JOBGRAPH_MULTIPLEPROGRESSMETER_H
8 
14 #include <myramath/MYRAMATH_EXPORT.h>
15 
17 
18 #include <vector>
19 
20 namespace myra {
21 
22 // Encapsulates a composition of multiple ProgressMeter's.
24  {
25  public:
26 
27  // Default constructor.
29 
30  // Appends another ProgressMeter.
31  void push_back(const ProgressMeter& p);
32 
33  // Virtual destructor, so subtypes can release resources.
34  virtual ~MultipleProgressMeter();
35 
36  protected:
37 
38  // Called when a lengthy calculation is started.
39  virtual void begin(const std::string& name, uint64_t total);
40 
41  // Called repeatedly between begin() and end(), to regularly increment progress.
42  virtual void increment(uint64_t delta);
43 
44  // Called when a lengthy calculation is finished.
45  virtual void end();
46 
47  // Returns false, a TextProgressMeter will never kill a JobGraph.
48  virtual bool kill();
49 
50  // Virtual copy constructor.
51  virtual ProgressMeterBase* clone() const;
52 
53  private:
54 
55  // Internal contents.
56  typedef std::vector<ProgressMeter> ProgressMeters;
57  ProgressMeters progress;
58 
59  };
60 
62 MYRAMATH_EXPORT ProgressMeter make_MultipleProgressMeter(const ProgressMeter& p0, const ProgressMeter& p1);
63 MYRAMATH_EXPORT ProgressMeter make_MultipleProgressMeter(const ProgressMeter& p0, const ProgressMeter& p1, const ProgressMeter& p2);
64 MYRAMATH_EXPORT ProgressMeter make_MultipleProgressMeter(const ProgressMeter& p0, const ProgressMeter& p1, const ProgressMeter& p2, const ProgressMeter& p3);
65 
66 } // namespace
67 
68 #endif
Definition: syntax.dox:1
Interface for measuring progress via callbacks. Wraps an underlying polymorphic ProgressMeterBase.
Definition: ProgressMeter.h:55
Base/contract class for all other ProgressMeter&#39;s.
Definition: ProgressMeter.h:25
Definition: MultipleProgressMeter.h:23
Interface type for progress measurement and control within JobGraph&#39;s.