00001 #ifndef TESTRESULT_H
00002 #define TESTRESULT_H
00003
00004 #include "ModuleDefectList.h"
00005 #include "Sct/Serializable.h"
00006 #include "Sct/Exception.h"
00007 #include "ModuleConfiguration.h"
00008 #include <string>
00009 #include <vector>
00010 #include <boost/shared_ptr.hpp>
00011 #include "Sct/LogicErrors.h"
00012 #include "Sct/IoExceptions.h"
00013
00014 using namespace std;
00015 using namespace Sct;
00016 using boost::shared_ptr;
00017
00018 namespace SctData {
00019 class FitScanResult;
00020 class RawScanResult;
00021 class ConfigurationVariable;
00022
00031 class TestResult:public virtual Serializable {
00032 public:
00034 ~TestResult() throw() {};
00035
00038 virtual string getUniqueID() const throw(LogicError) ;
00039
00041 unsigned int getRunNumber() const throw() {
00042 return runNumber;
00043 }
00044
00045 void setRunNumber(unsigned int runNumber) throw();
00046
00048 string getModuleName() const throw() {
00049 return moduleName;
00050 }
00051
00052 void setModuleName(string name) throw();
00053
00057 const ConfigurationVariable& getScanVariable() const throw();
00058
00059 void setScanVariable(const ConfigurationVariable& scanVariable) throw();
00060
00064 const ConfigurationVariable& getTestVariable() const throw();
00065
00066 void setTestVariable(const ConfigurationVariable& testVariable) throw();
00067
00071 const ModuleConfiguration& getUpdatedConfiguration() const throw();
00072 ModuleConfiguration& getUpdatedConfiguration() throw();
00073
00075 unsigned getScanNumberAt(unsigned int i) const throw(LogicError);
00076
00078 double getTestPointAt(unsigned int i) const throw(LogicError);
00079
00084 const ModuleDefectList& getDefects() const throw() ;
00085 ModuleDefectList& getDefects() throw() ;
00086
00090 bool getPassed() const throw();
00091
00095 void setPassed(bool passed) throw();
00096
00100 bool getProblem() const throw();
00101
00105 void setProblem(bool problem) throw();
00106
00110 vector<string> getComments() const throw();
00111
00115 void addComment(string comment) throw();
00116
00118 virtual void addScan(const unsigned int scanNumber, const double testPoint) throw(LogicError);
00119
00120
00125
00126
00130 const unsigned int getNScans() const throw() {
00131 return data.size();
00132 }
00133
00138 unsigned int getIndex(const unsigned int scanNumber) const throw(LogicError) ;
00139
00146 shared_ptr<const FitScanResult> getFit(unsigned int index) const throw(LogicError,IoError) ;
00147
00154 shared_ptr<const RawScanResult> getRaw(unsigned int index) const throw(LogicError,IoError) ;
00155
00159 void addFit(shared_ptr<const FitScanResult> fit) throw(LogicError) ;
00163 void addRaw(shared_ptr<const RawScanResult> raw) throw(LogicError) ;
00168 bool hasAllFits() const throw();
00173 bool hasAllRaws() const throw();
00174 protected:
00178 TestResult() throw();
00179
00183 TestResult(const unsigned int runNumber, const string & moduleName, const ConfigurationVariable& testVariable,
00184 const ConfigurationVariable& scanVariable) throw ();
00185
00189 class ScanData {
00190 public:
00191
00199 ScanData(const unsigned int scanNumber, const double testPoint, shared_ptr<const RawScanResult> raw,
00200 shared_ptr<const FitScanResult> fit) throw();
00201
00207 ScanData(const unsigned int scanNumber, const double testPoint) throw();
00209
00210 bool operator<(const ScanData & s) const throw();
00211 bool operator>(const ScanData & s) const throw();
00212 bool operator==(const unsigned int aScanNumber) const throw();
00214
00215 unsigned int scanNumber;
00216 double testPoint;
00217 mutable shared_ptr<const RawScanResult> raw;
00218 mutable shared_ptr<const FitScanResult> fit;
00219 };
00220
00221 vector <ScanData> data;
00222 unsigned int runNumber;
00223 string moduleName;
00224
00225 const ConfigurationVariable* testVariable;
00226 const ConfigurationVariable* scanVariable;
00227 ModuleConfiguration updatedConfig;
00228 ModuleDefectList defects;
00229 bool passed;
00230 bool problem;
00231 vector<string> comments;
00232
00233
00234 friend class TestResultIOHelper;
00235 };
00236
00237 }
00238 #endif //TESTRESULT_H