/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
CalibTracker/SiStripAPVAnalysis/interface/TkStateMachine.h
47 строк
1 KB
Cms Build
Clang-Format
16 май 2019, 15:48
16 май 2019, 15:48
99a83f0
Код
Авторство
О чём код?
#ifndef Tracker_TkFiniteStateMachine_h #define Tracker_TkFiniteStateMachine_h #include <string> /** * Implement a state machine. Each of the ApvAnalysis component can be * - calibrating: not yet able to give an answer * - ready: can give an answer, the calibration stays as it is. * - calibrating: can give an answer, at the same time the calibration is updated. * - stuck: a serious error happened. */ class TkStateMachine { public: enum StatusType { ready = 1, calibrating = 2, updating = 3, stuck = 4 }; bool alreadyCalibrated() const { return (myStatus == updating || myStatus == ready); } StatusType status() const { return myStatus; } void setReady() { myStatus = ready; } void setUpdating() { myStatus = updating; } void setCalibrating() { myStatus = calibrating; } void setStuck() { myStatus = stuck; } void setStatus(StatusType in) { myStatus = in; } bool isReady() const { return myStatus == ready; } bool isStuck() const { return myStatus == stuck; } bool isUpdating() const { return myStatus == updating; } bool isCalibrating() const { return myStatus == calibrating; } std::string statusName() { if (myStatus == ready) return "Ready"; if (myStatus == calibrating) return "Calibrating"; if (myStatus == updating) return "Updating"; if (myStatus == stuck) return "Stuck"; return "Unknown Status"; } public: StatusType myStatus; }; #endif