SpikeStream Application Library
0.2
|
00001 //SpikeStream includes 00002 #include "AbstractAnalysisTimeStepThread.h" 00003 #include "SpikeStreamException.h" 00004 #include "Util.h" 00005 using namespace spikestream; 00006 00007 //Qt includes 00008 #include <QDebug> 00009 00010 //Other includes 00011 #include <iostream> 00012 using namespace std; 00013 00014 00016 AbstractAnalysisTimeStepThread::AbstractAnalysisTimeStepThread(const DBInfo& netDBInfo, const DBInfo& archDBInfo, const DBInfo& anaDBInfo){ 00017 //Store the database information 00018 this->networkDBInfo = netDBInfo; 00019 this->archiveDBInfo = archDBInfo; 00020 this->analysisDBInfo = anaDBInfo; 00021 00022 //Initialize variables 00023 timeStep = -1; 00024 } 00025 00026 00028 AbstractAnalysisTimeStepThread::~AbstractAnalysisTimeStepThread(){ 00029 } 00030 00031 00032 /*-------------------------------------------------------------*/ 00033 /*------- PUBLIC METHODS ------*/ 00034 /*-------------------------------------------------------------*/ 00035 00037 void AbstractAnalysisTimeStepThread::clearError(){ 00038 error = false; 00039 errorMessage = ""; 00040 } 00041 00042 00044 void AbstractAnalysisTimeStepThread::prepareTimeStepAnalysis(const AnalysisInfo& anaInfo, int timeStep){ 00045 this->analysisInfo = anaInfo; 00046 this->timeStep = timeStep; 00047 } 00048 00049 00051 void AbstractAnalysisTimeStepThread::stopThread(){ 00052 stop = true; 00053 } 00054 00055 00056 /*----------------------------------------------------------*/ 00057 /*----- PRIVATE SLOTS -----*/ 00058 /*----------------------------------------------------------*/ 00059 00061 void AbstractAnalysisTimeStepThread::updateResults(){ 00062 emit newResultsFound(); 00063 } 00064 00065 00067 void AbstractAnalysisTimeStepThread::updateProgress(const QString& msg, unsigned int timeStep, unsigned int stepsCompleted, unsigned int totalSteps){ 00068 emit progress(msg, timeStep, stepsCompleted, totalSteps); 00069 } 00070 00071 00072 /*----------------------------------------------------------*/ 00073 /*----- PRIVATE METHODS -----*/ 00074 /*----------------------------------------------------------*/ 00075 00077 void AbstractAnalysisTimeStepThread::setError(const QString& message){ 00078 error = true; 00079 errorMessage = message; 00080 00081 //exit this thread 00082 stopThread(); 00083 } 00084