DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExp::ExceptionContainer Class Reference

Wrapper holding a pointer to an exception and providing functionality for accessing it. Used to transfer exceptions between an instrument's task and the ModuleBase module enqueuing the task. Refer to TaskBase::CallbackType. More...

Public Member Functions

 ExceptionContainer (const std::exception_ptr &Exception=nullptr) noexcept
 Constructs an ExceptionContainer instance. More...
 
void Throw () const
 Throws the stored exception. Doesn't do anything if there isn't a stored exception. More...
 
bool IsError () const
 Checks whether the wrapper holds an exception. More...
 
auto GetException () const
 Getter for Exception. More...
 
void ClearError ()
 Removes the stored exception. If this method is called by a task's CallbackFunc in case of an exception having ocurred while running the task, the exception is considered handled. In this case, no exception leaves TaskBase::Run(). More...
 

Private Attributes

std::exception_ptr Exception
 Exception stored in the wrapper. More...
 

Detailed Description

Wrapper holding a pointer to an exception and providing functionality for accessing it. Used to transfer exceptions between an instrument's task and the ModuleBase module enqueuing the task. Refer to TaskBase::CallbackType.

Definition at line 85 of file Instrument.h.

Constructor & Destructor Documentation

◆ ExceptionContainer()

DynExp::ExceptionContainer::ExceptionContainer ( const std::exception_ptr &  Exception = nullptr)
inlinenoexcept

Constructs an ExceptionContainer instance.

Parameters
ExceptionPointer to an exception to store in the wrapper

Definition at line 92 of file Instrument.h.

Member Function Documentation

◆ ClearError()

void DynExp::ExceptionContainer::ClearError ( )
inline

Removes the stored exception. If this method is called by a task's CallbackFunc in case of an exception having ocurred while running the task, the exception is considered handled. In this case, no exception leaves TaskBase::Run().

Definition at line 117 of file Instrument.h.

◆ GetException()

auto DynExp::ExceptionContainer::GetException ( ) const
inline

Getter for Exception.

Returns
Returns Exception.

Definition at line 110 of file Instrument.h.

◆ IsError()

bool DynExp::ExceptionContainer::IsError ( ) const
inline

Checks whether the wrapper holds an exception.

Returns
Returns true if it holds an exception, false otherwise.

Definition at line 104 of file Instrument.h.

◆ Throw()

void DynExp::ExceptionContainer::Throw ( ) const
inline

Throws the stored exception. Doesn't do anything if there isn't a stored exception.

Definition at line 98 of file Instrument.h.

Member Data Documentation

◆ Exception

std::exception_ptr DynExp::ExceptionContainer::Exception
private

Exception stored in the wrapper.

Definition at line 120 of file Instrument.h.


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