File indexing completed on 2024-04-06 11:59:39
0001 #ifndef Tracker_TkFiniteStateMachine_h
0002 #define Tracker_TkFiniteStateMachine_h
0003
0004 #include <string>
0005
0006
0007
0008
0009
0010
0011
0012 class TkStateMachine {
0013 public:
0014 enum StatusType { ready = 1, calibrating = 2, updating = 3, stuck = 4 };
0015
0016 bool alreadyCalibrated() const { return (myStatus == updating || myStatus == ready); }
0017 StatusType status() const { return myStatus; }
0018
0019 void setReady() { myStatus = ready; }
0020 void setUpdating() { myStatus = updating; }
0021 void setCalibrating() { myStatus = calibrating; }
0022 void setStuck() { myStatus = stuck; }
0023
0024 void setStatus(StatusType in) { myStatus = in; }
0025
0026 bool isReady() const { return myStatus == ready; }
0027 bool isStuck() const { return myStatus == stuck; }
0028 bool isUpdating() const { return myStatus == updating; }
0029 bool isCalibrating() const { return myStatus == calibrating; }
0030
0031 std::string statusName() {
0032 if (myStatus == ready)
0033 return "Ready";
0034 if (myStatus == calibrating)
0035 return "Calibrating";
0036 if (myStatus == updating)
0037 return "Updating";
0038 if (myStatus == stuck)
0039 return "Stuck";
0040 return "Unknown Status";
0041 }
0042
0043 public:
0044 StatusType myStatus;
0045 };
0046
0047 #endif