Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

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

Overrides
all nothrow

virtual ScanLibrary & getScanLibrary () const
virtual TestLibrary & getTestLibrary () const
virtual SequenceLibrary & getSequenceLibrary () const
virtual void doScan (boost::shared_ptr< ScanRequest > r)
virtual void doTest (boost::shared_ptr< TestRequest > t)
virtual void doSequence (boost::shared_ptr< SequenceRequest > r)
virtual void abort ()
virtual Sct_SctApi_T_Scan * getScan (unsigned long runNumber, unsigned long scanNumber) const
virtual void setUpdateOption (Sct_CalibrationController_T_CalibrationController_UpdateOption)
virtual void updateWith (ilu_T_CString testResultInIs)
Internal for communication with RunControl:
Note:
all nothrow


void setApi (Sct_SctApi_T_SctApi &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_T_SctApi * getApi () const
 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

CalibrationControllerImplinitialize (RunControl &rc)
 Initializes the singleton - should only be called by main or the RunController.

CalibrationControllerImplinstance ()
 Gets the CC instance.


Private Member Functions

 CalibrationControllerImpl (RunControl &rc)
void updateStatus ()
bool isInControl ()
bool isBusy ()
void setBusy (bool busy)
void executeSequence (SequenceRequest &sr)
 Executes a sequence.

auto_ptr< TestexecuteTest (TestRequest &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 (ScanRequest &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

std::list< string > getAllModulesForScan (Sct_SctApi_T_Scan *scan)
 Utility function: get all modules in all modulegroups for a particular scan.


Private Attributes

Sct_SctApi_T_SctApi * api
CalibrationControllerStatus status
 Our current status.

RunControl & rc
 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

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 39 of file CalibrationControllerImpl.h.


Member Function Documentation

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 215 of file CalibrationControllerImpl.cpp.

References getApi(), status, and CalibrationControllerStatus::updateOption.

Referenced by executeSequence().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::executeScan ScanRequest 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 404 of file CalibrationControllerImpl.cpp.

References abortNow, abortRightNow, SctCalibrationController::Ipc::ScanRequest::clockByTwo(), SctCalibrationController::Ipc::ScanRequest::configureModules(), CalibrationControllerStatus::currentScanIndex, SctCalibrationController::Ipc::ScanRequest::delay(), SctCalibrationController::Ipc::ScanRequest::getScan(), SctCalibrationController::Ipc::ScanRequest::isRaw(), nextScanNumber, status, and SctCalibrationController::Ipc::ScanRequest::width().

Referenced by executeTest().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::executeSequence SequenceRequest sr  )  [private]
 

Executes a sequence.

Note:
nothrow

Definition at line 146 of file CalibrationControllerImpl.cpp.

References applyChanges(), SctCalibrationController::Ipc::TestRequest::canFeedback(), CalibrationControllerStatus::currentSequence, SctCalibrationController::Ipc::SequenceRequest::endSequence(), executeTest(), getNextScanNumber(), SctCalibrationController::Ipc::SequenceRequest::getNextTest(), getRunNumber(), nextScanNumber, runNumber, sctApiError(), SctCalibrationController::Ipc::SequenceRequest::startSequence(), and status.

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

Here is the call graph for this function:

auto_ptr< Test > SctCalibrationController::CalibrationControllerImpl::executeTest TestRequest 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.

Definition at line 323 of file CalibrationControllerImpl.cpp.

References abortNow, abortRightNow, CalibrationControllerStatus::currentTest, SctCalibrationController::Ipc::TestRequest::endTest(), executeScan(), SctCalibrationController::Ipc::TestRequest::getNextScan(), SctCalibrationController::Ipc::ScanRequest::getScan(), nextScanNumber, TestData::nScans, runNumber, TestData::runNumber, sctApiError(), setNextScanNumber(), TestData::startScanNumber, SctCalibrationController::Ipc::TestRequest::startTest(), status, TestData::testName, TestData::testPoints, TestData::testPoints_size, and TestData::testVariable.

Referenced by executeSequence().

Here is the call graph for this function:

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

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

Sct_SctApi_T_SctApi * SctCalibrationController::CalibrationControllerImpl::getApi  )  const
 

Get the handle to the SctApi.

Definition at line 63 of file CalibrationControllerImpl.cpp.

Referenced by applyChanges().

unsigned int SctCalibrationController::CalibrationControllerImpl::getNextScanNumber  )  const
 

Get the number of the next scan.

Definition at line 123 of file CalibrationControllerImpl.cpp.

References nextScanNumber.

Referenced by executeSequence().

unsigned int SctCalibrationController::CalibrationControllerImpl::getRunNumber  )  const
 

Get the current run number.

Definition at line 119 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 94 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::INCONTROL, CalibrationControllerStatus::LOADED, CalibrationControllerStatus::status, and status.

CalibrationControllerImpl & SctCalibrationController::CalibrationControllerImpl::initialize RunControl &  rc  )  [static]
 

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

Definition at line 437 of file CalibrationControllerImpl.cpp.

References inst.

CalibrationControllerImpl & SctCalibrationController::CalibrationControllerImpl::instance  )  [static]
 

Gets the CC instance.

Definition at line 442 of file CalibrationControllerImpl.cpp.

References inst.

void SctCalibrationController::CalibrationControllerImpl::reset  ) 
 

Called when a reset is requested.

Definition at line 71 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::LOADED, CalibrationControllerStatus::status, and status.

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 77 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::ERROR, rc, CalibrationControllerStatus::status, status, and Sct::AbstractThrowable::what().

Referenced by executeSequence(), and executeTest().

Here is the call graph for this function:

void SctCalibrationController::CalibrationControllerImpl::setApi Sct_SctApi_T_SctApi &  api  ) 
 

Sets the SctApi reference.

Definition at line 67 of file CalibrationControllerImpl.cpp.

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

Sets the next scan number .

Definition at line 127 of file CalibrationControllerImpl.cpp.

References nextScanNumber.

Referenced by executeTest().

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 83 of file CalibrationControllerImpl.cpp.

References CalibrationControllerStatus::INCONTROL, CalibrationControllerStatus::LOADED, nextScanNumber, CalibrationControllerStatus::status, and status.


Friends And Related Function Documentation

friend class SequenceRequestWorker [friend]
 

The worker group class.

Definition at line 176 of file CalibrationControllerImpl.h.


Field Documentation

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

Flag used to indicate the user has requested an abort.

Definition at line 170 of file CalibrationControllerImpl.h.

Referenced by executeScan(), and executeTest().

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 171 of file CalibrationControllerImpl.h.

Referenced by executeScan(), and executeTest().

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

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

Definition at line 508 of file CalibrationControllerImpl.cpp.

Referenced by initialize(), and instance().

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

The worker group that handles executing sequences.

Definition at line 174 of file CalibrationControllerImpl.h.

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

The number of the next scan.

Definition at line 169 of file CalibrationControllerImpl.h.

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

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

The RunController.

Definition at line 167 of file CalibrationControllerImpl.h.

Referenced by sctApiError().

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

The current run number.

Definition at line 168 of file CalibrationControllerImpl.h.

Referenced by executeSequence(), executeTest(), and getRunNumber().

CalibrationControllerStatus SctCalibrationController::CalibrationControllerImpl::status [private]
 

Our current status.

Definition at line 166 of file CalibrationControllerImpl.h.

Referenced by applyChanges(), executeScan(), executeSequence(), executeTest(), giveupControl(), SctCalibrationController::SequenceRequestWorker::operator()(), reset(), sctApiError(), and takeControl().


The documentation for this class was generated from the following files:
Generated on Thu Jul 15 09:52:18 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5