X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkFilterBase.cxx;h=07b992512ce009257dedfdc7ae4640a9cce0a42c;hb=2136379e8e3cd0010b909a2a7ef2580559cc3ead;hp=2b427202040f21f827a9ff113b1cb60407044687;hpb=38786c4da19b87319bbe3cecc145e3d1771d10da;p=clitk.git diff --git a/common/clitkFilterBase.cxx b/common/clitkFilterBase.cxx index 2b42720..07b9925 100644 --- a/common/clitkFilterBase.cxx +++ b/common/clitkFilterBase.cxx @@ -22,13 +22,13 @@ //-------------------------------------------------------------------- clitk::FilterBase::FilterBase() { - m_MustStop = false; + SetMustStop(false); SetVerboseOption(false); SetCurrentStepNumber(0); SetCurrentStepBaseId(""); StopOnErrorOn(); ResetLastError(); - VerboseWarningOffOn(); // OffOn, it's cool not ? + VerboseWarningOffOn(); // OffOn, it's cool no ? SetWarning(""); } //-------------------------------------------------------------------- @@ -68,6 +68,8 @@ void clitk::FilterBase::SetWarning(std::string e) //-------------------------------------------------------------------- void clitk::FilterBase::StartNewStep(std::string s) { + //m_CurrentStepTimer.Reset(); + // m_CurrentStepTimer.Start(); m_CurrentStepNumber++; if (GetCurrentStepBaseId() != "") { std::ostringstream oss; @@ -92,15 +94,32 @@ void clitk::FilterBase::StartNewStep(std::string s) //-------------------------------------------------------------------- void clitk::FilterBase::StopCurrentStep() { - + // m_CurrentStepTimer.Stop(); + // m_CurrentStepTimer.Print(std::cout); + // std::ostringstream oss; + //oss << " (" << + // m_CurrentStepName = m_CurrentStepName +" } //-------------------------------------------------------------------- //-------------------------------------------------------------------- -void clitk::FilterBase::MustStop() +void clitk::FilterBase::SetMustStop(bool b) { - m_MustStop = true; + m_MustStop = b; + if (GetMustStop()) { + SetLastError("Filter is interrupted."); + } +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +bool clitk::FilterBase::GetMustStop() +{ + if (m_MustStop) return true; + if (HasError()) return true; + return false; } //--------------------------------------------------------------------