Hide menu
Loading...
Searching...
No Matches
manufacturingtoolkit.CadExMTK.ProgressScope Class Reference

ProgressScope ProgressScope.hxx cadex/Base/ProgressScope.hxx. More...

Inheritance diagram for manufacturingtoolkit.CadExMTK.ProgressScope:

Public Member Functions

 __init__ (self, *args)
 
 Value (self)
 
 SetRange (self, *args)
 
 MinValue (self)
 
 MaxValue (self)
 
 Owner (self)
 
 Parent (self)
 
 IsRoot (self)
 
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 

Static Protected Member Functions

 _close (obj)
 

Detailed Description

ProgressScope ProgressScope.hxx cadex/Base/ProgressScope.hxx.

Represents a node in a hierarchy of progress scopes.

Scopes can be used to recursively split the range of ProgressStatus object. Scopes can only be created on stack (i.e. they cannot be dynamically allocated on heap). Base_ProgressStatus internally maintains a stack of created scopes. Whenever a scope is destroyed it notifies its parent by incrementing its value, the parent notifies its own parent and so on up to the ProgressStatus object itself.

Each scope has a range which is by default [0, 100]. A child scope is created as a portion of the parent scope (specified in the constructor). This weight information is used to compute increment in the parent range when the child scope's value changes.

The scope can be created either specifying a ProgressStatus object (in this case a parent scope will be automatically found) or with explicitly defined parent. The latter approach is required to support multi-threaded mode.

Example of usage:

ProgressStatus& aStatus;
ProgressScope aTopScope (aStatus); //take entire remaining range (in this case 100%)
{
ProgressScope aScope (aStatus, 25); //25% of TopRange
// Read the file
}
{
ProgressScope aScope (aStatus); //remaining 75% of TopRange
// Transfer the file data
}

As there can be only one current scope in the current thread, then the scope must be destroyed before its sibling can be created. Otherwise the sibling will interpret the previous scope as its parent resulting in wrong updated value. To do so, the explicit C++ scope constructions can be used as demonstrated in the example above.


The documentation for this class was generated from the following file:
  • CadExMTK.py