OpenVDB 12.1.0

Loading...
Searching...
No Matches
NullInterrupter Struct Reference

Base class for interrupters. More...

`#include <openvdb/util/NullInterrupter.h>`

## Public Member Functions
| NullInterrupter ()=default
| Default constructor.
virtual | ~NullInterrupter ()=default
virtual void | start (const char *name=nullptr)
virtual void | end ()
| Signal the end of an interruptible operation.
virtual bool | wasInterrupted (int percent=-1)
virtual NullInterrupter & | interrupter () final
| Convenience method to return a reference to the base class from a derived class.

## Detailed Description

Base class for interrupters.

The host application calls start() at the beginning of an interruptible operation, end() at the end of the operation, and wasInterrupted() periodically during the operation. If any call to wasInterrupted() returns `true`, the operation will be aborted.

Note
  This interrupter was not virtual in a previous implementation, so it could be compiled out, however it remains important to not call wasInterrupter() too frequently so as to balance performance and the ability to interrupt an operation.

## Constructor & Destructor Documentation

## ◆ NullInterrupter()

NullInterrupter | ( |  | ) |
| default

Default constructor.

## ◆ ~NullInterrupter()

virtual ~NullInterrupter | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ end()

virtual void end | ( |  | ) |
| inline virtual

Signal the end of an interruptible operation.

## ◆ interrupter()

virtual NullInterrupter & interrupter | ( |  | ) |
| inline final virtual

Convenience method to return a reference to the base class from a derived class.

## ◆ start()

virtual void start | ( | const char * | name = nullptr | ) |
| inline virtual

Signal the start of an interruptible operation.

Parameters

  name | an optional descriptive name for the operation

## ◆ wasInterrupted()

virtual bool wasInterrupted | ( | int | percent = -1 | ) |
| inline virtual

Check if an interruptible operation should be aborted.

Parameters

  percent | an optional (when >= 0) percentage indicating the fraction of the operation that has been completed

Note
  this method is assumed to be thread-safe.