// 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;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void clitk::FilterBase::StartNewStep(std::string s)
{
+ if (Cancelled()) {
+ throw clitk::ExceptionObject("Filter is canceled.");
+ }
+
m_CurrentStepNumber++;
if (GetCurrentStepBaseId() != "") {
std::ostringstream oss;
//--------------------------------------------------------------------
-void clitk::FilterBase::MustStop()
+void clitk::FilterBase::Cancel()
{
- m_MustStop = true;
+ m_IsCancelled = true;
}
//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+ bool clitk::FilterBase::Cancelled()
+ {
+ return m_IsCancelled;
+ }
+//--------------------------------------------------------------------
+