class Geo::GeoProgress
Helper class to manage an IGeoProgressProxy.
Task that take a long time to complete should use an instance of this class to inform clients (through the IGeoProgressProxy interface) of the current progress. Notes on usage: a GeoProgress represents an interval of the total amount of work done. It can be split into bits using CreateSubProgress: it is normally convenient to do this when calling the subfunction.
All the splits retain pointers to the same float giving the overall progress, so any can be interrogated.
Creating a subprogress automatically sets the elapsed progress to the start of that interval. But deleting it doesn't set it to the end - unfortunately we have temporaries that get deleted, so it is a useful convention to call SetProportionDone(1.0f) at the end of progress-tracking functions.
Note that progress is always in the range 0 <= progress <= 1.
Functions
Name | Description |
---|---|
~IGeoProgressProxy() | Virtual destructor. |
CreateProgress() | Create a progress object updates nothing. |
CreateProgress(IGeoProgressProxy *) | Create a progress object that will use this proxy. |
CreateSubProgress(float, float) | Create a subinterval of the current progress. |
CreateSubProgress(float, float, const void *) | Create a subinterval of the current progress. |
GeoProgress() | Constructor. |
GetState() | Gets/sets user-defined state information. |
ReportError(const GeoError &) | Forwards errors to the underlying proxy. |
ReportError(const GeoError &) | Called when an error (or warning) is encountered by the task. |
SetProgressString(const char *) | Set message. |
SetProgressString(const char *) | Called by progress tracked tasks to inform clients of the current (sub) task. |
SetProportionDone(float) | Set proportion of the current function's task done. |
SetProportionDone(float) | Called when a further chunk of work has been performed on the current (sub) task. |
SetState(const void *) | Gets/sets user-defined state information. |
ShouldCancel() | Should we cancel? |
ShouldCancel() | Request a cancel of the current task. |
Anchor | ||||
---|---|---|---|---|
|
virtual Geo::IGeoProgressProxy::~IGeoProgressProxy
...
protected: virtual ~IGeoProgressProxy()
...
Virtual destructor.
Anchor | ||||
---|---|---|---|---|
|
static GeoProgress Geo::GeoProgress::CreateProgress
...
public: GeoProgress CreateProgress()
...
Create a progress object updates nothing.
Anchor | ||||
---|---|---|---|---|
|
static GeoProgress Geo::GeoProgress::CreateProgress
...
public: GeoProgress CreateProgress
(
IGeoProgressProxy * proxy
)
...
Create a progress object that will use this proxy.
Parameters
[in] | proxy | - The progress proxy to update via this progress object. |
Anchor | ||||
---|---|---|---|---|
|
GeoProgress Geo::GeoProgress::CreateSubProgress
...
public: GeoProgress CreateSubProgress
(
float start,
float end
)
...
Create a subinterval of the current progress.
Start and end are proportions of the current function's time interval. Start and end must be in 0->1. Optionally takes state information to store in the subprogress object.
Anchor | ||||
---|---|---|---|---|
|
GeoProgress Geo::GeoProgress::CreateSubProgress
...
public: GeoProgress CreateSubProgress
(
float start,
float end,
const void * state
)
...
Create a subinterval of the current progress.
Start and end are proportions of the current function's time interval. Start and end must be in 0->1. Optionally takes state information to store in the subprogress object.
Anchor | ||||
---|---|---|---|---|
|
Geo::GeoProgress::GeoProgress
...
public: GeoProgress()
...
Constructor.
Anchor | ||||
---|---|---|---|---|
|
const void* Geo::GeoProgress::GetState
...
public: const void * GetState() const
...
Gets/sets user-defined state information.
This can be used to pass error-reporting information (e.g. the ID of the object being processed) to lower-level functions.
Anchor | ||||
---|---|---|---|---|
|
virtual void Geo::GeoProgress::ReportError
...
public: virtual void ReportError
(
const GeoError & error
)
...
Forwards errors to the underlying proxy.
Anchor | ||||
---|---|---|---|---|
|
virtual void Geo::IGeoProgressProxy::ReportError
...
public: void ReportError
(
const GeoError & error
)
...
Called when an error (or warning) is encountered by the task.
Details of the error can be found in the Error struct. The Error struct is valid only for the lifetime of the call to ReportError and cannot be copied.
Anchor | ||||
---|---|---|---|---|
|
virtual void Geo::GeoProgress::SetProgressString
...
public: virtual void SetProgressString
(
const char * desc
)
...
Set message.
Anchor | ||||
---|---|---|---|---|
|
virtual void Geo::IGeoProgressProxy::SetProgressString
...
public: void SetProgressString
(
const char * desc
)
...
Called by progress tracked tasks to inform clients of the current (sub) task.
Anchor | ||||
---|---|---|---|---|
|
virtual void Geo::GeoProgress::SetProportionDone
...
public: virtual void SetProportionDone
(
float localProgress
)
...
Set proportion of the current function's task done.
Anchor | ||||
---|---|---|---|---|
|
virtual void Geo::IGeoProgressProxy::SetProportionDone
...
public: void SetProportionDone
(
float globalProgress
)
...
Called when a further chunk of work has been performed on the current (sub) task.
Parameters
[in] | globalProgress | The total percentage of work completed on this task [0,1]. |
Anchor | ||||
---|---|---|---|---|
|
void Geo::GeoProgress::SetState
...
public: void SetState
(
const void * state
)
...
Gets/sets user-defined state information.
This can be used to pass error-reporting information (e.g. the ID of the object being processed) to lower-level functions.
Anchor | ||||
---|---|---|---|---|
|
virtual bool Geo::GeoProgress::ShouldCancel
...
public: virtual bool ShouldCancel()
...
Should we cancel?
Anchor | ||||
---|---|---|---|---|
|
virtual bool Geo::IGeoProgressProxy::ShouldCancel
...
public: bool ShouldCancel()
...
Request a cancel of the current task.
This function will be called periodically by progress tracked tasks. Use this opportunity to request a halt to the current task.