MISTATUSCONTEXT Class Reference

Status context, allows cancel checking and progress reporting. More...

#include <mi32/mistatus.h>

List of all members.

Public Member Functions

 MISTATUSCONTEXT (const MISTRING &taskstr, bool AllowCancel=true, bool CreateMgrIfNoActive=false)
 MISTATUSCONTEXT (MISTATUSMANAGER *pStatusMgr, const MISTRING &taskstr, bool AllowCancel=true)
 MISTATUSCONTEXT ()
 ~MISTATUSCONTEXT ()
ERRVALUE Create (const MISTRING &taskstr, bool AllowCancel=true, bool CreateMgrIfNoActive=false)
ERRVALUE Create (MISTATUSMANAGER *pStatusMgr, const MISTRING &taskstr, bool AllowCancel=true)
MISTATUSMANAGERGetManager () const
MISTATUSMANAGER::CONTEXT_PRIVGetPriv () const
bool HasManager () const
bool IsCancelled ()
ERRVALUE ReportMessage (const MISTRING &msgstr)
ERRVALUE ReportProgress (double pctdone=-1)
ERRVALUE ReportProgressBegin (UINT32 NumSteps)
ERRVALUE ReportProgressIncrement (INT32 IncSteps=1)
void ReportProgressIncrementNoCancel (INT32 IncSteps=1)
void ReportProgressNoCancel (double pctdone=-1)
void SetCancelled ()

Detailed Description

Status context, allows cancel checking and progress reporting.

Do not inherit from this class.

This class is designed to be constructed on the stack at the beginning of a task so when it goes out of scope the ending report will be made.

Example using active status manager:

   ERRVALUE DoTask (
      ) {
      ERRVALUE err;
      MISTATUSCONTEXT context(TEXTID_TaskName);
      context.ReportProgressBegin(NumSteps);
      for (int step = 0; (step < NumSteps); ++step) {
         if ((err = context.ReportProgressIncrement()) < 0) return (err);
         }
      return (0);
      }

Example using specified status manager and percentage:

   ERRVALUE DoTask (
      MISTATUSMANAGER *pStatusMgr
      ) {
      ERRVALUE err;
      MISTATUSCONTEXT context(pStatusMgr,TEXTID_TaskName);
      for (int step = 0; (step < NumSteps); ++step) {
         if ((err = context.ReportProgress(100.0*step/NumSteps)) < 0) return (err);
         }
      return (0);
      }

Constructor & Destructor Documentation

MISTATUSCONTEXT::MISTATUSCONTEXT (  ) 

Construct without status manager.

Use Create() to setup with status manager.

MISTATUSCONTEXT::MISTATUSCONTEXT ( MISTATUSMANAGER pStatusMgr,
const MISTRING taskstr,
bool  AllowCancel = true 
)

Construct using specified status manager.

Parameters:
pStatusMgr Status manager, if 0 then context will not report to any manager
taskstr Task description
AllowCancel Whether to allow cancel for this task
MISTATUSCONTEXT::MISTATUSCONTEXT ( const MISTRING taskstr,
bool  AllowCancel = true,
bool  CreateMgrIfNoActive = false 
)

Construct using active status manager.

Parameters:
taskstr Task description
AllowCancel Whether to allow cancel for this task
CreateMgrIfNoActive Create own status manager if no active one set
MISTATUSCONTEXT::~MISTATUSCONTEXT (  ) 

Destructor.


Member Function Documentation

ERRVALUE MISTATUSCONTEXT::Create ( const MISTRING taskstr,
bool  AllowCancel = true,
bool  CreateMgrIfNoActive = false 
) [inline]

Create with active status manager.

Should only be used if default constructor was also used.

Parameters:
taskstr Task description
AllowCancel Whether to allow cancel for this task
CreateMgrIfNoActive Create own status manager if no active one set
ERRVALUE MISTATUSCONTEXT::Create ( MISTATUSMANAGER pStatusMgr,
const MISTRING taskstr,
bool  AllowCancel = true 
) [inline]

Create with specified status manager.

Should only be used if default constructor was also used.

Parameters:
pStatusMgr Status manager, if 0 then context will not report to any manager
taskstr Task description
AllowCancel Whether to allow cancel for this task
MISTATUSMANAGER* MISTATUSCONTEXT::GetManager (  )  const [inline]

Get attached status manager.

MISTATUSMANAGER::CONTEXT_PRIV* MISTATUSCONTEXT::GetPriv (  )  const [inline]

Get private manager-specific information.

bool MISTATUSCONTEXT::HasManager (  )  const [inline]

Determine if attached to a status manager.

bool MISTATUSCONTEXT::IsCancelled (  )  [inline]

Check if operation has been cancelled.

ERRVALUE MISTATUSCONTEXT::ReportMessage ( const MISTRING msgstr  )  [inline]

Report message.

Should not be used to report start/end of task, that is handled by ctor/dtor.

ERRVALUE MISTATUSCONTEXT::ReportProgress ( double  pctdone = -1  )  [inline]

Report progress by percentage.

Parameters:
pctdone Percentage complete, -1 indicates indeterminant
ERRVALUE MISTATUSCONTEXT::ReportProgressBegin ( UINT32  NumSteps  ) 

Begin report of progress with known number of steps.

Parameters:
NumSteps Total number of steps for task
ERRVALUE MISTATUSCONTEXT::ReportProgressIncrement ( INT32  IncSteps = 1  )  [inline]

Increment report of progress with known number of steps.

Parameters:
IncSteps Number of steps to increment by
void MISTATUSCONTEXT::ReportProgressIncrementNoCancel ( INT32  IncSteps = 1  )  [inline]

Increment report of progress without check for cancel.

Parameters:
IncSteps Number of steps to increment by
void MISTATUSCONTEXT::ReportProgressNoCancel ( double  pctdone = -1  )  [inline]

Report progress by percentage without cancel check.

Parameters:
pctdone Percentage complete, -1 indicates indeterminant
void MISTATUSCONTEXT::SetCancelled (  )  [inline]

Set that context is cancelled.


The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:33:39 2012 for TNTsdk 2012 by  doxygen 1.6.1