Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berry::SafeRunnable Class Reference

#include <berrySafeRunnable.h>

Inheritance diagram for berry::SafeRunnable:
Collaboration diagram for berry::SafeRunnable:

Public Member Functions

 SafeRunnable (const QString &message="")
 
void HandleException (const ctkException &e) override
 
virtual void Run ()=0
 
- Public Member Functions inherited from berry::ISafeRunnable
 berryObjectMacro (berry::ISafeRunnable)
 
virtual void Run ()=0
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual QString ToString () const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 

Static Public Member Functions

static bool GetIgnoreErrors ()
 
static void SetIgnoreErrors (bool flag)
 
static ISafeRunnableRunner::Pointer GetRunner ()
 
static void SetRunner (ISafeRunnableRunner::Pointer runner)
 
static void Run (ISafeRunnable::Pointer runnable)
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 

Additional Inherited Members

- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Implements a default implementation of ISafeRunnable. The default implementation of HandleException opens a dialog to show any errors as they accumulate.

This may be executed on any thread.

Definition at line 29 of file berrySafeRunnable.h.

Constructor & Destructor Documentation

◆ SafeRunnable()

berry::SafeRunnable::SafeRunnable ( const QString &  message = "")

Creates a new instance of SafeRunnable with the given error message.

Parameters
messagethe error message to use

Member Function Documentation

◆ GetIgnoreErrors()

static bool berry::SafeRunnable::GetIgnoreErrors ( )
static

Flag to avoid interactive error dialogs during automated testing.

Returns
true if errors should be ignored

◆ GetRunner()

static ISafeRunnableRunner::Pointer berry::SafeRunnable::GetRunner ( )
static

Returns the safe runnable runner.

Returns
the safe runnable runner

◆ HandleException()

void berry::SafeRunnable::HandleException ( const ctkException &  exception)
overridevirtual

Handles an exception thrown by this runnable's run method. The processing done here should be specific to the particular usecase for this runnable. Generalized exception processing (e.g., logging in the platform's log) is done by the Platform's run mechanism.

Parameters
exceptionan exception which occurred during processing the body of this runnable (i.e., in run())
See also
SafeRunner::run(ISafeRunnable)

Implements berry::ISafeRunnable.

◆ Run() [1/2]

virtual void berry::ISafeRunnable::Run

Runs this runnable. Any exceptions thrown from this method will be passed to this runnable's handleException method.

Exceptions
Exceptionif a problem occurred while running this method. The exception will be processed by handleException
See also
SafeRunner::run(ISafeRunnable)

◆ Run() [2/2]

static void berry::SafeRunnable::Run ( ISafeRunnable::Pointer  runnable)
static

Runs the given safe runnable using the safe runnable runner. This is a convenience method, equivalent to: SafeRunnable::GetRunner()->Run(runnable).

Parameters
runnablethe runnable to run

◆ SetIgnoreErrors()

static void berry::SafeRunnable::SetIgnoreErrors ( bool  flag)
static

Flag to avoid interactive error dialogs during automated testing.

Parameters
flagset to true if errors should be ignored

◆ SetRunner()

static void berry::SafeRunnable::SetRunner ( ISafeRunnableRunner::Pointer  runner)
static

Sets the safe runnable runner.

Parameters
runnerthe runner to set, or null to reset to the default runner

The documentation for this class was generated from the following file: