VAPOR3 3.9.4
Progress.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <functional>
4#include <vapor/common.h>
5
6namespace VAPoR {
7
19
21public:
22 typedef std::function<void(const std::string &name, long nTotal, bool cancellable)> Start_t;
23 typedef std::function<void(long nDone, bool *cancelled)> Update_t;
24 typedef std::function<void()> Finish_t;
25
29 static void Start(const std::string &name, long total, bool cancelable = false);
31 static void StartIndefinite(const std::string &name, bool cancelable = false);
33 static void Update(long completed);
36 static inline bool Cancelled() { return _cancelled; }
38 static void Finish();
41 static void SetHandlers(Start_t start, Update_t update, Finish_t finish);
42
43#ifndef NDEBUG
45 static void Sleep(double s);
46#endif
47
48private:
49 static bool _cancelled;
50 static long _total;
51
52 static Start_t _start;
53 static Update_t _update;
54 static Finish_t _finish;
55};
56} // namespace VAPoR
std::function< void(const std::string &name, long nTotal, bool cancellable)> Start_t
Definition: Progress.h:22
static void Start(const std::string &name, long total, bool cancelable=false)
static void SetHandlers(Start_t start, Update_t update, Finish_t finish)
static void Update(long completed)
Update the progress status.
static void Sleep(double s)
For testing purposes only.
static bool Cancelled()
Definition: Progress.h:36
std::function< void(long nDone, bool *cancelled)> Update_t
Definition: Progress.h:23
static void StartIndefinite(const std::string &name, bool cancelable=false)
Same as start but the progress is unknown. Update(0) still needs to be called periodically.
std::function< void()> Finish_t
Definition: Progress.h:24
static void Finish()
Signify the computation was cancelled.
#define COMMON_API
Definition: common.h:72