C12Adapter Opensource C++ Interface
|
Representation of task activity. More...
Public Member Functions | |
void | ReportProgress (double percent, const MStdString &message) |
Set both the progress and the new message in a single call. More... | |
MProgressAction * | CreateChild (double parentPercentByCompletion) |
Create a sub-action. More... | |
void | CreateLocalAction (double parentPercentByCompletion) |
Create a child, and set it as a local action for the monitor. More... | |
void | Complete () |
Complete this action. More... | |
MProgressMonitor * | GetOwner () const |
Access to the progress monitor this action belongs to. More... | |
const MStdString & | GetMessage () const |
void | SetMessage (const MStdString &message) |
void | SetProgress (double percent) |
double | GetProgress () const |
![]() | |
virtual | ~MObject () |
Object destructor. | |
virtual const MClass * | GetClass () const =0 |
Get the final class of the object. More... | |
virtual unsigned | GetEmbeddedSizeof () const |
For embedded object types, return the size of the class. More... | |
bool | IsEmbeddedObject () const |
Tell if the object is of embedded kind. More... | |
SHOW_INTERNAL MVariant | Call (const MStdString &name, const MVariant ¶ms) |
Call the object service with parameters, given as variant. More... | |
MVariant | Call0 (const MStdString &name) |
Call the object service with no parameters. More... | |
MVariant | Call1 (const MStdString &name, const MVariant &p1) |
Call the object service with one parameter. More... | |
MVariant | Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2) |
Call the object service with two parameter. More... | |
MVariant | Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3) |
Call the object service with three parameter. More... | |
MVariant | Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4) |
Call the object service with four parameter. More... | |
MVariant | Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5) |
Call the object service with five parameter. More... | |
MVariant | Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6) |
Call the object service with six parameter. More... | |
virtual MVariant | CallV (const MStdString &name, const MVariant::VariantVector ¶ms) |
Call the object service with parameters, given as variant vector. More... | |
virtual bool | IsPropertyPresent (const MStdString &name) const |
Tell if the property with the given name exists. | |
virtual bool | IsServicePresent (const MStdString &name) const |
Tell if the service with the given name exists. | |
virtual MVariant | GetProperty (const MStdString &name) const |
Get the property value using name of the property. More... | |
virtual void | SetProperty (const MStdString &name, const MVariant &value) |
Set the property using name of the property, and value. More... | |
virtual MStdStringVector | GetAllPropertyNames () const |
Return the list of publicly available properties, persistent or not. More... | |
virtual MStdStringVector | GetAllPersistentPropertyNames () const |
Return the list of persistent properties. More... | |
virtual void | SetPersistentPropertiesToDefault () |
Set the persistent properties of the object to their default values. More... | |
virtual MVariant | GetPersistentPropertyDefaultValue (const MStdString &name) const |
Get the default value of persistent property with the name given. More... | |
virtual void | SetPersistentPropertyToDefault (const MStdString &name) |
Set the persistent property with the name given to default value. More... | |
virtual const char * | GetType () const |
Get the name of the type for the object (could be the same as class name). | |
virtual void | SetType (const MStdString &) |
Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More... | |
virtual void | Validate () |
Validate internal structures of the object. More... | |
Additional Inherited Members | |
![]() | |
static const MClass * | GetStaticClass () |
Get the declared class of this particular object. More... | |
static bool | IsClassPresent (const MStdString &name) |
Tells if the given class name is available. More... | |
![]() | |
static const MClass | s_class |
Class of MObject. | |
![]() | |
MObject () | |
Object constructor, protected as the class is abstract. | |
void | DoSetPersistentPropertiesToDefault (const MClass *staticClass) |
Set the persistent properties to their default values for one object provided the class for that object. More... | |
Representation of task activity.
A typical task comprises of a hierarchy of actions, such as in the following example:
Action objects belong to the progress monitor, and are freed automatically when the corresponding action is finished. An action is considered finished whenever either of the following events occurs:
The later method is handy when an exception thrown inside a child action is caught inside its parent. Once an action is complete, the corresponding ProgressAction instance is destroyed, and hence should not be used any more. Notice that merely setting progress to 100% does not complete the action.
Each action contributes a certain amount to the overall progress of the parent action. Each action has two main properties: 'message' and 'local progress'. These properties can change over time, such as:
A typical task delegates a lot of processing to subroutines. In this case, each subroutine can (optionally) have its own action object to report progress of the subroutine. Here's how to create a child action (a.k.a. 'sub-action') to be used by a subroutine:
In this example, we are saying that the parent action ('action') will be 60% complete by the time the child action is finished. In other words, the child action will contribute 60%-20%=40% of 'action' progress. In some cases, it is not possible (or not suitable) to pass a sub-action as a parameter to a subroutine. In such cases, a reference to a child action can be passed via a static variable inside MProgressMonitor (see MProgressMonitor::Set/GetLocalAction).
void MProgressAction::Complete | ( | ) |
Complete this action.
The action is no longer valid after this call. In fact, it is physically deleted, so any attempt to use it will typically cause access violation.
MProgressAction* MProgressAction::CreateChild | ( | double | parentPercentByCompletion | ) |
Create a sub-action.
When the newly create sub action completes, the parent action will be at the specified completion percent. The caller must NOT delete the returned action object - it is deleted automatically upon completion.
void MProgressAction::CreateLocalAction | ( | double | parentPercentByCompletion | ) |
Create a child, and set it as a local action for the monitor.
Used to pass a sub-action whenever direct passing of MProgressAction object reference is not possible or desired.
|
inline |
Action message or action name
|
inline |
Access to the progress monitor this action belongs to.
Dummy action will return null.
double MProgressAction::GetProgress | ( | ) | const |
Completion percentage of this action aka local progress.
void MProgressAction::ReportProgress | ( | double | percent, |
const MStdString & | message | ||
) |
Set both the progress and the new message in a single call.
This is a better way than setting the properties in sequence, as fewer GUI updates are involved.
void MProgressAction::SetMessage | ( | const MStdString & | message | ) |
Action message or action name
void MProgressAction::SetProgress | ( | double | percent | ) |
Completion percentage of this action aka local progress.