![]() |
ImFusion C++ SDK 4.5.0
|
#include <ImFusion/Dicom/DicomError.h>
Error handling interface for the Dicom module. More...
Error handling interface for the Dicom module.
Inherit from this class if you need to handle error occurring during loading/saving DICOM data. Allows to register multiple handler callback function that will be called when an error is generated. If an error is generated while no handler callback is registered, it is stored and forwarded to the first handler that gets registered.
Public Types | |
| using | ErrorCallback = std::function<void(const Error&)> |
| Alias for a function to call for each error recorded. | |
Public Member Functions | |
| virtual void * | registerErrorHandler (ErrorCallback handler) |
| Registers a new handler callback function. | |
| virtual void | unregisterErrorHandler (void *handler) |
| Removes a previously registered handler again. | |
| void * | forwardErrors (const ErrorRecorder *otherRecorder) |
| Convenient function to forward all errors registered to this recorder to another recorder. | |
| virtual void | registerError (const Error &error) const |
| Sends the given error to all error handler callbacks. | |
| void | registerError (Error::Code code, Error::Type type, const std::string &details, TagProxy tag=TagProxy()) const |
|
virtual |
Registers a new handler callback function.
Handlers registered first will also receive errors first. Returns a handle that can be used to unregister the callback again. All errors that occured before a handler was registered are passed to the first handler that gets registered. This means if multiple handlers are registered, the very first one might receive more errors than the following ones!
|
virtual |
Removes a previously registered handler again.
Passing a nullptr does nothing.
| void * ImFusion::Dicom::ErrorRecorder::forwardErrors | ( | const ErrorRecorder * | otherRecorder | ) |
Convenient function to forward all errors registered to this recorder to another recorder.
The given pointer must stay valid for the life-time of this recorder!
|
virtual |
Sends the given error to all error handler callbacks.
If there is no handler registered yet, the error will be stored until the first registration of one.
Reimplemented in ImFusion::Dicom::DatasetCache.