SctCalibrationController::CalibrationControllerImpl Class Reference

Implementation of the CalibrationController interface. More...

#include <CalibrationControllerImpl.h>

Inheritance diagram for SctCalibrationController::CalibrationControllerImpl:

Inheritance graph
[legend]
Collaboration diagram for SctCalibrationController::CalibrationControllerImpl:

Collaboration graph
[legend]

Public Member Functions

virtual void shutdown ()
 Initializes the singleton - should only be called by main or the RunController.
Overrides
Note:
all nothrow


virtual Sct_CalibrationController::ScanLibrary_ptr getScanLibrary ()
virtual Sct_CalibrationController::TestLibrary_ptr getTestLibrary ()
virtual Sct_CalibrationController::SequenceLibrary_ptr getSequenceLibrary ()
virtual void doScan (Sct_CalibrationController::ScanRequest_ptr r)
virtual void doTest (Sct_CalibrationController::TestRequest_ptr t)
virtual void doSequence (Sct_CalibrationController::SequenceRequest_ptr r)
virtual void abort ()
virtual Sct_SctApi::Scan_ptr getScan (unsigned long runNumber, unsigned long scanNumber)
virtual void setUpdateOption (Sct_CalibrationController::CalibrationController::UpdateOption opt)
virtual void updateWith (const char *testResultInIs, bool force)
Internal for communication with RunControl:
Note:
all nothrow


void setApi (Sct_SctApi::SctApiIPC_ptr api)
 Sets the SctApi reference.
void takeControl (unsigned int runNumber)
 The RunController calls this to tell the CC to take control The CC is then in charge until giveupControl is called.
void giveupControl ()
 Called when the CC is no longer in charge.
void reset ()
 Called when a reset is requested.
Internal for use by other classes
Note:
all nothrow


Sct_SctApi::SctApiIPC_ptr getApi ()
 Get the handle to the SctApi.
unsigned int getRunNumber () const
 Get the current run number.
unsigned int getNextScanNumber () const
 Get the number of the next scan.

Static Public Member Functions

static CalibrationControllerImplinitialize (RunControl &rc)
static Sct_CalibrationController::CalibrationController_ptr instance ()
 Gets the CC instance.

Private Member Functions

 CalibrationControllerImpl (RunControl &rc)
virtual ~CalibrationControllerImpl ()
void updateStatus ()
bool isInControl ()
bool isBusy ()
void setBusy (bool busy)
void executeSequence (Sct_CalibrationController::SequenceRequest_ptr sr)
 Executes a sequence.
auto_ptr< TestexecuteTest (Sct_CalibrationController::TestRequest_ptr tr, boost::shared_ptr< const Sequence > s)
 Executes a Test
Exceptions:
SctApiAccessException if there is some problem accessing the Api
IllegalArgumentError if the api pointer is null.

void executeScan (Sct_CalibrationController::ScanRequest_ptr s, unsigned int index)
 Executes a Scan and waits for the Scan to be completed
Exceptions:
SctApiAccessException if there is some problem accessing the Api
IllegalArgumentError if the api pointer is null.

void applyChanges (const unsigned long runNumber, const unsigned long scanNumber, const std::list< std::string > &list)
 Applies changes from the TestResults for a given run and scan number to a list of modules
Exceptions:
SctApiAccessException if there is some problem accessing the Api
IllegalArgumentError if the api pointer is null.

void sctApiError (SctApiAccessException &e)
 Should be called by all nothrow methods when they catch an SctApiAccessException.
void setNextScanNumber (unsigned int scanNumber)
 Sets the next scan number .

Static Private Member Functions

static std::list< std::string > getAllModulesForScan (Sct_SctApi::Scan_ptr scan)
 Utility function: get all modules in all modulegroups for a particular scan.
static CalibrationControllerImplunderlyingInstance ()

Private Attributes

Sct_SctApi::SctApiIPC_ptr m_api
CalibrationControllerStatus status
 Our current status.
RunControlrc
 The RunController.
unsigned int runNumber
 The current run number.
unsigned int nextScanNumber
 The number of the next scan.
volatile bool abortNow
 Flag used to indicate the user has requested an abort.
volatile bool abortRightNow
 Flag used to indicate that the Api is no longer running and we should not wait for the end of the current scan.
boost::thread_group m_sequence_request_thread_group
 The worker group that handles executing sequences.

Static Private Attributes

static CalibrationControllerImplinst
 The singleton object. Not valid until initialize has been called.

Friends

class SequenceRequestWorker
 The worker group class.

Detailed Description

Implementation of the CalibrationController interface.

A singleton, it controls the synchronisation of the various tasks required during testing and calibration.

There is an abort method which allows the premature termination of a sequence or test after the end of the current scan.

Maintains a reference to a SctApi, to which it forwards requests for scans. Requests for sequencees, tests and scans can be made only when in control.

Publishes its status in IS as CalibrationControllerStatus.

Author:
Matthew Palmer

Definition at line 45 of file CalibrationControllerImpl.h.


Member Function Documentation

void SctCalibrationController::CalibrationControllerImpl::abort  )  [virtual]
 

If the CC is not busy there is nothing to abort, so ignore:

Definition at line 154 of file CalibrationControllerImpl.cpp.

References abortNow, abortRightNow, CalibrationControllerStatus::BUSY, getApi(), CalibrationControllerStatus::status, and status.

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::applyChanges const unsigned long  runNumber,
const unsigned long  scanNumber,
const std::list< std::string > &  list
[private]
 

Applies changes from the TestResults for a given run and scan number to a list of modules

Exceptions:
SctApiAccessException if there is some problem accessing the Api
IllegalArgumentError if the api pointer is null.

Definition at line 273 of file CalibrationControllerImpl.cpp.

References getApi(), SctCalibrationController::ConfigUpdaterManager::instance(), Sct::IS::IOManagerIS::instance(), status, SctCalibrationController::ConfigUpdaterManager::update(), and CalibrationControllerStatus::updateOption.

Referenced by executeSequence().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::executeScan Sct_CalibrationController::ScanRequest_ptr  s,
unsigned int  index
[private]
 

Executes a Scan and waits for the Scan to be completed

Exceptions:
SctApiAccessException if there is some problem accessing the Api
IllegalArgumentError if the api pointer is null.

Definition at line 548 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::currentScanIndex, getApi(), nextScanNumber, status, and updateStatus().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::executeSequence Sct_CalibrationController::SequenceRequest_ptr  sr  )  [private]
 

Executes a sequence.

Note:
nothrow

Definition at line 172 of file CalibrationControllerImpl.cpp.

References applyChanges(), SctCalibrationController::Sequence::create(), CalibrationControllerStatus::currentSequence, executeTest(), getApi(), getNextScanNumber(), getRunNumber(), nextScanNumber, runNumber, sctApiError(), Sct::AbstractThrowable::sendToMrs(), status, and updateStatus().

Referenced by SctCalibrationController::SequenceRequestWorker::operator()().

Here is the call graph for this function:

auto_ptr<Test> SctCalibrationController::CalibrationControllerImpl::executeTest Sct_CalibrationController::TestRequest_ptr  tr,
boost::shared_ptr< const Sequence s
[private]
 

Executes a Test

Exceptions:
SctApiAccessException if there is some problem accessing the Api
IllegalArgumentError if the api pointer is null.

Referenced by executeSequence().

static std::list<std::string> SctCalibrationController::CalibrationControllerImpl::getAllModulesForScan Sct_SctApi::Scan_ptr  scan  )  [static, private]
 

Utility function: get all modules in all modulegroups for a particular scan.

Sct_SctApi::SctApiIPC_ptr SctCalibrationController::CalibrationControllerImpl::getApi  ) 
 

Get the handle to the SctApi.

Definition at line 71 of file CalibrationControllerImpl.cpp.

References m_api.

Referenced by abort(), applyChanges(), executeScan(), executeSequence(), setNextScanNumber(), and updateWith().

unsigned int SctCalibrationController::CalibrationControllerImpl::getNextScanNumber  )  const
 

Get the number of the next scan.

Definition at line 144 of file CalibrationControllerImpl.cpp.

References nextScanNumber.

Referenced by executeSequence().

unsigned int SctCalibrationController::CalibrationControllerImpl::getRunNumber  )  const
 

Get the current run number.

Definition at line 140 of file CalibrationControllerImpl.cpp.

References runNumber.

Referenced by executeSequence().

void SctCalibrationController::CalibrationControllerImpl::giveupControl  ) 
 

Called when the CC is no longer in charge.

Definition at line 115 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::INCONTROL, CalibrationControllerStatus::LOADED, CalibrationControllerStatus::status, status, and updateStatus().

Referenced by SctCalibrationController::RunControl::sctApiError(), and SctCalibrationController::RunControl::stopEFAction().

Here is the call graph for this function:

Sct_CalibrationController::CalibrationController_ptr SctCalibrationController::CalibrationControllerImpl::instance  )  [static]
 

Gets the CC instance.

Definition at line 592 of file CalibrationControllerImpl.cpp.

References inst.

Referenced by SctCalibrationController::Scripts::DefaultScan::defaultScan(), SctCalibrationController::Scripts::TxCurrentTest::getNextScanRealImpl(), SctCalibrationController::Scripts::TrimRangeTest::getNextScanRealImpl(), SctCalibrationController::Scripts::TimeWalkTest::getNextScanRealImpl(), SctCalibrationController::Scripts::TimClockDelayTest::getNextScanRealImpl(), SctCalibrationController::Scripts::ThreePointGainTest::getNextScanRealImpl(), SctCalibrationController::Scripts::SynchTriggerNoiseTest::getNextScanRealImpl(), SctCalibrationController::Scripts::SynchDoubleTriggerNoiseTest::getNextScanRealImpl(), SctCalibrationController::Scripts::StrobeDelayTest::getNextScanRealImpl(), SctCalibrationController::Scripts::RxThresholdTest::getNextScanRealImpl(), SctCalibrationController::Scripts::RxThresholdBasedOnConfigRegisterTest::getNextScanRealImpl(), SctCalibrationController::Scripts::RxDelayTest::getNextScanRealImpl(), SctCalibrationController::Scripts::ResponseCurve::getNextScanRealImpl(), SctCalibrationController::Scripts::QuickTrimTest::getNextScanRealImpl(), SctCalibrationController::Scripts::QuickTrimRangeTest::getNextScanRealImpl(), SctCalibrationController::Scripts::QuickNMaskTest::getNextScanRealImpl(), SctCalibrationController::Scripts::PreTriggerNoiseTest::getNextScanRealImpl(), SctCalibrationController::Scripts::PipelineTest::getNextScanRealImpl(), SctCalibrationController::Scripts::NoiseOccupancyTest::getNextScanRealImpl(), SctCalibrationController::Scripts::NMaskTest::getNextScanRealImpl(), SctCalibrationController::Scripts::FullBypassEndcapTest::getNextScanRealImpl(), SctCalibrationController::Scripts::FullBypassBarrelTest::getNextScanRealImpl(), SctCalibrationController::Scripts::FivePointGainTest::getNextScanRealImpl(), SctCalibrationController::Scripts::DoubleTriggerNoiseTest::getNextScanRealImpl(), SctCalibrationController::Scripts::ChipCounterTest::getNextScanRealImpl(), SctCalibrationController::Scripts::QuickCharacterizationSequence::getNextTest(), SctCalibrationController::Scripts::CharacterizationSequence::getNextTest(), SctCalibrationController::Scripts::NMaskScan::nmaskScan(), SctCalibrationController::Scripts::NoiseOccupancyScan::noiseOccupancyScan(), SctCalibrationController::Scripts::RawScan::rawScan(), SctCalibrationController::Scripts::StrobeDelayScan::strobeDelayScan(), SctCalibrationController::Scripts::ThresholdScan::thresholdScan(), and SctCalibrationController::Scripts::TokenScan::tokenScan().

void SctCalibrationController::CalibrationControllerImpl::reset  ) 
 

Called when a reset is requested.

Definition at line 92 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::LOADED, m_api, CalibrationControllerStatus::status, status, and updateStatus().

Referenced by SctCalibrationController::RunControl::resetAction(), and SctCalibrationController::RunControl::unloadAction().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::sctApiError SctApiAccessException e  )  [private]
 

Should be called by all nothrow methods when they catch an SctApiAccessException.

Informs the RunController that an exception has occured and puts it into an error state

Definition at line 99 of file CalibrationControllerImpl.cpp.

References rc, SctCalibrationController::RunControl::sctApiError(), updateStatus(), and Sct::AbstractThrowable::what().

Referenced by executeSequence().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::setApi Sct_SctApi::SctApiIPC_ptr  api  ) 
 

Sets the SctApi reference.

Definition at line 88 of file CalibrationControllerImpl.cpp.

References m_api.

Referenced by SctCalibrationController::RunControl::loadAction().

void SctCalibrationController::CalibrationControllerImpl::setNextScanNumber unsigned int  scanNumber  )  [private]
 

Sets the next scan number .

Definition at line 148 of file CalibrationControllerImpl.cpp.

References getApi(), and nextScanNumber.

Here is the call graph for this function:

virtual void SctCalibrationController::CalibrationControllerImpl::shutdown  )  [inline, virtual]
 

Initializes the singleton - should only be called by main or the RunController.

Definition at line 50 of file CalibrationControllerImpl.h.

void SctCalibrationController::CalibrationControllerImpl::takeControl unsigned int  runNumber  ) 
 

The RunController calls this to tell the CC to take control The CC is then in charge until giveupControl is called.

Definition at line 104 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::INCONTROL, CalibrationControllerStatus::LOADED, m_api, nextScanNumber, CalibrationControllerStatus::status, status, and updateStatus().

Referenced by SctCalibrationController::RunControl::prepareAction().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class SequenceRequestWorker [friend]
 

The worker group class.

Definition at line 184 of file CalibrationControllerImpl.h.

Referenced by doSequence().


Field Documentation

volatile bool SctCalibrationController::CalibrationControllerImpl::abortNow [private]
 

Flag used to indicate the user has requested an abort.

Definition at line 178 of file CalibrationControllerImpl.h.

Referenced by abort().

volatile bool SctCalibrationController::CalibrationControllerImpl::abortRightNow [private]
 

Flag used to indicate that the Api is no longer running and we should not wait for the end of the current scan.

Definition at line 179 of file CalibrationControllerImpl.h.

Referenced by abort().

CalibrationControllerImpl * SctCalibrationController::CalibrationControllerImpl::inst [static, private]
 

The singleton object. Not valid until initialize has been called.

Definition at line 180 of file CalibrationControllerImpl.h.

Referenced by initialize(), instance(), underlyingInstance(), and ~CalibrationControllerImpl().

boost::thread_group SctCalibrationController::CalibrationControllerImpl::m_sequence_request_thread_group [private]
 

The worker group that handles executing sequences.

Definition at line 181 of file CalibrationControllerImpl.h.

Referenced by doSequence().

unsigned int SctCalibrationController::CalibrationControllerImpl::nextScanNumber [private]
 

The number of the next scan.

Definition at line 177 of file CalibrationControllerImpl.h.

Referenced by executeScan(), executeSequence(), getNextScanNumber(), setNextScanNumber(), and takeControl().

RunControl& SctCalibrationController::CalibrationControllerImpl::rc [private]
 

The RunController.

Definition at line 175 of file CalibrationControllerImpl.h.

Referenced by initialize(), and sctApiError().

unsigned int SctCalibrationController::CalibrationControllerImpl::runNumber [private]
 

The current run number.

Definition at line 176 of file CalibrationControllerImpl.h.

Referenced by executeSequence(), and getRunNumber().

CalibrationControllerStatus SctCalibrationController::CalibrationControllerImpl::status [private]
 

Our current status.

Definition at line 174 of file CalibrationControllerImpl.h.

Referenced by abort(), applyChanges(), CalibrationControllerImpl(), doSequence(), executeScan(), executeSequence(), giveupControl(), isBusy(), isInControl(), SctCalibrationController::SequenceRequestWorker::operator()(), reset(), setBusy(), setUpdateOption(), takeControl(), and updateStatus().


The documentation for this class was generated from the following files:
Generated on Mon Feb 6 14:05:23 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6