Scope
scope::ScopeController::Impl Class Reference

#include <ScopeController_p.h>

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

Public Member Functions

 Impl ()
 
 ~Impl ()
 
void PrepareQuit ()
 
void Version () const
 
std::wstring CurrentConfigFile () const
 
void InitializeHardware ()
 
void StartLive ()
 
void StartStack ()
 
void StartSingle ()
 
void StartTimeseries ()
 
void StartBehavior ()
 
void Stop ()
 
void UpdateAreaParametersFromGui (const uint32_t &_area)
 
bool LoadParameters (const std::wstring &_filepath)
 
bool SaveParameters (const std::wstring &_filepath)
 
void SaveCurrentWindowPositions ()
 
void SetStageZero ()
 
void StackStartHere ()
 
void StackStopHere ()
 
void ZeroGalvoOutputs ()
 
void OpenCloseShutter (const uint32_t &_area, const bool &_open)
 
bool GetShutterState (const uint32_t &_area) const
 
void TurnOnOffSwitchResonance (const uint32_t &_area, const bool &_on)
 
bool GetSwitchResonanceState (const uint32_t &_area) const
 
void SetFPUButtonsState (const bool &state)
 
void SetGuiCtrlState ()
 
void AttachFrame (gui::CChannelFrame *const cframe)
 
void DetachFrame (gui::CChannelFrame *const cframe)
 
void AttachFrame (gui::CHistogramFrame *const hframe)
 
bool HistogramAlreadyAttached (const uint32_t &_area)
 
void DetachFrame (gui::CHistogramFrame *const hframe)
 
void ResolutionChange (const uint32_t &_area)
 
void SetHistogramLimits (const uint32_t &_area, const uint32_t &_channel, const uint16_t &_lower, const uint16_t &_upper)
 
void SetScanMode (const uint32_t &_area, const ScannerVectorType &_mode)
 
void RegisterScanmodeCallback (std::function< void(const uint32_t &, const ScannerVectorType &)> _callback)
 
- 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 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)
 

Public Attributes

Hardware controllers
FPUController theFPUs
 
SCOPE_XYZCONTROL_T theStage
 

Protected Member Functions

 Impl (const Impl &i)
 
Impl operator= (const Impl &i)
 
void LogRun ()
 
void StartAllControllers ()
 
void StopAllControllers ()
 
void WaitForAllControllers ()
 
void ClearAllQueues ()
 
void SetScannerVectorParameters ()
 
ControllerReturnStatus RunLive (StopCondition *const sc)
 
ControllerReturnStatus RunSingle (StopCondition *const sc)
 
ControllerReturnStatus RunStack (StopCondition *const sc)
 
ControllerReturnStatus RunTimeseries (StopCondition *const sc)
 
ControllerReturnStatus RunBehavior (StopCondition *const sc)
 
void ClearAfterStop ()
 
- Protected Member Functions inherited from scope::BaseController< N_ACTIVES, STATIC_PIMPL >::Impl
virtual ControllerReturnStatus Run (StopCondition *const ac, const uint32_t &_n)
 

Protected Attributes

std::array< SynchronizedQueue< ScopeMessage< SCOPE_DAQCHUNKPTR_T > >, SCOPE_NAREAS > daq_to_pipeline
 
SynchronizedQueue< ScopeMessage< SCOPE_MULTIIMAGEPTR_T > > pipeline_to_storage
 
SynchronizedQueue< ScopeMessage< SCOPE_MULTIIMAGEPTR_T > > pipeline_to_display
 
StopCondition repeat_abort
 
std::condition_variable waitbetweenrepeats_cond
 
std::mutex waitbetweenrepeats_mutex
 
std::future< void > onlineupdate_future
 
std::atomic< bool > onlineupdate_running
 
DWORD time
 
ScopeNumber< bool > initialparametersloaded
 
std::wstring currentconfigfile
 
std::vector< std::function< void(const uint32_t &, const ScannerVectorType &)> > scanmodecallbacks
 
ScopeLogger scope_logger
 
std::array< ScannerVectorFrameBasicPtr, SCOPE_NAREAS > framescannervecs
 
Dataflow controllers
DaqController theDaq
 
PipelineController thePipeline
 
StorageController theStorage
 
DisplayController theDisplay
 
- 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 ScopeController.

Definition at line 32 of file ScopeController_p.h.

Constructor & Destructor Documentation

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

disable copy

scope::ScopeController::Impl::Impl ( )
inlineexplicit

Initializes and connects stuff.

Definition at line 377 of file ScopeController_p.h.

scope::ScopeController::Impl::~Impl ( )
inlinevirtual

Stop whatever is running.

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

Definition at line 438 of file ScopeController_p.h.

Member Function Documentation

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

disable assignment

void scope::ScopeController::Impl::LogRun ( )
inlineprotected

Logs the current scan (not live scans)

Definition at line 97 of file ScopeController_p.h.

void scope::ScopeController::Impl::StartAllControllers ( )
inlineprotected

Starts all controllers with the current parameters.

Definition at line 123 of file ScopeController_p.h.

void scope::ScopeController::Impl::StopAllControllers ( )
inlineprotected

Stops all controllers in the correct order and waits for them to finish.

Definition at line 132 of file ScopeController_p.h.

void scope::ScopeController::Impl::WaitForAllControllers ( )
inlineprotected

Waits for all controllers to intrinsically finish.

Only good for nframes runmode

Definition at line 154 of file ScopeController_p.h.

void scope::ScopeController::Impl::ClearAllQueues ( )
inlineprotected

Clear all queues between controllers.

Definition at line 162 of file ScopeController_p.h.

void scope::ScopeController::Impl::SetScannerVectorParameters ( )
inlineprotected

Set parameters for scanner vectors, since these are shared_ptr in DaqControllerDAQmx and PipelineController they get updated there too.

Definition at line 170 of file ScopeController_p.h.

ControllerReturnStatus scope::ScopeController::Impl::RunLive ( StopCondition *const  sc)
inlineprotected

Worker function to control live scanning (basically only starting everything up)

Definition at line 177 of file ScopeController_p.h.

ControllerReturnStatus scope::ScopeController::Impl::RunSingle ( StopCondition *const  sc)
inlineprotected

Worker function to control a single scan.

Definition at line 186 of file ScopeController_p.h.

ControllerReturnStatus scope::ScopeController::Impl::RunStack ( StopCondition *const  sc)
inlineprotected

Worker function to control a stack scan.

Definition at line 197 of file ScopeController_p.h.

ControllerReturnStatus scope::ScopeController::Impl::RunTimeseries ( StopCondition *const  sc)
inlineprotected

Worker function to control a timeseries scan.

Definition at line 271 of file ScopeController_p.h.

ControllerReturnStatus scope::ScopeController::Impl::RunBehavior ( StopCondition *const  sc)
inlineprotected

Worker function to control a behavior triggered scan.

Definition at line 317 of file ScopeController_p.h.

void scope::ScopeController::Impl::ClearAfterStop ( )
inlineprotected

Clears queues, resets run state, and reenables controls.

Definition at line 359 of file ScopeController_p.h.

void scope::ScopeController::Impl::PrepareQuit ( )
inline

Called via CMainDialogFrame::QuitApplication.

Stops running threads etc, avoids destruction of these when the static pimpl gets destructed (probably very late or undefined).

Definition at line 444 of file ScopeController_p.h.

void scope::ScopeController::Impl::Version ( ) const
inline

Prints out the last Git commit date of the currently running version (see description at ScopeController::Version)

Definition at line 455 of file ScopeController_p.h.

std::wstring scope::ScopeController::Impl::CurrentConfigFile ( ) const
inline
Returns
the currently loaded config file

Definition at line 463 of file ScopeController_p.h.

void scope::ScopeController::Impl::InitializeHardware ( )
inline

(Re-)Initializes ScopeControllers own hardware components (XYControl/Stage, ZControl, and FPU stuff)

Definition at line 468 of file ScopeController_p.h.

void scope::ScopeController::Impl::StartLive ( )
inline

Starts live scanning by running RunLive asynchronously.

Definition at line 475 of file ScopeController_p.h.

void scope::ScopeController::Impl::StartStack ( )
inline

Start a stack scan by running RunStack asynchronously.

Definition at line 490 of file ScopeController_p.h.

void scope::ScopeController::Impl::StartSingle ( )
inline

Starts a single frame scan by running RunSingle asynchronously.

Definition at line 504 of file ScopeController_p.h.

void scope::ScopeController::Impl::StartTimeseries ( )
inline

Starts a timeseries by running RunTimeseries asynchronously.

Definition at line 518 of file ScopeController_p.h.

void scope::ScopeController::Impl::StartBehavior ( )
inline

Starts a behavior triggered acquisition by running RunBehavior asynchronously.

Definition at line 537 of file ScopeController_p.h.

void scope::ScopeController::Impl::Stop ( )
inline

Stops whatever scanning is going on and clears the queues.

Definition at line 551 of file ScopeController_p.h.

void scope::ScopeController::Impl::UpdateAreaParametersFromGui ( const uint32_t &  _area)
inline

Updates area parameters and scanner vectors in the controllers from the GuiParameters set without stopping scanning.

Definition at line 578 of file ScopeController_p.h.

bool scope::ScopeController::Impl::LoadParameters ( const std::wstring &  _filepath)
inline

Loads current parameter set from disk.

Parameters
[in]_filepathpath and name of parameters on disk

Definition at line 623 of file ScopeController_p.h.

bool scope::ScopeController::Impl::SaveParameters ( const std::wstring &  _filepath)
inline

Saves the current parameter set to disk.

Parameters
[in]_filepathpath and name to save to

Definition at line 636 of file ScopeController_p.h.

void scope::ScopeController::Impl::SaveCurrentWindowPositions ( )
inline

Saves current positions of windows by adding frames to WindowCollection of ScopeController::GuiParameters.

Definition at line 643 of file ScopeController_p.h.

void scope::ScopeController::Impl::SetStageZero ( )
inline

Sets the current xyz stage position as zero.

Definition at line 651 of file ScopeController_p.h.

void scope::ScopeController::Impl::StackStartHere ( )
inline

Sets the start stack position to the current z position.

Definition at line 656 of file ScopeController_p.h.

void scope::ScopeController::Impl::StackStopHere ( )
inline

Sets the stop stack position to the current z position.

Definition at line 670 of file ScopeController_p.h.

void scope::ScopeController::Impl::ZeroGalvoOutputs ( )
inline

Calls the DaqController to set Galvo outputs to zero.

Definition at line 684 of file ScopeController_p.h.

void scope::ScopeController::Impl::OpenCloseShutter ( const uint32_t &  _area,
const bool &  _open 
)
inline

Opens/closes the shutter.

Definition at line 692 of file ScopeController_p.h.

bool scope::ScopeController::Impl::GetShutterState ( const uint32_t &  _area) const
inline
Returns
current state of the shutter

Definition at line 697 of file ScopeController_p.h.

void scope::ScopeController::Impl::TurnOnOffSwitchResonance ( const uint32_t &  _area,
const bool &  _on 
)
inline

Turns the resonance scanner relay on and off.

Definition at line 702 of file ScopeController_p.h.

bool scope::ScopeController::Impl::GetSwitchResonanceState ( const uint32_t &  _area) const
inline
Returns
current state of the first resonance scanner relay

Definition at line 707 of file ScopeController_p.h.

void scope::ScopeController::Impl::SetFPUButtonsState ( const bool &  state)
inline

Sets the state of the GUI buttons for FPU control (via the corresponding ScopeButtons).

True = enabled, false = disabled.

Definition at line 712 of file ScopeController_p.h.

void scope::ScopeController::Impl::SetGuiCtrlState ( )
inline

Sets the state of GUI controls (via the corresponding ScopeNumbers).

True = read&write/enabled, false = readonly/disabled. Other GUI elements can connect to ReadOnlyWhileScanning.

Definition at line 723 of file ScopeController_p.h.

void scope::ScopeController::Impl::AttachFrame ( gui::CChannelFrame *const  cframe)
inline

Attach a CChannelFrame as observer.

Definition at line 757 of file ScopeController_p.h.

void scope::ScopeController::Impl::DetachFrame ( gui::CChannelFrame *const  cframe)
inline

Detach an observing CChannelFrame.

Definition at line 762 of file ScopeController_p.h.

void scope::ScopeController::Impl::AttachFrame ( gui::CHistogramFrame *const  hframe)
inline

Attach a CHistogramFrame as observer.

Definition at line 767 of file ScopeController_p.h.

bool scope::ScopeController::Impl::HistogramAlreadyAttached ( const uint32_t &  _area)
inline
Returns
true if at least one histogram already attached to theDisplay for that area.

Definition at line 772 of file ScopeController_p.h.

void scope::ScopeController::Impl::DetachFrame ( gui::CHistogramFrame *const  hframe)
inline

Detach an observing CHistogramFrame.

Definition at line 777 of file ScopeController_p.h.

void scope::ScopeController::Impl::ResolutionChange ( const uint32_t &  _area)
inline

Called via change of GuiParameters.areas[x].framesaw.scanvec.xres etc.

Definition at line 782 of file ScopeController_p.h.

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

Sets the color limits for displaying imgages, calls DisplayController::SetHistogramLimits.

Definition at line 787 of file ScopeController_p.h.

void scope::ScopeController::Impl::SetScanMode ( const uint32_t &  _area,
const ScannerVectorType _mode 
)
inline

Sets the type of scanning.

Called via ScopeController ScanModeButtons. Calls the scanmode callbacks. Updates/recreates the scanvectors from a different type and sets them in theDaq and thePipeline

Definition at line 794 of file ScopeController_p.h.

void scope::ScopeController::Impl::RegisterScanmodeCallback ( std::function< void(const uint32_t &, const ScannerVectorType &)>  _callback)
inline

Registers a function to call when scanmode is changed.

Usually CScanSettingsSheet registers for switching between FrameScan property pages.

Definition at line 813 of file ScopeController_p.h.

Member Data Documentation

std::array<SynchronizedQueue<ScopeMessage<SCOPE_DAQCHUNKPTR_T> >, SCOPE_NAREAS> scope::ScopeController::Impl::daq_to_pipeline
protected

queues from the daqs to the pipelines

Definition at line 37 of file ScopeController_p.h.

SynchronizedQueue<ScopeMessage<SCOPE_MULTIIMAGEPTR_T> > scope::ScopeController::Impl::pipeline_to_storage
protected

queue from the pipelines to the storage

Definition at line 40 of file ScopeController_p.h.

SynchronizedQueue<ScopeMessage<SCOPE_MULTIIMAGEPTR_T> > scope::ScopeController::Impl::pipeline_to_display
protected

queue from the pipelines to the display

Definition at line 43 of file ScopeController_p.h.

std::array<ScannerVectorFrameBasicPtr, SCOPE_NAREAS> scope::ScopeController::Impl::framescannervecs
protected

Scanner vectors.

The scanner vector for frame scanning

Definition at line 48 of file ScopeController_p.h.

StopCondition scope::ScopeController::Impl::repeat_abort
protected

thread-safe bool to signal a requested abort of a stack scan

Definition at line 60 of file ScopeController_p.h.

std::condition_variable scope::ScopeController::Impl::waitbetweenrepeats_cond
protected

for abortable waiting between timeseries repeats

Definition at line 63 of file ScopeController_p.h.

std::mutex scope::ScopeController::Impl::waitbetweenrepeats_mutex
protected

for abortable waiting between timeseries repeats

Definition at line 66 of file ScopeController_p.h.

std::future<void> scope::ScopeController::Impl::onlineupdate_future
protected

future for the online update thread

Definition at line 69 of file ScopeController_p.h.

std::atomic<bool> scope::ScopeController::Impl::onlineupdate_running
protected

set if an online update is currently running, to prevent to simultaneous online update threads

Definition at line 72 of file ScopeController_p.h.

DWORD scope::ScopeController::Impl::time
protected

stores the time to run a scan

Definition at line 75 of file ScopeController_p.h.

ScopeNumber<bool> scope::ScopeController::Impl::initialparametersloaded
protected

true after parameter set on program start is loaded

Definition at line 78 of file ScopeController_p.h.

std::wstring scope::ScopeController::Impl::currentconfigfile
protected

currently loaded config

Definition at line 81 of file ScopeController_p.h.

std::vector<std::function<void(const uint32_t&, const ScannerVectorType&)> > scope::ScopeController::Impl::scanmodecallbacks
protected

list of callbacks for scan mode switching

Definition at line 84 of file ScopeController_p.h.

ScopeLogger scope::ScopeController::Impl::scope_logger
protected

a logger kept handy

Definition at line 87 of file ScopeController_p.h.


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