OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
Public Member Functions | List of all members
OpenZGY::ProgressWithDots Class Reference

Simple progress bar. More...

#include <api.h>

Public Member Functions

 ProgressWithDots (int length=51, std::ostream &outfile=std::cerr)
 Simple progress bar. More...
 
bool operator() (std::int64_t done, std::int64_t total)
 Callback invoked to report progress. More...
 

Detailed Description

Simple progress bar.

Progress bar that writes dots (51 by default) to standard output. This can be user as-is for simple command line apps, or you can use the source code as an example on how to write your own.

The default of 51 dots will print one dot at startup and then one additional dot for each 2% work done.

If you are using this to write to the cloud a file that is smaller than ~10 GB then the progress bar will probably move in larger jumps. Because writing to a cloud back-end uses very large buffers. Most cloud back-ends cannot report progress inside a "write block".

When passing a progress reporter to a function, make sure you do not pass the class itself. You need to create an instance of it.

Constructor & Destructor Documentation

◆ ProgressWithDots()

OpenZGY::ProgressWithDots::ProgressWithDots ( int  length = 51,
std::ostream &  outfile = std::cerr 
)

Simple progress bar.

Parameters
lengthSize of progress bar, default 51 dots.
outfileStream to write output, default std::cerr

Progress bar that writes dots (51 by default) to standard output. This can be user as-is for simple command line apps, or you can use the source code as an example on how to write your own.

The default of 51 dots will print one dot at startup and then one additional dot for each 2% work done.

If you are using this to write to the cloud a file that is smaller than ~10 GB then the progress bar will probably move in larger jumps. Because writing to a cloud back-end uses very large buffers. Most cloud back-ends cannot report progress inside a "write block".

When passing a progress reporter to a function, make sure you do not pass the class itself. You need to create an instance of it.

Member Function Documentation

◆ operator()()

bool OpenZGY::ProgressWithDots::operator() ( std::int64_t  done,
std::int64_t  total 
)

Callback invoked to report progress.

Parameters
doneNumber of work units done.
totalNumber of work units in total.

The callback will normally get called exactly once with done==0, before processing starts but after "total" is known. And exactly once with done==total signifying that the work is finished and the function being monitored should soon return.

This particular callback will always return true, meaning that the operation is not to be aborted.


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