Scope
scope::DisplayController::Impl Class Reference

#include <DisplayController_p.h>

Inherits scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl.

Public Member Functions

 Impl (SynchronizedQueue< ScopeMessage< SCOPE_MULTIIMAGEPTR_T >> *const _iqueue, const parameters::Scope _parameters)
 
virtual ~Impl ()
 
void StopOne (const uint32_t &_a) override
 
void ResolutionChange (const parameters::Area &_ap)
 
void SetHistogramLimits (const uint32_t &_area, const uint32_t &_channel, const uint16_t &_lower, const uint16_t &_upper)
 
void AttachFrame (gui::CChannelFrame *const _cframe)
 
void DetachFrame (gui::CChannelFrame *const _cframe)
 
void AttachFrame (gui::CHistogramFrame *const _hframe)
 
bool HistogramAlreadyAttached (const uint32_t &_area) const
 
void DetachFrame (gui::CHistogramFrame *const _hframe)
 
parameters::WindowCollection GetWindowCollection () const
 
- Public Member Functions inherited from scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl
 Impl (const parameters::Scope &_parameters)
 
virtual void Start (const parameters::Scope &_params)
 
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

 Impl (const Impl &i)
 
Impl operator= (const Impl &i)
 
ControllerReturnStatus Run (StopCondition *const sc, const uint32_t &_area) override
 
void UpdateStatusInFrames (const RunState &_rs)
 

Protected Attributes

SynchronizedQueue< ScopeMessage< SCOPE_MULTIIMAGEPTR_T > > *const input_queue
 
ScopeLogger scope_logger
 
std::array< std::vector< gui::CChannelFrame *const >, SCOPE_NAREAS > channelframes
 
std::array< std::mutex, SCOPE_NAREAS > channelframes_mutexe
 
std::array< std::vector< gui::CHistogramFrame *const >, SCOPE_NAREAS > histogramframes
 
std::array< std::mutex, SCOPE_NAREAS > histogramframes_mutexe
 
- Protected Attributes inherited from scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl
std::array< std::shared_future< ControllerReturnStatus >, N_ACTIVES > futures
 
std::array< StopCondition, N_ACTIVES > stops
 
parameters::Scope parameters
 

Detailed Description

The implementation class of the DisplayController.

There is only one Run thread (not one for every area since the heavy work is done inside CChannelFrame and CHistogramFrame) This passes images arriving from the PipelineController to attached CChannelFrame and CHistogramFrame were the actual calculations (overlay, histogram) and renderings take place.

Definition at line 19 of file DisplayController_p.h.

Constructor & Destructor Documentation

scope::DisplayController::Impl::Impl ( const Impl i)
protected

disable copy

scope::DisplayController::Impl::Impl ( SynchronizedQueue< ScopeMessage< SCOPE_MULTIIMAGEPTR_T >> *const  _iqueue,
const parameters::Scope  _parameters 
)
inlineexplicit

Connects queue and gets parameters.

Definition at line 143 of file DisplayController_p.h.

virtual scope::DisplayController::Impl::~Impl ( )
inlinevirtual

Stops and interrupts thread if necessary.

Reimplemented from scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl.

Definition at line 150 of file DisplayController_p.h.

Member Function Documentation

Impl scope::DisplayController::Impl::operator= ( const Impl i)
protected

disable assignment

ControllerReturnStatus scope::DisplayController::Impl::Run ( StopCondition *const  sc,
const uint32_t &  _area 
)
inlineoverrideprotectedvirtual

Main function for managing display.

It is executed asynchronously. The actual overlay creations, histogram calculations, and rendering are done in the Active's threads inside CChannelFrame/View and CHistogramFrame/View. Only one Run thread, so _area parameter here is always 0. We dequeue images from the input queue and distribute to the areas CChannelFrame and CHistogramFrame these belong to.

Reimplemented from scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl.

Definition at line 53 of file DisplayController_p.h.

void scope::DisplayController::Impl::UpdateStatusInFrames ( const RunState _rs)
inlineprotected

Calls CChannelFrame::UpdateStatus and CHistogramFrame::UpdateStatus in all attached frames.

Definition at line 130 of file DisplayController_p.h.

void scope::DisplayController::Impl::StopOne ( const uint32_t &  _a)
inlineoverridevirtual

We need to override here.

The dequeue in Run could block/wait since nothing is in the queue. To stop we put a message with abort tag in, it gets dequeued and we break from the while loop. (In addition we call BaseController::Impl::StopOne which sets the StopCondition to true.

Reimplemented from scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl.

Definition at line 159 of file DisplayController_p.h.

void scope::DisplayController::Impl::ResolutionChange ( const parameters::Area _ap)
inline

Go through all CChannelFrames and request resize to cope with new image size.

Parameters
[in]_apcontains the new x and y resolution of images

Definition at line 167 of file DisplayController_p.h.

void scope::DisplayController::Impl::SetHistogramLimits ( const uint32_t &  _area,
const uint32_t &  _channel,
const uint16_t &  _lower,
const uint16_t &  _upper 
)
inline

Go through all CChannelFrames of that area and set the histogram limits there.

Parameters
[in]_area,_channelarea and channel to set limits
[in]_lower,_uppernew lower and upper histogram limits

Definition at line 177 of file DisplayController_p.h.

void scope::DisplayController::Impl::AttachFrame ( gui::CChannelFrame *const  _cframe)
inline

Attaches a CChannelFrame as observer to the DisplayController.

Parameters
[in]_cframepointer to the new CChannelFrame observer

Definition at line 185 of file DisplayController_p.h.

void scope::DisplayController::Impl::DetachFrame ( gui::CChannelFrame *const  _cframe)
inline

Detaches a CChannelFrame as observer from the DisplayController.

Parameters
[in]_cframepointer to the CChannelFrame to detach
Exceptions
std::exceptionif _cframe is not found

Definition at line 195 of file DisplayController_p.h.

void scope::DisplayController::Impl::AttachFrame ( gui::CHistogramFrame *const  _hframe)
inline

Attaches a CHistogramFrame as observer to the DisplayController.

Parameters
[in]_hframepointer to the new CHistogramFrame observer

Definition at line 209 of file DisplayController_p.h.

bool scope::DisplayController::Impl::HistogramAlreadyAttached ( const uint32_t &  _area) const
inline
Returns
true if alreay at least one histogram for that area attached, used to avoid several histograms for the same area.

Definition at line 218 of file DisplayController_p.h.

void scope::DisplayController::Impl::DetachFrame ( gui::CHistogramFrame *const  _hframe)
inline

Detaches a CHistogramFrame as observer from the DisplayController.

Parameters
[in]_hframepointer to the CHistogramFrame to detach
Exceptions
std::exceptionif _hframe is not found

Definition at line 226 of file DisplayController_p.h.

parameters::WindowCollection scope::DisplayController::Impl::GetWindowCollection ( ) const
inline

Adds frames to a WindowCollection.

Definition at line 239 of file DisplayController_p.h.

Member Data Documentation

SynchronizedQueue<ScopeMessage<SCOPE_MULTIIMAGEPTR_T> >* const scope::DisplayController::Impl::input_queue
protected

Input queue with multi images from the PipelineController.

Definition at line 24 of file DisplayController_p.h.

ScopeLogger scope::DisplayController::Impl::scope_logger
protected

a ScopeLogger kept handy here

Definition at line 27 of file DisplayController_p.h.

std::array<std::vector<gui::CChannelFrame* const>, SCOPE_NAREAS> scope::DisplayController::Impl::channelframes
protected

Vector of CChannelFrame observers.

Definition at line 30 of file DisplayController_p.h.

std::array<std::mutex, SCOPE_NAREAS> scope::DisplayController::Impl::channelframes_mutexe
mutableprotected

Mutex to protect access to that vector.

Definition at line 33 of file DisplayController_p.h.

std::array<std::vector<gui::CHistogramFrame* const>, SCOPE_NAREAS> scope::DisplayController::Impl::histogramframes
protected

Vector of CHistogramFrame observers.

Definition at line 36 of file DisplayController_p.h.

std::array<std::mutex, SCOPE_NAREAS> scope::DisplayController::Impl::histogramframes_mutexe
mutableprotected

Mutex to protect access to that vector.

Definition at line 39 of file DisplayController_p.h.


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