MeshLib C++ Docs
Loading...
Searching...
No Matches
MRProgressBar.h
Go to the documentation of this file.
1#pragma once
2
3#include "exports.h"
4#include <functional>
5#include <string>
6
7namespace MR
8{
9
10// Utilities to show application progress bar for long operations
11namespace ProgressBar
12{
13
15using TaskWithMainThreadPostProcessing = std::function< std::function<void()>() >;
16
18MRVIEWER_API void setup( float scaling );
19
21MRVIEWER_API void onFrameEnd();
22
25MRVIEWER_API void order(const char * name, const std::function<void()>& task, int taskCount = 1 );
26
29MRVIEWER_API void orderWithMainThreadPostProcessing( const char* name, TaskWithMainThreadPostProcessing task, int taskCount = 1 );
30
33MRVIEWER_API void orderWithManualFinish( const char * name, std::function<void ()> task, int taskCount = 1 );
34
35MRVIEWER_API bool isCanceled();
36
37MRVIEWER_API bool isFinished();
38
39MRVIEWER_API float getProgress();
40
42MRVIEWER_API float getLastOperationTime();
43
45MRVIEWER_API const std::string& getLastOperationTitle();
46
47MRVIEWER_API void nextTask();
48MRVIEWER_API void nextTask(const char * s);
49
50MRVIEWER_API void setTaskCount( int n );
51
53MRVIEWER_API void forceSetTaskName( std::string taskName );
54MRVIEWER_API void resetTaskName();
55
56MRVIEWER_API void finish();
57
59MRVIEWER_API bool isOrdered();
60
64MRVIEWER_API bool setProgress( float p );
65
69MRVIEWER_API bool callBackSetProgress( float p );
70
74MRVIEWER_API bool simpleCallBackSetProgress( float p );
75
78MRVIEWER_API void printTimingTree( double minTimeSec = 0.1 );
79
80} //namespace ProgressBar
81
82} //namespace MR
MRVIEWER_API void forceSetTaskName(std::string taskName)
set the current task's name without auto-updating progress value
std::function< std::function< void()>() > TaskWithMainThreadPostProcessing
function that returns post-processing function to be called in main UI thread
Definition MRProgressBar.h:15
MRVIEWER_API bool isCanceled()
MRVIEWER_API bool setProgress(float p)
MRVIEWER_API float getProgress()
MRVIEWER_API bool callBackSetProgress(float p)
MRVIEWER_API void onFrameEnd()
call this function on frame end
MRVIEWER_API bool simpleCallBackSetProgress(float p)
MRVIEWER_API float getLastOperationTime()
returns time of last operation in seconds, returns -1.0f if no operation was performed
MRVIEWER_API void orderWithMainThreadPostProcessing(const char *name, TaskWithMainThreadPostProcessing task, int taskCount=1)
MRVIEWER_API void orderWithManualFinish(const char *name, std::function< void()> task, int taskCount=1)
MRVIEWER_API bool isOrdered()
returns true if progress bar was ordered and not finished
MRVIEWER_API void resetTaskName()
MRVIEWER_API void nextTask()
MRVIEWER_API const std::string & getLastOperationTitle()
returns title of the last operation
MRVIEWER_API bool isFinished()
MRVIEWER_API void setup(float scaling)
this function should be called only once for each frame (it is called in MR::Menu (MR::RibbonMenu))
MRVIEWER_API void order(const char *name, const std::function< void()> &task, int taskCount=1)
MRVIEWER_API void setTaskCount(int n)
MRVIEWER_API void printTimingTree(double minTimeSec=0.1)
MRVIEWER_API void finish()