Open CASCADE Technology  7.3.0
Public Member Functions | Protected Member Functions

Message_ProgressIndicator Class Referenceabstract

Defines abstract interface from program to the "user". This includes progress indication and user break mechanisms. More...

#include <Message_ProgressIndicator.hxx>

Inheritance diagram for Message_ProgressIndicator:
Inheritance graph
[legend]

Public Member Functions

virtual void Reset ()
 Drops all scopes and sets scale from 0 to 100, step 1 This scale has name "Step". More...
 
void SetName (const Standard_CString name)
 
void SetName (const Handle< TCollection_HAsciiString > &name)
 Set (optional) name for scale. More...
 
void SetRange (const Standard_Real min, const Standard_Real max)
 Set range for current scale. More...
 
void SetStep (const Standard_Real step)
 Set step for current scale. More...
 
void SetInfinite (const Standard_Boolean isInf=Standard_True)
 Set or drop infinite mode for the current scale. More...
 
void SetScale (const Standard_CString name, const Standard_Real min, const Standard_Real max, const Standard_Real step, const Standard_Boolean isInf=Standard_False)
 
void SetScale (const Standard_Real min, const Standard_Real max, const Standard_Real step, const Standard_Boolean isInf=Standard_False)
 Set all parameters for current scale. More...
 
void GetScale (Standard_Real &min, Standard_Real &max, Standard_Real &step, Standard_Boolean &isInf) const
 Returns all parameters for current scale. More...
 
void SetValue (const Standard_Real val)
 
Standard_Real GetValue () const
 Set and get progress value at current scale If the value to be set is more than currently set one, or out of range for the current scale, it is limited by that range. More...
 
void Increment ()
 
void Increment (const Standard_Real step)
 Increment the progress value by the default of specified step. More...
 
Standard_Boolean NewScope (const Standard_CString name=0)
 
Standard_Boolean NewScope (const Handle< TCollection_HAsciiString > &name)
 
Standard_Boolean NewScope (const Standard_Real span, const Standard_CString name=0)
 
Standard_Boolean NewScope (const Standard_Real span, const Handle< TCollection_HAsciiString > &name)
 Creates new scope on a part of a current scale from current position with span either equal to default step, or specified The scale for the new scope will have specified name and ranged from 0 to 100 with step 1 Returns False if something is wrong in arguments or in current position of progress indicator; scope is opened anyway. More...
 
Standard_Boolean EndScope ()
 Close the current scope and thus return to previous scale Updates position to be at the end of the closing scope Returns False if no scope is opened. More...
 
Standard_Boolean NextScope (const Standard_CString name=0)
 
Standard_Boolean NextScope (const Standard_Real span, const Standard_CString name=0)
 Optimized version of { return EndScope() && NewScope(); }. More...
 
virtual Standard_Boolean UserBreak ()
 Should return True if user has send a break signal. Default implementation returns False. More...
 
virtual Standard_Boolean Show (const Standard_Boolean force=Standard_True)=0
 Update presentation of the progress indicator Called when progress position is changed Flag force is intended for forcing update in case if it is optimized; all internal calls from ProgressIndicator are done with this flag equal to False. More...
 
Standard_Real GetPosition () const
 Returns total progress position on the basic scale ranged from 0. to 1. More...
 
Standard_Integer GetNbScopes () const
 Returns current number of opened scopes This number is always >=1 as top-level scale is always present. More...
 
const Message_ProgressScaleGetScope (const Standard_Integer index) const
 Returns data for scale of index-th scope The first scope is current one, the last is the top-level one. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Protected Member Functions

 Message_ProgressIndicator ()
 Constructor, just calls own Reset() (not yet redefined) More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Detailed Description

Defines abstract interface from program to the "user". This includes progress indication and user break mechanisms.

The process that uses the progress indicator interacts with it as with a scale whose range and step can be configured according to the nature of the process. The scale can be made "infinite", which means it will grow non-linearly, and end of scale will be approached asymptotically at infinite number of steps. In that case the range defines a number of steps corresponding to position at 1/2 of scale. The current position can be either set directly (in a range from current position to maximum scale value), or incremented step by step.

Progress indication mechanism is adapted for convenient usage in hiererchical processes that require indication of progress at several levels of the process nesting. For that purpose, it is possible to create restricted sub-scope of indication by specifying part of a current scale to be used by the subprocess. When subprocess works with progress indicator in the restricted scope, it has the same interface to a scale, while actually it deals only with part of the whole scale.

The recommended way to implement progress indication in the algorithm is to use class Message_ProgressSentry that provides iterator-like interface for incrementing progress and opening nested scopes.

NOTE: Currently there is no support for concurrent progress indicator that could be useful in multithreaded applications.

The user break is implemented as virtual function that should return True in case if break signal from the user is received.

The derived class should take care of visualisation of the progress indicator (e.g. show total position at the graphical bar, print scopes in text mode, or else), and for implementation of user break mechanism (if necessary).

Constructor & Destructor Documentation

◆ Message_ProgressIndicator()

Message_ProgressIndicator::Message_ProgressIndicator ( )
protected

Constructor, just calls own Reset() (not yet redefined)

Member Function Documentation

◆ EndScope()

Standard_Boolean Message_ProgressIndicator::EndScope ( )

Close the current scope and thus return to previous scale Updates position to be at the end of the closing scope Returns False if no scope is opened.

◆ GetNbScopes()

Standard_Integer Message_ProgressIndicator::GetNbScopes ( ) const

Returns current number of opened scopes This number is always >=1 as top-level scale is always present.

◆ GetPosition()

Standard_Real Message_ProgressIndicator::GetPosition ( ) const

Returns total progress position on the basic scale ranged from 0. to 1.

◆ GetScale()

void Message_ProgressIndicator::GetScale ( Standard_Real min,
Standard_Real max,
Standard_Real step,
Standard_Boolean isInf 
) const

Returns all parameters for current scale.

◆ GetScope()

const Message_ProgressScale& Message_ProgressIndicator::GetScope ( const Standard_Integer  index) const

Returns data for scale of index-th scope The first scope is current one, the last is the top-level one.

◆ GetValue()

Standard_Real Message_ProgressIndicator::GetValue ( ) const

Set and get progress value at current scale If the value to be set is more than currently set one, or out of range for the current scale, it is limited by that range.

◆ Increment() [1/2]

void Message_ProgressIndicator::Increment ( )

◆ Increment() [2/2]

void Message_ProgressIndicator::Increment ( const Standard_Real  step)

Increment the progress value by the default of specified step.

◆ NewScope() [1/4]

Standard_Boolean Message_ProgressIndicator::NewScope ( const Standard_CString  name = 0)

◆ NewScope() [2/4]

Standard_Boolean Message_ProgressIndicator::NewScope ( const Handle< TCollection_HAsciiString > &  name)

◆ NewScope() [3/4]

Standard_Boolean Message_ProgressIndicator::NewScope ( const Standard_Real  span,
const Standard_CString  name = 0 
)

◆ NewScope() [4/4]

Standard_Boolean Message_ProgressIndicator::NewScope ( const Standard_Real  span,
const Handle< TCollection_HAsciiString > &  name 
)

Creates new scope on a part of a current scale from current position with span either equal to default step, or specified The scale for the new scope will have specified name and ranged from 0 to 100 with step 1 Returns False if something is wrong in arguments or in current position of progress indicator; scope is opened anyway.

◆ NextScope() [1/2]

Standard_Boolean Message_ProgressIndicator::NextScope ( const Standard_CString  name = 0)

◆ NextScope() [2/2]

Standard_Boolean Message_ProgressIndicator::NextScope ( const Standard_Real  span,
const Standard_CString  name = 0 
)

Optimized version of { return EndScope() && NewScope(); }.

◆ Reset()

virtual void Message_ProgressIndicator::Reset ( )
virtual

Drops all scopes and sets scale from 0 to 100, step 1 This scale has name "Step".

Reimplemented in Draw_ProgressIndicator.

◆ SetInfinite()

void Message_ProgressIndicator::SetInfinite ( const Standard_Boolean  isInf = Standard_True)

Set or drop infinite mode for the current scale.

◆ SetName() [1/2]

void Message_ProgressIndicator::SetName ( const Standard_CString  name)

◆ SetName() [2/2]

void Message_ProgressIndicator::SetName ( const Handle< TCollection_HAsciiString > &  name)

Set (optional) name for scale.

◆ SetRange()

void Message_ProgressIndicator::SetRange ( const Standard_Real  min,
const Standard_Real  max 
)

Set range for current scale.

◆ SetScale() [1/2]

void Message_ProgressIndicator::SetScale ( const Standard_CString  name,
const Standard_Real  min,
const Standard_Real  max,
const Standard_Real  step,
const Standard_Boolean  isInf = Standard_False 
)

◆ SetScale() [2/2]

void Message_ProgressIndicator::SetScale ( const Standard_Real  min,
const Standard_Real  max,
const Standard_Real  step,
const Standard_Boolean  isInf = Standard_False 
)

Set all parameters for current scale.

◆ SetStep()

void Message_ProgressIndicator::SetStep ( const Standard_Real  step)

Set step for current scale.

◆ SetValue()

void Message_ProgressIndicator::SetValue ( const Standard_Real  val)

◆ Show()

virtual Standard_Boolean Message_ProgressIndicator::Show ( const Standard_Boolean  force = Standard_True)
pure virtual

Update presentation of the progress indicator Called when progress position is changed Flag force is intended for forcing update in case if it is optimized; all internal calls from ProgressIndicator are done with this flag equal to False.

Implemented in Draw_ProgressIndicator.

◆ UserBreak()

virtual Standard_Boolean Message_ProgressIndicator::UserBreak ( )
virtual

Should return True if user has send a break signal. Default implementation returns False.

Reimplemented in Draw_ProgressIndicator.


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