00001
00002 #ifndef SLOWCONTROLMANAGER_HH
00003 #define SLOWCONTROLMANAGER_HH
00004
00005
00006
00007 #include "mTypes.h"
00008 #include <map>
00009 #include <list>
00010 #include <set>
00011 #include <fstream>
00012 #include "SlowControlEntry.hh"
00013
00014 class SteerDesc;
00015 class PMParams;
00016 class SCSteerParams;
00017 class ChamberSlowControl;
00018 class MeshParams_t;
00019 class PMSlowControl;
00020 class DriftParams_t;
00021
00022 #define PM "PM"
00023
00024 #define BOARD "board"
00025 #define PRESSURE "pressure"
00026 #define OVERPRESSURE "overPressure"
00027 #define TEMPERATURE "temperature"
00028 #define TIMESTAMP "timeStamp"
00029
00030 struct scSorter
00031 {
00032 bool operator() (const SlowControlEntry& lhs, const SlowControlEntry& rhs) const
00033 {
00034 return lhs.getTimeStamp() > rhs.getTimeStamp();
00035 }
00036 };
00037
00038
00039
00040
00041 class SlowControlManager {
00042
00043
00044 public:
00045 SlowControlManager();
00046 ~SlowControlManager();
00047 i32 readDB(const std::string fileName);
00048 void build(const SteerDesc& sd);
00049
00050
00051 const SlowControlEntry* getEntry(const double timeStamp)const ;
00052 std::set<SlowControlEntry>::const_iterator begin() { return genList.begin(); };
00053 std::set<SlowControlEntry>::const_iterator end() { return genList.end(); };
00054 inline const ui32 getNbEntries() { return genList.size(); }
00055
00056
00057 private:
00058 void addSteer(const ui32 scId, const std::string type, const ui32 chamberId, const ui32 difId, const ui32 boardId, const ui32 pmId, const std::string name);
00059
00060
00061
00062 void addEntry(const SlowControlEntry& entry);
00063
00064
00065 const BoardSlowControl& getBoard(const double timeStamp, const ui32 chamberId, const ui32 difId, const ui32 boardId) const ;
00066 const PMSlowControl& getPM(const double timeStamp, const ui32 id) const ;
00067
00068 private:
00069
00070 std::set<SlowControlEntry,scSorter> genList;
00071
00072
00073 std::list<SCSteerParams> stList;
00074 };
00075
00076
00077 #endif
00078