ImFusion C++ SDK 4.5.0
ImFusion::Dicom::ErrorRecorder Class Reference

#include <ImFusion/Dicom/DicomError.h>

Error handling interface for the Dicom module. More...

Inheritance diagram for ImFusion::Dicom::ErrorRecorder:

Detailed Description

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

Member Function Documentation

◆ registerErrorHandler()

virtual void * ImFusion::Dicom::ErrorRecorder::registerErrorHandler ( ErrorCallback handler)
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!

◆ unregisterErrorHandler()

virtual void ImFusion::Dicom::ErrorRecorder::unregisterErrorHandler ( void * handler)
virtual

Removes a previously registered handler again.

Passing a nullptr does nothing.

◆ forwardErrors()

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!

◆ registerError()

virtual void ImFusion::Dicom::ErrorRecorder::registerError ( const Error & error) const
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.


The documentation for this class was generated from the following file:
  • ImFusion/Dicom/DicomError.h
Search Tab / S to search, Esc to close