Scope
scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl Class Reference

#include <BaseController_p.h>

Inherited by scope::DaqController::Impl, scope::DisplayController::Impl, scope::PipelineController::Impl, scope::ScopeController::Impl, and scope::StorageController::Impl.

Public Member Functions

 Impl (const parameters::Scope &_parameters)
 
virtual ~Impl ()
 
virtual void Start (const parameters::Scope &_params)
 
virtual void StopOne (const uint32_t &_a)
 
virtual void StopAll ()
 
virtual ControllerReturnStatus WaitForOne (const uint32_t &_a, const int32_t &_wait_time)
 
virtual ControllerReturnStatus WaitForAll (const int32_t &_wait_time)
 

Protected Member Functions

virtual ControllerReturnStatus Run (StopCondition *const ac, const uint32_t &_n)
 

Protected Attributes

std::array< std::shared_future< ControllerReturnStatus >, N_ACTIVES > futures
 
std::array< StopCondition, N_ACTIVES > stops
 
parameters::Scope parameters
 

Private Member Functions

 Impl (const Impl &i)
 
Impl operator= (const Impl &i)
 

Detailed Description

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
class scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl

Implementation class of the BaseController, uses std::async to execute worker functions in a separate thread.

Definition at line 11 of file BaseController_p.h.

Constructor & Destructor Documentation

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::Impl ( const Impl i)
private

disable copy

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::Impl ( const parameters::Scope _parameters)
inline
Parameters
[in]_parametersinitial set of ScopeParameters

Definition at line 44 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::~Impl ( )
inlinevirtual

It is important that this is virtual, only by this the correct destructor for the pimpl is called in derived classes (since we are using the one BaseControllerImpl* pointer to store also derived Impl class objects.

Reimplemented in scope::ScopeController::Impl, scope::StorageController::Impl, scope::PipelineController::Impl, scope::DaqController::Impl, and scope::DisplayController::Impl.

Definition at line 50 of file BaseController_p.h.

Member Function Documentation

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
Impl scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::operator= ( const Impl i)
private

disable assignment

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual ControllerReturnStatus scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::Run ( StopCondition *const  ac,
const uint32_t &  _n 
)
inlineprotectedvirtual

The worker function that will run asynchronously.

Warning
Every work function should regularly check the stop condition and should return on a boost::thread_interrupted exception.
Returns
since this is only a dummy, always returns ControllerReturnStatus(error).

Reimplemented in scope::DaqController::Impl, scope::DisplayController::Impl, scope::PipelineController::Impl, and scope::StorageController::Impl.

Definition at line 34 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual void scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::Start ( const parameters::Scope _params)
inlinevirtual

Execute the Run worker functions asynchronously, give them a reference to a StopCondition and get their ControllerReturnStatus futures.

Parameters
[in]_paramsnew set of ScopeParameters to use in the Controller (and its worker functions)

Reimplemented in scope::DaqController::Impl.

Definition at line 56 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual void scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::StopOne ( const uint32_t &  _a)
inlinevirtual

Request one async worker function to stop by settings its StopCondition to true.

Parameters
[in]_awhich async to stop

Reimplemented in scope::StorageController::Impl, scope::PipelineController::Impl, and scope::DisplayController::Impl.

Definition at line 68 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual void scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::StopAll ( )
inlinevirtual

Request all async worker function to stop.

Definition at line 74 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual ControllerReturnStatus scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::WaitForOne ( const uint32_t &  _a,
const int32_t &  _wait_time 
)
inlinevirtual

Waits for the future of one async worker function.

Parameters
[in]_awhich async to wait for
[in]_wait_timein milliseconds to wait for the worker function to return, if -1 wait indefinitely
Returns
the future value

Definition at line 84 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
virtual ControllerReturnStatus scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::WaitForAll ( const int32_t &  _wait_time)
inlinevirtual

Wait for the futures of all async worker functions.

Parameters
[in]_wait_timetime in milliseconds to wait for the async worker function to return, if -1 wait indefinitely
Returns
the cumulated (or'ed) ControllerReturnStatus' from all async worker functions' futures

Definition at line 110 of file BaseController_p.h.

Member Data Documentation

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
std::array<std::shared_future<ControllerReturnStatus>, N_ACTIVES> scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::futures
protected

futures from the asynchronous Run worker functions

Definition at line 15 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
std::array<StopCondition, N_ACTIVES> scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::stops
protected

handed to the asynchronous Run worker functions

Definition at line 18 of file BaseController_p.h.

template<uint32_t N_ACTIVES = 1, bool STATIC_PIMPL = false>
parameters::Scope scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl::parameters
protected

the Controller's own set of ScopeParameters

Definition at line 21 of file BaseController_p.h.


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