OTB  7.1.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-2019 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
CommandType::Pointer m_StartWriterCommand
itk::ProcessObject * GetProcess()
itk::ProcessObject::Pointer m_SourceProcess
std::string GetComment() const
CommandType::Pointer m_ProgressWriterCommand
Stopwatch timer.
Definition: otbStopwatch.h:41
This class is an abstract class Provides an interface to progress task mechanic.
itk::SimpleMemberCommand< WriterWatcherBase > CommandType
itk::ProcessObject::Pointer m_Process
CommandType::Pointer m_EndWriterCommand
otb::Stopwatch & GetStopwatch()
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
CommandType::Pointer m_ProgressFilterCommand
CommandType::Pointer m_EndFilterCommand
CommandType::Pointer m_StartFilterCommand