OTB  9.0.0
Orfeo Toolbox
otbWriterWatcherBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbWriterWatcherBase_h
23 #define otbWriterWatcherBase_h
24 
25 #include <string>
26 
27 #include "itkCommand.h"
28 #include "itkProcessObject.h"
29 #include "otbStopwatch.h"
30 
31 #include "OTBCommonExport.h"
32 
33 namespace otb
34 {
35 
51 class OTBCommon_EXPORT WriterWatcherBase
52 {
53 public:
56  WriterWatcherBase(itk::ProcessObject* process, const char* comment = "");
57 
60  WriterWatcherBase(itk::ProcessObject* process, itk::ProcessObject* source, const char* comment = "");
61 
64 
67 
69  void operator=(const WriterWatcherBase&);
70 
72  virtual ~WriterWatcherBase();
73 
74  const char* GetNameOfClass()
75  {
76  return (m_Process.GetPointer() ? m_Process->GetNameOfClass() : "None");
77  }
78 
82  itk::ProcessObject* GetProcess()
83  {
84  return m_Process.GetPointer();
85  }
86 
88  std::string GetComment() const
89  {
90  return m_Comment;
91  }
92 
95  {
96  return m_Stopwatch;
97  }
98 
99 protected:
101  virtual void ShowWriterProgress() = 0;
102 
104  virtual void StartWriter() = 0;
105 
107  virtual void EndWriter() = 0;
108 
110  virtual void ShowFilterProgress() = 0;
111 
113  virtual void StartFilter() = 0;
114 
116  virtual void EndFilter() = 0;
117 
120 
122  std::string m_Comment;
123 
125  itk::ProcessObject::Pointer m_Process;
126 
128  itk::ProcessObject::Pointer m_SourceProcess;
129 
131  typedef itk::SimpleMemberCommand<WriterWatcherBase> CommandType;
132 
134  CommandType::Pointer m_StartWriterCommand;
135 
137  CommandType::Pointer m_EndWriterCommand;
138 
140  CommandType::Pointer m_ProgressWriterCommand;
141 
143  CommandType::Pointer m_StartFilterCommand;
144 
146  CommandType::Pointer m_EndFilterCommand;
147 
149  CommandType::Pointer m_ProgressFilterCommand;
150 
152  unsigned long m_StartWriterTag;
153 
155  unsigned long m_EndWriterTag;
156 
158  unsigned long m_ProgressWriterTag;
159 
161  unsigned long m_StartFilterTag;
162 
164  unsigned long m_EndFilterTag;
165 
167  unsigned long m_ProgressFilterTag;
168 
169 private:
170 };
171 
172 } // end namespace otb
173 
174 #endif
otb::WriterWatcherBase::m_EndFilterTag
unsigned long m_EndFilterTag
Definition: otbWriterWatcherBase.h:164
otb::WriterWatcherBase
This class is an abstract class Provides an interface to progress task mechanic.
Definition: otbWriterWatcherBase.h:51
otb::WriterWatcherBase::m_StartWriterCommand
CommandType::Pointer m_StartWriterCommand
Definition: otbWriterWatcherBase.h:134
otb::WriterWatcherBase::m_EndFilterCommand
CommandType::Pointer m_EndFilterCommand
Definition: otbWriterWatcherBase.h:146
otb::WriterWatcherBase::GetComment
std::string GetComment() const
Definition: otbWriterWatcherBase.h:88
otb::WriterWatcherBase::m_ProgressFilterCommand
CommandType::Pointer m_ProgressFilterCommand
Definition: otbWriterWatcherBase.h:149
otb::WriterWatcherBase::m_SourceProcess
itk::ProcessObject::Pointer m_SourceProcess
Definition: otbWriterWatcherBase.h:128
otb::WriterWatcherBase::m_ProgressWriterCommand
CommandType::Pointer m_ProgressWriterCommand
Definition: otbWriterWatcherBase.h:140
otb::WriterWatcherBase::m_Comment
std::string m_Comment
Definition: otbWriterWatcherBase.h:122
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::WriterWatcherBase::m_Process
itk::ProcessObject::Pointer m_Process
Definition: otbWriterWatcherBase.h:125
otb::WriterWatcherBase::GetStopwatch
otb::Stopwatch & GetStopwatch()
Definition: otbWriterWatcherBase.h:94
otb::WriterWatcherBase::GetNameOfClass
const char * GetNameOfClass()
Definition: otbWriterWatcherBase.h:74
otb::WriterWatcherBase::m_EndWriterTag
unsigned long m_EndWriterTag
Definition: otbWriterWatcherBase.h:155
otb::Stopwatch
Stopwatch timer.
Definition: otbStopwatch.h:41
otb::WriterWatcherBase::m_StartWriterTag
unsigned long m_StartWriterTag
Definition: otbWriterWatcherBase.h:152
otb::WriterWatcherBase::GetProcess
itk::ProcessObject * GetProcess()
Definition: otbWriterWatcherBase.h:82
otb::WriterWatcherBase::m_StartFilterTag
unsigned long m_StartFilterTag
Definition: otbWriterWatcherBase.h:161
otb::WriterWatcherBase::m_EndWriterCommand
CommandType::Pointer m_EndWriterCommand
Definition: otbWriterWatcherBase.h:137
otb::WriterWatcherBase::CommandType
itk::SimpleMemberCommand< WriterWatcherBase > CommandType
Definition: otbWriterWatcherBase.h:131
otb::WriterWatcherBase::m_ProgressFilterTag
unsigned long m_ProgressFilterTag
Definition: otbWriterWatcherBase.h:167
otb::WriterWatcherBase::m_Stopwatch
otb::Stopwatch m_Stopwatch
Definition: otbWriterWatcherBase.h:119
otbStopwatch.h
otb::WriterWatcherBase::m_ProgressWriterTag
unsigned long m_ProgressWriterTag
Definition: otbWriterWatcherBase.h:158
otb::WriterWatcherBase::m_StartFilterCommand
CommandType::Pointer m_StartFilterCommand
Definition: otbWriterWatcherBase.h:143