00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OMGEXPERIMENT_H
00021 #define OMGEXPERIMENT_H
00022
00023 #include "omgmodel.h"
00024 #include "omgmodellerplugininterface.h"
00025 #include "omgserialisable.h"
00026 #include "omgguid.h"
00027
00028
00029 #include <QVector>
00030 #include <QList>
00031 #include <QObject>
00032 #include <QMap>
00033 #include <QMutex>
00034 #include <QThread>
00035 #include <QWaitCondition>
00036
00045 class OMG_LIB_EXPORT OmgExperiment : public QThread, public OmgSerialisable, public OmgGuid
00046 {
00047 Q_OBJECT;
00048
00049 public:
00050 OmgExperiment();
00051 ~OmgExperiment();
00053 QString name();
00055 void setName(QString theName);
00057 QString description();
00059 void setDescription(QString theDescription);
00061 QString workDir();
00069 void setWorkDir(QString theWorkDir);
00078 QString currentStatus() {return mCurrentStatus;};
00082 void reset();
00088 bool isRunning();
00090 void addModel(OmgModel * thepModel) ;
00098 OmgModel * getModel(int theModelNo);
00107 OmgModel * getModel(QString theGuid);
00109 void run();
00111 void stop();
00113 int count();
00115 void clear() ;
00117 void removeModel(QString theGuid);
00119 void removeAlgorithm(QString theName);
00121 void removeTaxon(QString theName);
00123 void removeCompleted() ;
00125 OmgModellerPluginInterface * modellerPlugin();
00127 void setModellerPlugin(OmgModellerPluginInterface * theAdapter);
00130 const QString toString();
00132 bool isAborted();
00144 QString toSummaryHtml(bool theForceFlag=false);
00158 QString toPrintHtml(bool theForceFlag=false);
00173 QString toAlgorithmSummaryHtml(QString theAlgorithmName,bool theForceFlag=false);
00188 QString toTaxonSummaryHtml(QString theTaxonName,bool theForceFlag=false);
00192 void makeAlgorithmSummaryGraphs(QString theWorkDir);
00193
00195 void save();
00196
00197
00198
00199
00200
00206 QString toXml() const ;
00211 bool fromXml(const QString theXml) ;
00212
00213 public slots:
00216 void abort();
00217 signals:
00219 void experimentMaximum(int);
00221 void experimentProgress(int);
00223 void modelCreationProgress(int);
00225 void modelProjectionProgress(int);
00227 void logMessage(QString);
00229 void experimentStopped();
00233 void modelCompleted(QString);
00234 private:
00237 QString getStatsHtml();
00240 QString getGraphsHtml(QString theImagePrefix ="", bool theForceFlag =false);
00263 void addValueToSummaryGraph(
00264 QMap<QString,QList <double > > & theMap,
00265 QString theAlgorithmName,
00266 double theValue);
00285 void summaryMapToGraph( QMap<QString,QList < double > > &theMap,
00286 QString theWorkDir,
00287 QString theImageSuffix );
00288
00289
00290
00291
00292
00293
00294 QMutex mMutex;
00295 QWaitCondition mCondition;
00297 QString mName;
00299 QString mDescription;
00301 QVector <OmgModel * > mModelVector;
00303 int mLastPos;
00305 OmgModellerPluginInterface * mpModellerPlugin;
00309 bool mAbortFlag;
00313 QString mWorkDir;
00321 QString mCurrentStatus;
00323 bool mRunningFlag;
00324 };
00325
00326 #endif //OMGEXPERIMENT_H