]> Creatis software - clitk.git/blobdiff - common/clitkFilterBase.cxx
minor fixes
[clitk.git] / common / clitkFilterBase.cxx
index 74424d4c3c9e14266c6fe2db4133bff97efec45f..07b992512ce009257dedfdc7ae4640a9cce0a42c 100644 (file)
 //--------------------------------------------------------------------
 clitk::FilterBase::FilterBase() 
 {
+  SetMustStop(false);
   SetVerboseOption(false);
   SetCurrentStepNumber(0);
   SetCurrentStepBaseId("");
   StopOnErrorOn();
   ResetLastError();
-  VerboseWarningOffOn(); // OffOn, it's cool not ?
+  VerboseWarningOffOn(); // OffOn, it's cool no ?
   SetWarning("");
 }
 //--------------------------------------------------------------------
@@ -67,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;
@@ -79,8 +82,10 @@ void clitk::FilterBase::StartNewStep(std::string s)
     SetCurrentStepId(oss.str());
   }
 
+  m_CurrentStepName = "Step "+GetCurrentStepId()+" -- "+s;
   if (m_VerboseStep) {
-    std::cout << "Step " << GetCurrentStepId() << " -- " << s << std::endl;
+    std::cout << m_CurrentStepName << std::endl;
+    //"Step " << GetCurrentStepId() << " -- " << s << std::endl;
   }
 }
 //--------------------------------------------------------------------
@@ -89,7 +94,33 @@ 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::SetMustStop(bool b)
+{
+  m_MustStop = b;
+  if (GetMustStop()) {
+    SetLastError("Filter is interrupted.");  
+  }
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+bool clitk::FilterBase::GetMustStop()
+{
+  if (m_MustStop) return true;
+  if (HasError()) return true;
+  return false;
+}
+//--------------------------------------------------------------------
+
+