CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CalibTracker/SiStripAPVAnalysis/interface/TkStateMachine.h

Go to the documentation of this file.
00001 #ifndef Tracker_TkFiniteStateMachine_h
00002 #define Tracker_TkFiniteStateMachine_h
00003 
00004 #include <string>
00012 class TkStateMachine{
00013  public:
00014   
00015   enum StatusType {ready=1,calibrating=2,updating=3,stuck=4};
00016   
00017   bool alreadyCalibrated() const {return (myStatus == updating || myStatus == ready);}
00018   StatusType status() const {return myStatus;}
00019   
00020   void setReady() {myStatus = ready;}
00021   void setUpdating() {myStatus = updating;}
00022   void setCalibrating() {myStatus = calibrating;}
00023   void setStuck() {myStatus = stuck;}
00024   
00025   void setStatus(StatusType in) {myStatus = in;}
00026   
00027   bool isReady() const {return myStatus==ready;}
00028   bool isStuck() const {return myStatus==stuck;}
00029   bool isUpdating() const {return myStatus==updating;}
00030   bool isCalibrating() const {return myStatus==calibrating;}
00031   
00032   
00033   std::string statusName() {
00034     if (myStatus == ready) return "Ready";
00035     if (myStatus == calibrating) return "Calibrating";
00036     if (myStatus == updating) return "Updating";
00037     if (myStatus == stuck) return "Stuck";
00038     return "Unknown Status";
00039   }
00040   
00041 
00042  public:
00043 
00044   StatusType myStatus;
00045 
00046 };
00047 
00048 #endif
00049 
00050