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 {
12 OPENVDB_USE_VERSION_NAMESPACE
13 namespace OPENVDB_VERSION_NAME {
14 namespace util {
15
25 struct NullInterrupter
26 {
28 NullInterrupter () {}
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
version.h
Library and file format version numbers.
openvdb::v7_0::util::NullInterrupter
Dummy NOOP interrupter class defining interface.
Definition: NullInterrupter.h:25
openvdb::v7_0::util::NullInterrupter::wasInterrupted
bool wasInterrupted(int percent=-1)
Definition: NullInterrupter.h:40
openvdb::v7_0::util::NullInterrupter::NullInterrupter
NullInterrupter()
Default constructor.
Definition: NullInterrupter.h:28
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:154
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:102
openvdb::v7_0::util::NullInterrupter::start
void start(const char *name=nullptr)
Definition: NullInterrupter.h:31
openvdb::v7_0::util::wasInterrupted
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:49
openvdb
Definition: Exceptions.h:13
openvdb::v7_0::util::NullInterrupter::end
void end()
Signal the end of an interruptible operation.
Definition: NullInterrupter.h:33