cgma
TextProgressTool Class Reference

#include <TextProgressTool.hpp>

Inheritance diagram for TextProgressTool:
ProgressTool

List of all members.

Public Member Functions

 TextProgressTool ()
virtual ~TextProgressTool ()
virtual void start (int nLower, int nUpper, const char *title=NULL, const char *info_string=NULL, CubitBoolean bSmooth=CUBIT_TRUE, CubitBoolean bHasCancelButton=CUBIT_FALSE)
virtual void end ()
virtual void step ()
virtual void percent (double pcnt)
virtual void check_interrupt ()

Private Attributes

int nTotal
int nCurrent
int nShown

Detailed Description

Definition at line 13 of file TextProgressTool.hpp.


Constructor & Destructor Documentation

Definition at line 13 of file TextProgressTool.cpp.

{
  nTotal = 0;
  nCurrent = 0;
  nShown = 0;
}

Definition at line 20 of file TextProgressTool.cpp.

{
}

Member Function Documentation

Implements ProgressTool.

Definition at line 96 of file TextProgressTool.cpp.

{
}
void TextProgressTool::end ( ) [virtual]

Implements ProgressTool.

Definition at line 51 of file TextProgressTool.cpp.

{
  PRINT_INFO("\n");
}
void TextProgressTool::percent ( double  pcnt) [virtual]

Implements ProgressTool.

Definition at line 80 of file TextProgressTool.cpp.

{
  int ncur = (int)(pcnt * (double)nTotal + 0.5);
  if(ncur > nTotal) 
    ncur = nTotal;
  if (ncur > nCurrent)
  {
    int ii;
    for (ii=nCurrent; ii<ncur; ii++)
    {
      step();
    }
    nCurrent = ncur;
  }
}
void TextProgressTool::start ( int  nLower,
int  nUpper,
const char *  title = NULL,
const char *  info_string = NULL,
CubitBoolean  bSmooth = CUBIT_TRUE,
CubitBoolean  bHasCancelButton = CUBIT_FALSE 
) [virtual]

Implements ProgressTool.

Definition at line 24 of file TextProgressTool.cpp.

{
  const char* progress_title = title ? title : "Progress";

  //bSmooth; bHasCancelButton;
  PRINT_INFO("%s\n",progress_title);
  if (info_string != NULL)
  {
    PRINT_INFO("%s\n",info_string);
  }
  PRINT_INFO("0   |    |    |    |    50   |    |    |    |  100\n");

  nTotal = nUpper - nLower;
  nCurrent = 0;
  nShown = 0;
}
void TextProgressTool::step ( ) [virtual]

Implements ProgressTool.

Definition at line 62 of file TextProgressTool.cpp.

{
  if( nTotal > 0 )
  {
    nCurrent++;  
    int n = 50 * nCurrent / nTotal;
    for( ; nShown < n; nShown++ )
      PRINT_INFO("*");
  }
}

Member Data Documentation

Definition at line 39 of file TextProgressTool.hpp.

int TextProgressTool::nShown [private]

Definition at line 40 of file TextProgressTool.hpp.

int TextProgressTool::nTotal [private]

Definition at line 38 of file TextProgressTool.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines