CFEL - ASG Software Suite
2.5.0
CASS
|
Helper for Acqiris related Postprocessors. More...
#include <acqiris_detectors_helper.h>
Public Types | |
typedef std::tr1::shared_ptr< HelperAcqirisDetectors > | shared_pointer |
typedef a shared pointer of this More... | |
typedef std::map< std::string, shared_pointer > | helperinstancesmap_t |
typedef describing the instances of the helper More... | |
typedef std::tr1::shared_ptr< DetectorBackend > | Det_sptr |
a shared pointer of the detector backend More... | |
typedef CASSEvent::id_t | id_type |
define the type of the id used More... | |
typedef std::pair< id_type, Det_sptr > | KeyDetPair_t |
defining a key - value pair for the list More... | |
typedef std::vector< KeyDetPair_t > | detectorList_t |
typedef defining the list of detectors for more readable code More... | |
typedef detectorList_t::iterator | iter_type |
define an iterator for the list More... | |
Public Member Functions | |
DetectorBackend & | detector (const CASSEvent &evt) |
retrieve detector for event More... | |
const DetectorBackend & | detector () const |
retrieve detector More... | |
void | loadSettings (size_t i=0) |
load the settings of the detectors in the detector list More... | |
DetectorType | detectortype () |
retrieve the detector type that the helper is there for More... | |
Static Public Member Functions | |
static shared_pointer | instance (const helperinstancesmap_t::key_type &detector) |
static function creating instance of this. More... | |
static void | releaseDetector (const id_type &id) |
release the detector of all helpers that is blocked for the event More... | |
static const helperinstancesmap_t & | instances () |
return all known instances fo this More... | |
Protected Member Functions | |
DetectorBackend & | validate (const CASSEvent &evt) |
validate that this event has been associated with the detector. More... | |
Protected Attributes | |
detectorList_t | _detectorList |
list of pairs of id-detectors. More... | |
Private Member Functions | |
HelperAcqirisDetectors () | |
prevent people from constructin other than using instance(). More... | |
HelperAcqirisDetectors (const helperinstancesmap_t::key_type &detname) | |
private constructor. More... | |
HelperAcqirisDetectors (const HelperAcqirisDetectors &) | |
prevent copy-construction More... | |
HelperAcqirisDetectors & | operator= (const HelperAcqirisDetectors &) |
prevent assingment More... | |
iter_type | findId (const id_type &id) |
find an element with a given id in the list More... | |
void | release (const id_type &id) |
release the detector element in the list by settings its key (eventid) back to 0 More... | |
Private Attributes | |
QMutex | _helperMutex |
Mutex for each helper. More... | |
DetectorType | _dettype |
the type of detector that the individual helper is there for More... | |
iter_type | _lastEntry |
the iterator to the last element returned More... | |
Static Private Attributes | |
static helperinstancesmap_t | _instances |
the helperclass instances. More... | |
static QMutex | _mutex |
Singleton Mutex to lock write operations. More... | |
Helper for Acqiris related Postprocessors.
This class will return the requested detector, which signals are going to a Acqiris Instrument. It is implemented as a singleton such that every processor can call it without knowing about it.
Definition at line 52 of file acqiris_detectors_helper.h.
typedef std::tr1::shared_ptr<DetectorBackend> cass::ACQIRIS::HelperAcqirisDetectors::Det_sptr |
a shared pointer of the detector backend
Definition at line 62 of file acqiris_detectors_helper.h.
typedef std::vector<KeyDetPair_t> cass::ACQIRIS::HelperAcqirisDetectors::detectorList_t |
typedef defining the list of detectors for more readable code
Definition at line 71 of file acqiris_detectors_helper.h.
typedef std::map<std::string,shared_pointer> cass::ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t |
typedef describing the instances of the helper
Definition at line 59 of file acqiris_detectors_helper.h.
define the type of the id used
Definition at line 65 of file acqiris_detectors_helper.h.
typedef detectorList_t::iterator cass::ACQIRIS::HelperAcqirisDetectors::iter_type |
define an iterator for the list
Definition at line 74 of file acqiris_detectors_helper.h.
typedef std::pair<id_type,Det_sptr> cass::ACQIRIS::HelperAcqirisDetectors::KeyDetPair_t |
defining a key - value pair for the list
Definition at line 68 of file acqiris_detectors_helper.h.
typedef std::tr1::shared_ptr<HelperAcqirisDetectors> cass::ACQIRIS::HelperAcqirisDetectors::shared_pointer |
typedef a shared pointer of this
Definition at line 56 of file acqiris_detectors_helper.h.
|
inlineprivate |
prevent people from constructin other than using instance().
Definition at line 159 of file acqiris_detectors_helper.h.
|
private |
private constructor.
Creates the list of detectors. The detectors are of the user chosen type. The type can be chosen by the user via the .cass ini setting dettype. The instance of the detectors are created by DetectorBackend::instance()
The name of the detector is also the key in the instances map.
detname | the name of the detector |
Definition at line 55 of file acqiris_detectors_helper.cpp.
References cass::Log::add(), QSettings::beginGroup(), cass::Log::DEBUG0, QSettings::endGroup(), QString::fromStdString(), cass::ACQIRIS::DetectorBackend::instance(), cass::NbrOfWorkers, cass::ACQIRIS::ToF, cass::toString(), and QSettings::value().
|
private |
prevent copy-construction
|
inline |
retrieve detector for event
this just calls validate(). See validate() for further information
evt | the event whos data we need to relate to the detector. |
Definition at line 105 of file acqiris_detectors_helper.h.
References validate().
|
inline |
retrieve detector
this just retrieves the first detector from the _detectorList. Can be used for chekcking the properties of the detector.
Definition at line 114 of file acqiris_detectors_helper.h.
References _detectorList.
|
inline |
retrieve the detector type that the helper is there for
Definition at line 127 of file acqiris_detectors_helper.h.
References _dettype.
|
private |
find an element with a given id in the list
id | the id of the element |
Definition at line 70 of file acqiris_detectors_helper.cpp.
|
static |
static function creating instance of this.
return the instance of the helper that is managing the detector. If the helper is not yet inside the _instances map the helper instance will be created and put into the _instances map.
detector | key (name) of the detector to find it in the _instances map |
Definition at line 30 of file acqiris_detectors_helper.cpp.
References cass::Log::add(), cass::Log::DEBUG0, and detector.
Referenced by cass::ACQIRIS::loadDelayDet(), cass::ACQIRIS::loadLayer(), and cass::ACQIRIS::loadParticle().
|
static |
return all known instances fo this
Definition at line 49 of file acqiris_detectors_helper.cpp.
void HelperAcqirisDetectors::loadSettings | ( | size_t | i = 0 | ) |
load the settings of the detectors in the detector list
go through the list of detectors and tell each of the detector to load its settings.
i | unused parameter |
Definition at line 104 of file acqiris_detectors_helper.cpp.
References QSettings::beginGroup(), and QSettings::endGroup().
|
private |
prevent assingment
|
private |
release the detector element in the list by settings its key (eventid) back to 0
id | the detector event id that should be released |
Definition at line 77 of file acqiris_detectors_helper.cpp.
|
static |
release the detector of all helpers that is blocked for the event
id | the eventid that is assinged for the detector |
Definition at line 42 of file acqiris_detectors_helper.cpp.
Referenced by cass::ProcessorManager::operator()().
|
protected |
validate that this event has been associated with the detector.
This function will lock, so that it can be consecutivly called by different threads.
Check if the event is already associated with one of the detectors in the detector list. If so just return the pointer to the detector that is associated with this event.
If not then take the detector of the last element in the _detectorList and call its associate() member with this event. Then create a new element to be put into the _detectorList, where the key of the element is the id of the event and the value is the pointer to the detector, that we associated with this event. Put the newly created element in the beginning of the _detectorList and erase the last element.
evt | the cass event to validate |
Definition at line 85 of file acqiris_detectors_helper.cpp.
References cass::CASSEvent::id().
Referenced by detector().
|
protected |
list of pairs of id-detectors.
Definition at line 155 of file acqiris_detectors_helper.h.
Referenced by detector().
|
private |
the type of detector that the individual helper is there for
Definition at line 207 of file acqiris_detectors_helper.h.
Referenced by detectortype().
|
private |
Mutex for each helper.
Definition at line 204 of file acqiris_detectors_helper.h.
|
staticprivate |
the helperclass instances.
the instances of this class put into map one instance for each available detector
Definition at line 198 of file acqiris_detectors_helper.h.
|
private |
the iterator to the last element returned
Definition at line 210 of file acqiris_detectors_helper.h.
|
staticprivate |
Singleton Mutex to lock write operations.
Definition at line 201 of file acqiris_detectors_helper.h.