C12Adapter Opensource C++ Interface
MProgressMonitor Class Reference

ProgressMonitor manages a set of ProgressAction objects. More...

Inheritance diagram for MProgressMonitor:

Classes

class  Listener
 

Public Member Functions

 MProgressMonitor (MProgressListener *listener=NULL)
 Create progress monitor. More...
 
virtual ~MProgressMonitor ()
 Destroy progress monitor.
 
MProgressActionCreateRootAction ()
 Purges any existing action hierarchy - start from scratch. More...
 
void SetLocalAction (MProgressAction *)
 Set sub-action for lower level processing. More...
 
MProgressActionGetLocalAction ()
 Returns a preset (or dummy) action and resets sub action pointer after returning. More...
 
double GetProgress () const
 Current top-level progress.
 
int GetActionStackDepth () const
 Direct access to the action stack. More...
 
const MProgressActionGetActionAt (int depth) const
 Access an action in the stack of actions. More...
 
void SetListener (MProgressListener *listener)
 
MProgressListenerGetListener ()
 
const MProgressListenerGetListenerConst () const
 
- Public Member Functions inherited from MObject
virtual ~MObject ()
 Object destructor.
 
virtual const MClassGetClass () 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 &params)
 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 &params)
 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...
 

Static Public Member Functions

static MProgressActionGetDummyAction ()
 Access to (the only) dummy action. More...
 
- Static Public Member Functions inherited from MObject
static const MClassGetStaticClass ()
 Get the declared class of this particular object. More...
 
static bool IsClassPresent (const MStdString &name)
 Tells if the given class name is available. More...
 

Additional Inherited Members

- Static Public Attributes inherited from MObject
static const MClass s_class
 Class of MObject.
 
- Protected Member Functions inherited from 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...
 

Detailed Description

ProgressMonitor manages a set of ProgressAction objects.

Typical usage scenario:

// global declaration
void SomeLengthyMethod()
{
action.SetMessage("Initializing");
... // do something
action.SetProgress(10); // 10%
Subroutine( action.CreateChild(50) ); // action will be 50% complete when child action is finished
// use CreateLocalAction() when child action action cannot be passed via parameters:
action.CreateLocalAction(80);
AnotherSubroutine(); // subroutine will reclaim its action via MProgressMonitor::GetLocalAction()
... // do something
action.ReportProgress(90,"Finishing"); // more efficient way of calling SetProgress() and SetMessage()
... // do something
action.Complete();
}

ProgressAction object is reflected, while ProgressMonitor is not. However, CreateRootProgressAction() and GetLocalProgressAction() methods exist and are reflected.

Constructor & Destructor Documentation

MProgressMonitor::MProgressMonitor ( MProgressListener listener = NULL)

Create progress monitor.

Parameters
listenerListener object that will be receiving monitoring events.

Member Function Documentation

MProgressAction* MProgressMonitor::CreateRootAction ( )

Purges any existing action hierarchy - start from scratch.

The caller must NOT delete the returned action object.

Returns
root progress action
const MProgressAction* MProgressMonitor::GetActionAt ( int  depth) const

Access an action in the stack of actions.

Current action is at zero depth, root action is at [stack size - 1].

int MProgressMonitor::GetActionStackDepth ( ) const
inline

Direct access to the action stack.

Action stack depth (size).

static MProgressAction* MProgressMonitor::GetDummyAction ( )
inlinestatic

Access to (the only) dummy action.

Used when a progress monitor instance is not available. Dummy action implements all action methods as no-ops. dummy.CreateChild() will return the same (and the only) dummy instance. Dummy instance is returned from GetLocalAction() if no local action was set up. The caller must NOT delete the returned action object.

MProgressListener* MProgressMonitor::GetListener ( )
inline

Listener class associated with the progress monitor.

This can be null to tell there is no associated listener.

const MProgressListener* MProgressMonitor::GetListenerConst ( ) const
inline

Listener class associated with the progress monitor.

This can be null to tell there is no associated listener.

MProgressAction* MProgressMonitor::GetLocalAction ( )

Returns a preset (or dummy) action and resets sub action pointer after returning.

Subsequent calls will return dummy action until SetLocalAction() is called again. See also GetDummyAction(). The caller must NOT delete the returned action object.

void MProgressMonitor::SetListener ( MProgressListener listener)
inline

Listener class associated with the progress monitor.

This can be null to tell there is no associated listener.

void MProgressMonitor::SetLocalAction ( MProgressAction )

Set sub-action for lower level processing.

This is an alternative to passing actions via parameters. The sub-action pointer is automatically reset after getting.