Geom Software - C++ Programming and Geometry Libraries
WOF Documentation pages v1.10
GEOM_WOF::ProgressBase Class Referenceabstract

Base class for progress subscribers. More...

#include <wof_api_definitions.h>

Public Member Functions

virtual void update (const std::string &s, double d)=0
 update More...
 

Detailed Description

A progress subscriber class can be derived from ProgressBase to receive progress updates from the WOF library.

A simple terminal progress bar could be derived like this:

class MyProgressBar:public GEOM_WOF::ProgressBase
{
public:
// WOF calls the update method with d={0.0,...,1.0}
void update(const std::string& s,double d)
{
if(s!=lastMessage)
{
cout<<"\n"; // New message, line feed
lastMessage=s;
}
cout<<("Progress(\""+s+"\"): ")<<d*100.0<<" % \r"<<flush;
if(d>=1.0) cout<<endl;
}
protected:
std::string lastMessage;
};
Base class for progress subscribers.
Definition: wof_api_definitions.h:107
virtual void update(const std::string &s, double d)=0
update

Member Function Documentation

◆ update()

virtual void GEOM_WOF::ProgressBase::update ( const std::string &  s,
double  d 
)
pure virtual

This method must be defined in the derived class. It is called whenever the progress changes and thus it should be computationally inexpensive.


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