00001
00002 #ifndef CALIBUTIL_STRIPSRV_H
00003 #define CALIBUTIL_STRIPSRV_H
00004
00005 #include <string>
00006 #include <iostream>
00007 #include <vector>
00008 #include <xercesc/dom/DOMElement.hpp>
00009
00010 namespace calibUtil {
00011
00012 class GenericSrv;
00013
00022 enum eVisitorRet {CONT, USER_DONE, ERROR, DONE};
00023
00024 typedef std::vector<unsigned short int> StripCol;
00025
00029 class ClientObject {
00030 public:
00038 virtual eVisitorRet badTower(unsigned int row, unsigned int col,
00039 int badness)=0;
00040
00051 virtual eVisitorRet badPlane(unsigned int row, unsigned int col,
00052 unsigned int tray, bool top,
00053 int badness, bool allBad,
00054 const StripCol& strips)=0;
00055
00056 };
00057
00058
00059 class StripSrv {
00060
00061
00062 public:
00063
00064 enum eBadType {UNKNOWN_BADTYPE, DEAD, HOT};
00066
00067 typedef struct stowerRC {
00068 unsigned short int row;
00069 unsigned short int col;
00070 } towerRC;
00071 typedef std::vector<unsigned short int> StripCol;
00072
00075 StripSrv(std::string xmlFileName);
00076
00078 StripSrv(eBadType badType, const GenericSrv& gen);
00079
00081 ~StripSrv();
00082
00084 eBadType getBadType() const;
00085
00087 void getBadTowers(std::vector<towerRC>& towerIds) const;
00088
00089
00090
00092
00094 std::string getInst() const;
00095
00097 std::string getTimestamp() const;
00098
00100 std::string getCalType() const;
00101
00103 std::string getFmtVer() const;
00104
00106
00107
00108 eVisitorRet traverseInfo(ClientObject *client) const;
00109
00110 eVisitorRet writeXml(std::ostream* out);
00111
00112 private:
00113
00114
00115
00116
00117
00118 typedef struct sUniplane {
00119 bool m_allBad;
00120 int m_howBad;
00121 int m_tray;
00122 bool m_top;
00123 StripCol m_strips;
00124 } Uniplane;
00125
00126 typedef struct sTower {
00127
00128 unsigned short m_row;
00129 unsigned short m_col;
00130 bool m_allBad;
00131 int m_howBad;
00132 std::vector<Uniplane> m_uniplanes;
00133 } Tower;
00134
00135 std::vector<Tower> m_towers;
00136 eBadType m_badType;
00137
00138 enum eState {
00139 FROM_PERS,
00140 BUILDING,
00141 WRITTEN };
00142
00143 eState m_state;
00144
00145
00146 GenericSrv *m_genSrv;
00147
00148
00151 void strToNum(std::string strips, std::vector<unsigned short int> &v);
00152
00155
00156 void fillUni(const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* uniElt,
00157 Uniplane* uni);
00158
00159 void fillStrips(const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* badElt,
00160 StripCol& list);
00161
00163 Tower* findTower(towerRC& towerId);
00165 const Tower* findTower(const towerRC& towerId) const;
00166
00167 };
00168
00169 }
00170
00171 #endif
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182