DynExp
Highly flexible laboratory automation for dynamically changing experiments.
DynExpInstr::CameraTasks::UpdateTask Class Referenceabstract

Defines a task for updating an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an update task class derived from UpdateTaskBase. Even if the task does not do anything, at least it has to call UpdateTaskBase::UpdateFuncImpl() of the derived instrument's update task class. More...

+ Inheritance diagram for DynExpInstr::CameraTasks::UpdateTask:

Private Member Functions

void UpdateFuncImpl (dispatch_tag< UpdateTaskBase >, DynExp::InstrumentInstance &Instance) override final
 
virtual void UpdateFuncImpl (dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
 Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() of a derived instrument's update task as the last command in a base instrument's update task UpdateFuncImpl() to ensure that derived instruments are updated after base instruments. Overriding functions must throw an exception in case of an error. More...
 
virtual QImage ObtainImage (DynExp::InstrumentInstance &Instance)=0
 Retrieves the current image from the underlying hardware device, applies image transformations (e.g. brightness/contrast corrections), and returns the image. More...
 

Additional Inherited Members

- Public Types inherited from DynExp::TaskBase
enum class  TaskState {
  Waiting , Locked , Running , Finished ,
  Failed , Aborted
}
 Defines states an instrument's task can undergo. Possible state transitions are: More...
 
using CallbackType = std::function< void(const TaskBase &, ExceptionContainer &)>
 Type of a callback function which is invoked when a task has finished, failed or has been aborted. The function receives a reference to the task it originates from as well as a reference to a wrapper holding an exception which might have occurred while executing the task. More...
 
- Public Member Functions inherited from DynExp::TaskBase
 TaskBase (CallbackType CallbackFunc=nullptr) noexcept
 Constructs an instrument task. More...
 
virtual ~TaskBase ()=0
 The destructor aborts a waiting task setting State to TaskState::Aborted. Then, it calls CallbackFunc with a default-constructed ExceptionContainer instance. More...
 
TaskState GetState () const noexcept
 Getter for the instrument task's current state. More...
 
bool IsLocked () const noexcept
 Determines whether the task is locked. More...
 
bool IsAborting () const noexcept
 Determines whether the task should abort. A derived task is encouraged to call this method before performing any action or in between the individual steps of a more complex action. More...
 
int GetErrorCode () const noexcept
 Getter for the error code related to an error possibly occurred while the task was executed. More...
 
void Abort ()
 Requests the task to abort. There is no guarantee that the derived task does call IsAborting() to check whether it should abort. The task could have finished already or the implementation of RunChild() in the derived class does not allow for aborting. More...
 
- Public Attributes inherited from DynExp::TaskBase
InstrumentBaseOnlyType InstrumentBaseOnly
 Allow exclusive access to some of TaskBase's private methods to InstrumentBase. More...
 
InstrumentDataBaseOnlyType InstrumentDataBaseOnly
 Allow exclusive access to some of TaskBase's private methods to InstrumentDataBase. More...
 

Detailed Description

Defines a task for updating an instrument within an instrument inheritance hierarchy. Each instrument (indirectly) derived from class InstrumentBase must be accompanied by an update task class derived from UpdateTaskBase. Even if the task does not do anything, at least it has to call UpdateTaskBase::UpdateFuncImpl() of the derived instrument's update task class.

Definition at line 51 of file Camera.h.

Member Function Documentation

◆ ObtainImage()

virtual QImage DynExpInstr::CameraTasks::UpdateTask::ObtainImage ( DynExp::InstrumentInstance Instance)
privatepure virtual

Retrieves the current image from the underlying hardware device, applies image transformations (e.g. brightness/contrast corrections), and returns the image.

Parameters
InstanceHandle to the instrument thread's data
Returns
Transformed current image. Use e.g. Util::QImageFromBlobData() to create the image to be returned.

Implemented in DynExpInstr::PVCamTasks::UpdateTask, and DynExpInstr::DummyCameraTasks::UpdateTask.

◆ UpdateFuncImpl() [1/2]

virtual void DynExpInstr::CameraTasks::UpdateTask::UpdateFuncImpl ( dispatch_tag< UpdateTask ,
DynExp::InstrumentInstance Instance 
)
inlineprivatevirtual

Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() of a derived instrument's update task as the last command in a base instrument's update task UpdateFuncImpl() to ensure that derived instruments are updated after base instruments. Overriding functions must throw an exception in case of an error.

Parameters
InstanceHandle to the instrument thread's data

Reimplemented in DynExpInstr::PVCamTasks::UpdateTask, and DynExpInstr::DummyCameraTasks::UpdateTask.

Definition at line 58 of file Camera.h.

◆ UpdateFuncImpl() [2/2]

void DynExpInstr::CameraTasks::UpdateTask::UpdateFuncImpl ( dispatch_tag< UpdateTaskBase >  ,
DynExp::InstrumentInstance Instance 
)
finaloverrideprivate

Definition at line 8 of file Camera.cpp.


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