Commit 188bc185 authored by Antoine Regimbeau's avatar Antoine Regimbeau

REFAC: lighter header

parent dad1313d
......@@ -66,57 +66,33 @@ public:
/** Destructor. */
virtual ~FilterWatcherBase();
const char *GetNameOfClass()
{
return (m_Process.GetPointer() ? m_Process->GetNameOfClass() : "None");
}
const char *GetNameOfClass() const;
/** Methods to access member data */
/** Get a pointer to the process object being watched. */
itk::ProcessObject *GetProcess()
{
return m_Process.GetPointer();
}
itk::ProcessObject *GetProcess() const;
/** Get the comment for the watcher. */
std::string GetComment()
{
return m_Comment;
}
std::string GetComment() const;
// Q: Why not get a const &?
/** Get a const reference to the Stopwatch */
const otb::Stopwatch& GetStopwatch() const;
/** Get a reference to the Stopwatch */
otb::Stopwatch& GetStopwatch()
{
return m_Stopwatch;
}
otb::Stopwatch& GetStopwatch();
protected:
/** Callback method to show the ProgressEvent */
virtual void ShowProgressCallback()
{
this->ShowProgress();
}
virtual void ShowProgressCallback();
/** Callback method to show the StartEvent */
virtual void StartFilterCallback()
{
if (!m_Started)
{
this->StartFilter();
m_Started = true;
}
}
virtual void StartFilterCallback();
/** Callback method to show the EndEvent */
virtual void EndFilterCallback()
{
if (!m_Ended)
{
this->EndFilter();
m_Ended = true;
}
}
virtual void EndFilterCallback();
/** Callback method to show the ProgressEvent */
virtual void ShowProgress() = 0;
......
......@@ -62,7 +62,7 @@ public:
const std::string& comment = "");
/** Default constructor */
StandardFilterWatcher() : m_StarsCount(0) {};
StandardFilterWatcher();
/** Copy constructor */
StandardFilterWatcher(const StandardFilterWatcher&);
......@@ -71,14 +71,9 @@ public:
void operator =(const StandardFilterWatcher&);
/** Get/Set number of stars */
void SetStars(int count)
{
m_StarsCount = count;
}
const int& GetStars() const
{
return m_StarsCount;
}
void SetStars(int count) ;
const int& GetStars() const;
protected:
......
......@@ -67,14 +67,9 @@ public:
StandardOneLineFilterWatcher();
/** Get/Set number of stars */
void SetStars(int count)
{
m_StarsCount = count;
}
const int& GetStars() const
{
return m_StarsCount;
}
void SetStars(int count);
const int& GetStars() const;
protected:
......
......@@ -109,7 +109,7 @@ protected:
void EndFilter() override {}
/** This is the method invoked by ShowFilterProgress() and ShowWriterProgress() */
virtual void ShowProgress();
virtual void ShowProgress() const;
private:
......
......@@ -73,29 +73,21 @@ public:
/** Destructor. */
virtual ~WriterWatcherBase();
const char *GetNameOfClass()
{
return (m_Process.GetPointer() ? m_Process->GetNameOfClass() : "None");
}
const char *GetNameOfClass();
/** Methods to access member data */
/** Get a pointer to the process object being watched. */
itk::ProcessObject *GetProcess()
{
return m_Process.GetPointer();
}
itk::ProcessObject *GetProcess() const;
/** Get the comment for the watcher. */
std::string GetComment() const
{
return m_Comment;
}
std::string GetComment() const;
// Q: Why not get a const &?
/** Get a const reference to the Stopwatch */
const otb::Stopwatch& GetStopwatch() const;
/** Get a reference to the Stopwatch */
otb::Stopwatch& GetStopwatch()
{
return m_Stopwatch;
}
otb::Stopwatch& GetStopwatch();
protected:
......
......@@ -166,4 +166,68 @@ FilterWatcherBase
}
}
const char *
FilterWatcherBase
::GetNameOfClass() const
{
return (m_Process.GetPointer() ? m_Process->GetNameOfClass() : "None");
}
itk::ProcessObject *
FilterWatcherBase
::GetProcess() const
{
return m_Process.GetPointer();
}
std::string
FilterWatcherBase
::GetComment() const
{
return m_Comment;
}
const otb::Stopwatch&
FilterWatcherBase
::GetStopwatch() const
{
return m_Stopwatch;
}
otb::Stopwatch&
FilterWatcherBase
::GetStopwatch()
{
return m_Stopwatch;
}
void
FilterWatcherBase
::ShowProgressCallback()
{
this->ShowProgress();
}
void
FilterWatcherBase
::StartFilterCallback()
{
if (!m_Started)
{
this->StartFilter();
m_Started = true;
}
}
void
FilterWatcherBase
::EndFilterCallback()
{
if (!m_Ended)
{
this->EndFilter();
m_Ended = true;
}
}
} // end namespace otb
......@@ -27,29 +27,35 @@ namespace otb
StandardFilterWatcher
::StandardFilterWatcher(itk::ProcessObject* process,
const char *comment)
: FilterWatcherBase(process, comment)
: FilterWatcherBase(process, comment) ,
m_StarsCount(50),
m_CurrentNbStars(-1)
{
m_StarsCount = 50;
m_CurrentNbStars = -1;
}
StandardFilterWatcher
::StandardFilterWatcher(itk::ProcessObject* process,
const std::string& comment)
: FilterWatcherBase(process, comment.c_str())
: FilterWatcherBase(process, comment.c_str()),
m_StarsCount(50),
m_CurrentNbStars(-1)
{
m_StarsCount = 50;
m_CurrentNbStars = -1;
}
StandardFilterWatcher
::StandardFilterWatcher(const StandardFilterWatcher& watch) : FilterWatcherBase(watch)
::StandardFilterWatcher(const StandardFilterWatcher& watch)
: FilterWatcherBase(watch)
{
// Initialize state
m_StarsCount = watch.m_StarsCount;
m_CurrentNbStars = watch.m_CurrentNbStars;
}
StandardFilterWatcher
::StandardFilterWatcher() : m_StarsCount(0)
{
}
void
StandardFilterWatcher
::operator =(const StandardFilterWatcher& watch)
......@@ -60,6 +66,20 @@ StandardFilterWatcher
m_CurrentNbStars = watch.m_CurrentNbStars;
}
void
StandardFilterWatcher
::SetStars(int count)
{
m_StarsCount = count;
}
const int&
StandardFilterWatcher
::GetStars() const
{
return m_StarsCount;
}
void
StandardFilterWatcher
::ShowProgress()
......
......@@ -53,6 +53,20 @@ StandardOneLineFilterWatcher
{
}
void
StandardOneLineFilterWatcher
::SetStars(int count)
{
m_StarsCount = count;
}
const int&
StandardOneLineFilterWatcher
::GetStars() const
{
return m_StarsCount;
}
void
StandardOneLineFilterWatcher
::ShowProgress()
......
......@@ -30,40 +30,40 @@ namespace otb
StandardWriterWatcher
::StandardWriterWatcher(itk::ProcessObject* process,
const char *comment)
: WriterWatcherBase(process, comment)
: WriterWatcherBase(process, comment) ,
m_StarsCount(50)
{
m_StarsCount = 50;
}
StandardWriterWatcher
::StandardWriterWatcher(itk::ProcessObject* process, itk::ProcessObject * source,
const char *comment)
: WriterWatcherBase(process, source, comment)
: WriterWatcherBase(process, source, comment) ,
m_StarsCount(50)
{
m_StarsCount = 50;
}
StandardWriterWatcher
::StandardWriterWatcher(itk::ProcessObject* process,
const std::string& comment)
: WriterWatcherBase(process, comment.c_str())
: WriterWatcherBase(process, comment.c_str()) ,
m_StarsCount(50)
{
m_StarsCount = 50;
}
StandardWriterWatcher
::StandardWriterWatcher(itk::ProcessObject* process, itk::ProcessObject * source,
const std::string& comment)
: WriterWatcherBase(process, source, comment.c_str())
: WriterWatcherBase(process, source, comment.c_str()) ,
m_StarsCount(50)
{
m_StarsCount = 50;
}
StandardWriterWatcher
::StandardWriterWatcher(const StandardWriterWatcher& watch) : WriterWatcherBase(watch)
::StandardWriterWatcher(const StandardWriterWatcher& watch)
: WriterWatcherBase(watch) ,
m_StarsCount ( watch.m_StarsCount)
{
// Initialize state
m_StarsCount = watch.m_StarsCount;
}
void
......@@ -91,7 +91,7 @@ StandardWriterWatcher
void
StandardWriterWatcher
::ShowProgress()
::ShowProgress() const
{
std::ostringstream oss;
oss.str("");
......
......@@ -372,4 +372,39 @@ WriterWatcherBase
}
}
const char *
WriterWatcherBase
::GetNameOfClass()
{
return (m_Process.GetPointer() ? m_Process->GetNameOfClass() : "None");
}
itk::ProcessObject *
WriterWatcherBase
::GetProcess() const
{
return m_Process.GetPointer();
}
std::string
WriterWatcherBase
::GetComment() const
{
return m_Comment;
}
const otb::Stopwatch&
WriterWatcherBase
::GetStopwatch() const
{
return m_Stopwatch;
}
otb::Stopwatch&
WriterWatcherBase
::GetStopwatch()
{
return m_Stopwatch;
}
} // end namespace otb
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment