OpenVDB  7.0.0
NullInterrupter.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 //
5 
6 #ifndef OPENVDB_UTIL_NULL_INTERRUPTER_HAS_BEEN_INCLUDED
7 #define OPENVDB_UTIL_NULL_INTERRUPTER_HAS_BEEN_INCLUDED
8 
9 #include <openvdb/version.h>
10 
11 namespace openvdb {
13 namespace OPENVDB_VERSION_NAME {
14 namespace util {
15 
26 {
31  void start(const char* name = nullptr) { (void)name; }
33  void end() {}
40  inline bool wasInterrupted(int percent = -1) { (void)percent; return false; }
41 };
42 
48 template <typename T>
49 inline bool wasInterrupted(T* i, int percent = -1) { return i && i->wasInterrupted(percent); }
50 
52 template<>
53 inline bool wasInterrupted<util::NullInterrupter>(util::NullInterrupter*, int) { return false; }
54 
55 } // namespace util
56 } // namespace OPENVDB_VERSION_NAME
57 } // namespace openvdb
58 
59 #endif // OPENVDB_UTIL_NULL_INTERRUPTER_HAS_BEEN_INCLUDED
void start(const char *name=nullptr)
Definition: NullInterrupter.h:31
bool wasInterrupted(int percent=-1)
Definition: NullInterrupter.h:40
void end()
Signal the end of an interruptible operation.
Definition: NullInterrupter.h:33
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:102
Definition: Exceptions.h:13
Dummy NOOP interrupter class defining interface.
Definition: NullInterrupter.h:25
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:49
Library and file format version numbers.
NullInterrupter()
Default constructor.
Definition: NullInterrupter.h:28
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:154