]> Creatis software - clitk.git/blobdiff - common/clitkFilterBase.cxx
Corrected erroneous free when a real RECTILINEAR field is detected
[clitk.git] / common / clitkFilterBase.cxx
index 2b427202040f21f827a9ff113b1cb60407044687..09797d886c750959c84dfa4e6a4db0eb236563e4 100644 (file)
 
 // clitk
 #include "clitkFilterBase.h"
+#include "clitkCommon.h"
 
 //--------------------------------------------------------------------
 clitk::FilterBase::FilterBase() 
 {
-  m_MustStop = false;
   SetVerboseOption(false);
   SetCurrentStepNumber(0);
   SetCurrentStepBaseId("");
-  StopOnErrorOn();
-  ResetLastError();
-  VerboseWarningOffOn(); // OffOn, it's cool not ?
+  VerboseWarningOffOn(); // OffOn, it's cool no ?
   SetWarning("");
-}
-//--------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------
-void clitk::FilterBase::ResetLastError()
-{
-  m_LastError = "";
-}
-//--------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------
-void clitk::FilterBase::SetLastError(std::string e)
-{
-  m_LastError = e;
-  if (GetStopOnError()) {
-    std::cerr << GetLastError() << std::endl;
-    exit(0);
-  }
+  m_IsCancelled = false;
 }
 //--------------------------------------------------------------------
 
@@ -68,6 +47,10 @@ void clitk::FilterBase::SetWarning(std::string e)
 //--------------------------------------------------------------------
 void clitk::FilterBase::StartNewStep(std::string s) 
 {
+  if (Cancelled()) {
+    throw clitk::ExceptionObject("Filter is canceled.");
+  }
+
   m_CurrentStepNumber++;
   if (GetCurrentStepBaseId() != "") {
     std::ostringstream oss;
@@ -98,10 +81,17 @@ void clitk::FilterBase::StopCurrentStep()
 
 
 //--------------------------------------------------------------------
-void clitk::FilterBase::MustStop()
+void clitk::FilterBase::Cancel()
 {
-  m_MustStop = true;
+  m_IsCancelled = true;
 }
 //--------------------------------------------------------------------
 
 
+//--------------------------------------------------------------------
+ bool clitk::FilterBase::Cancelled()
+ {
+   return m_IsCancelled;
+ }
+//--------------------------------------------------------------------
+