#include <StripSrv.h>
Public Types | |
enum | eBadType { UNKNOWN_BADTYPE, DEAD, HOT } |
enum | eBadType { UNKNOWN_BADTYPE, DEAD, HOT } |
typedef std::vector< unsigned short int > | StripCol |
typedef std::vector< unsigned short int > | StripCol |
typedef calibUtil::StripSrv::stowerRC | towerRC |
Clients should use as return values for readData. | |
typedef calibUtil::StripSrv::stowerRC | towerRC |
Clients should use as return values for readData. | |
Public Member Functions | |
void | getBadTowers (std::vector< towerRC > &towerIds) const |
lists all towers with bad strips | |
void | getBadTowers (std::vector< towerRC > &towerIds) const |
Lists all towers with bad strips. | |
eBadType | getBadType () const |
returns the status (Hot or Dead) of the strip | |
eBadType | getBadType () const |
returns the status (Hot or Dead) of the strips | |
std::string | getCalType () const |
Get calibration type. | |
std::string | getCalType () const |
Get calibration type. | |
std::string | getFmtVer () const |
Get format Version. | |
std::string | getFmtVer () const |
Get format Version. | |
std::string | getInst () const |
methods giving access to generic data Get instrument name | |
std::string | getInst () const |
methods giving access to generic data Get instrument name | |
std::string | getTimestamp () const |
Get timestamp. | |
std::string | getTimestamp () const |
Get timestamp. | |
StripSrv (eBadType badType, const GenericSrv &gen) | |
Constructor to be used when creating new calibrations. | |
StripSrv (std::string xmlFileName) | |
StripSrv (eBadType badType, const GenericSrv &gen) | |
Constructor to be used when creating new calibrations. | |
StripSrv (std::string xmlFileName) | |
eVisitorRet | traverseInfo (ClientObject *client) const |
call back method for client to access large data | |
eVisitorRet | traverseInfo (ClientObject *client) const |
call back method for client to access large data | |
eVisitorRet | writeXml (std::ostream *out) |
eVisitorRet | writeXml (std::ostream *out) |
~StripSrv () | |
destructor. Deallocates memory | |
~StripSrv () | |
destructor used to deallocate memory | |
Private Types | |
enum | eState { FROM_PERS, BUILDING, WRITTEN } |
enum | eState { FROM_PERS, BUILDING, WRITTEN } |
typedef calibUtil::StripSrv::sTower | Tower |
typedef calibUtil::StripSrv::sTower | Tower |
typedef calibUtil::StripSrv::sUniplane | Uniplane |
typedef calibUtil::StripSrv::sUniplane | Uniplane |
Private Member Functions | |
void | fillStrips (const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *badElt, StripCol &list) |
void | fillStrips (const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *badElt, StripCol &list) |
void | fillUni (const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *uniElt, Uniplane *uni) |
void | fillUni (const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *uniElt, Uniplane *uni) |
const Tower * | findTower (const towerRC &towerId) const |
const version of findTower, used by const public methods | |
Tower * | findTower (towerRC &towerId) |
Internal utility, used when this object must be mutable (e.g. addBad). | |
const Tower * | findTower (const towerRC &towerId) const |
const version of findTower, used by const public methods | |
Tower * | findTower (towerRC &towerId) |
Internal utility, used when this object must be mutable (e.g. addBad). | |
void | strToNum (std::string strips, std::vector< unsigned short int > &v) |
void | strToNum (std::string strips, std::vector< unsigned short int > &v) |
Private Attributes | |
eBadType | m_badType |
GenericSrv * | m_genSrv |
GenericSrv * | m_genSrv |
eState | m_state |
std::vector< Tower > | m_towers |
std::vector< Tower > | m_towers |
|
|
|
|
|
|
|
|
|
Clients should use as return values for readData.
|
|
Clients should use as return values for readData.
|
|
|
|
|
|
00064 {UNKNOWN_BADTYPE, DEAD, HOT};
|
|
00064 {UNKNOWN_BADTYPE, DEAD, HOT};
|
|
00138 { 00139 FROM_PERS, // read in from persistent form; read-only 00140 BUILDING, // in process of building the list 00141 WRITTEN }; // built and written to persistent form (read-only)
|
|
00138 { 00139 FROM_PERS, // read in from persistent form; read-only 00140 BUILDING, // in process of building the list 00141 WRITTEN }; // built and written to persistent form (read-only)
|
|
constructor. Initializes strip service by creating a DOM structure out of the XML file and filling in the internal data structures 00030 : m_badType(UNKNOWN_BADTYPE), 00031 m_state(FROM_PERS), 00032 m_genSrv(0) 00033 { 00034 using xmlBase::Dom; 00035 using XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument; 00036 00037 xmlBase::XmlParser* parser = new xmlBase::XmlParser(); 00038 DOMDocument* doc = parser->parse(xmlFileName.c_str()); 00039 00040 if (doc == 0) { 00041 std::cerr << "Error parsing document" << xmlFileName << std::endl; 00042 return; 00043 } 00044 00045 DOMElement* docElt = doc->getDocumentElement(); 00046 m_genSrv = new GenericSrv(docElt); 00047 00048 std::vector<DOMElement *> towers; 00049 00050 Dom::getDescendantsByTagName(docElt, "tower", towers); 00051 unsigned nTower = towers.size(); 00052 00053 m_towers.reserve(nTower); 00054 00055 std::string bString = Dom::getAttribute(docElt,"badType"); 00056 if (!bString.compare("hot")) m_badType = HOT; 00057 else if (!bString.compare("dead")) m_badType = DEAD; 00058 else m_badType = UNKNOWN_BADTYPE; 00059 00060 00061 for (unsigned int iTower = 0; iTower < nTower; iTower++) { 00062 Tower tower; 00063 tower.m_uniplanes.clear(); 00064 try { 00065 tower.m_row = Dom::getIntAttribute(towers[iTower], "row"); 00066 tower.m_col = Dom::getIntAttribute(towers[iTower], "col"); 00067 } 00068 catch (xmlBase::DomException ex) { 00069 std::cerr << "From calibUtil::StripSrv::StripSrv" << std::endl 00070 << ex.getMsg() << std::endl; 00071 throw ex; 00072 } 00073 00074 tower.m_howBad = 0; 00075 tower.m_allBad = 0; 00076 00077 std::string attValue = Dom::getAttribute(towers[iTower], "nOnbdCalib"); 00078 if (attValue.compare("true") == 0) { 00079 tower.m_howBad |= vCALIBUTIL_nOnbdCalib; 00080 } 00081 attValue = Dom::getAttribute(towers[iTower], "nOnbdTrig"); 00082 if (attValue.compare("true") == 0) { 00083 tower.m_howBad |= vCALIBUTIL_nOnbdTrig; 00084 } 00085 attValue = Dom::getAttribute(towers[iTower], "nOnbdData"); 00086 if (attValue.compare("true") == 0) { 00087 tower.m_howBad |= vCALIBUTIL_nOnbdData; 00088 } 00089 if (tower.m_howBad) { 00090 tower.m_allBad = 1; 00091 goto NEXT; 00092 } // otherwise have to process individual uniplane elements 00093 00094 { 00095 DOMElement* uniElt = Dom::getFirstChildElement(towers[iTower]); 00096 00097 while (uniElt != 0) { 00098 Uniplane uni; 00099 uni.m_howBad = 0; 00100 fillUni(uniElt, &uni); 00101 // if bad status, complain and return 00102 00103 tower.m_uniplanes.push_back(uni); 00104 uniElt = Dom::getSiblingElement(uniElt); 00105 } 00106 } 00107 NEXT: 00108 m_towers.push_back(tower); 00109 // towerElt = Dom::getSiblingElement(towerElt); 00110 } 00111 }
|
|
Constructor to be used when creating new calibrations.
|
|
destructor used to deallocate memory
00114 {
00115 delete m_genSrv;
00116 }
|
|
constructor. Initializes strip service by creating a DOM structure out of the XML file and filling in the internal data structures |
|
Constructor to be used when creating new calibrations.
|
|
destructor. Deallocates memory
|
|
|
|
|
|
Handles all the messy of details of extracting information about a single unilayer from the XML representation |
|
Handles all the messy of details of extracting information about a single unilayer from the XML representation |
|
const version of findTower, used by const public methods
|
|
Internal utility, used when this object must be mutable (e.g. addBad).
|
|
const version of findTower, used by const public methods
00309 { 00310 std::vector<Tower>::const_iterator it = m_towers.begin(); 00311 while(it != m_towers.end() ) { 00312 if ((it->m_row == towerId.row) && (it->m_col == towerId.col)) { 00313 return (&(*it)); 00314 } 00315 ++it; 00316 } 00317 return 0; 00318 }
|
|
Internal utility, used when this object must be mutable (e.g. addBad).
00298 { 00299 std::vector<Tower>::iterator it = m_towers.begin(); 00300 while(it != m_towers.end() ) { 00301 if ((it->m_row == towerId.row) && (it->m_col == towerId.col)) { 00302 return (&(*it)); 00303 } 00304 ++it; 00305 } 00306 return 0; 00307 }
|
|
lists all towers with bad strips
|
|
Lists all towers with bad strips.
00125 { 00126 std::vector<Tower>::const_iterator it = m_towers.begin(); 00127 while(it != m_towers.end() ) { 00128 00129 towerRC trc; 00130 towerRCs.reserve(m_towers.size()); 00131 trc.row = it->m_row; 00132 trc.col = it->m_col; 00133 towerRCs.push_back(trc); 00134 it++; 00135 } 00136 }
|
|
returns the status (Hot or Dead) of the strip
|
|
returns the status (Hot or Dead) of the strips
00119 {
00120 return m_badType;
00121 }
|
|
Get calibration type.
|
|
Get calibration type.
00151 { 00152 return m_genSrv->getCalType(); 00153 }
|
|
Get format Version.
|
|
Get format Version.
00156 { 00157 return m_genSrv->getFmtVer(); 00158 }
|
|
methods giving access to generic data Get instrument name
|
|
methods giving access to generic data Get instrument name
00141 { 00142 return m_genSrv->getInst(); 00143 }
|
|
Get timestamp.
|
|
Get timestamp.
00146 { 00147 return m_genSrv->getTimestamp(); 00148 }
|
|
this function takes in a stripList in string format and fills a vector with corresponding strip numbers |
|
this function takes in a stripList in string format and fills a vector with corresponding strip numbers 00268 { 00269 00270 std::string::iterator it = s.begin(); 00271 00272 // Maybe add something to be sure all we've got are digits 00273 // and blanks?? 00274 00275 // Skip over leading blanks, if any 00276 while((it != s.end()) && (*it == ' ')) it++; 00277 00278 // save contiguous digits in tempStr 00279 while ((it != s.end()) && (*it >= '0') && (*it <= '9')) { 00280 std::string tempStr; 00281 tempStr += *it; 00282 it++; 00283 00284 while((it != s.end()) && (*it >= '0') && (*it <= '9')){ 00285 tempStr += *it; 00286 it++; 00287 } 00288 00289 // No more contiguous digits; skip over blanks 00290 while((it != s.end()) && (*it == ' ')) it++; 00291 00292 // Save the converted integer 00293 v.push_back(atoi(tempStr.c_str())); 00294 } 00295 00296 }
|
|
call back method for client to access large data
|
|
call back method for client to access large data
00162 { 00163 00164 /* NOTE: could also check for empty badLists and only 00165 call back client if nonempty. 00166 */ 00167 std::vector<Tower>::const_iterator iTower = m_towers.begin(); 00168 00169 eVisitorRet ret = DONE; 00170 while (iTower != m_towers.end() ) { 00171 if (iTower->m_allBad) { 00172 ret = client->badTower(iTower->m_row, iTower->m_col, iTower->m_howBad); 00173 if (ret != CONT) return ret; 00174 } 00175 // If tower not all bad, loop over planes within towers 00176 else { 00177 std::vector<Uniplane>::const_iterator iUni = 00178 (iTower->m_uniplanes).begin(); 00179 while (iUni != (iTower->m_uniplanes).end() ) { 00180 ret = client->badPlane(iTower->m_row, iTower->m_col, 00181 iUni->m_tray, iUni->m_top, 00182 iUni->m_howBad, iUni->m_allBad, 00183 (iUni->m_strips)); 00184 if (ret != CONT) return ret; 00185 iUni++; 00186 } 00187 } 00188 ++iTower; 00189 } 00190 // If got to here, traversed the entire data structure without 00191 // a murmur from client 00192 return DONE; 00193 }
|
|
|
|
00320 {
00321 return DONE;
00322 }
|
|
|
|
|
|
|
|
|
|
|
|
|