OTB  7.1.0
Orfeo Toolbox
otbStandardOneLineFilterWatcher.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 otbStandardOneLineFilterWatcher_h
23 #define otbStandardOneLineFilterWatcher_h
24 
25 #include <iosfwd>
26 #include <memory>
27 
28 #include "otbFilterWatcherBase.h"
30 
31 namespace otb
32 {
33 
57 template <class PrintCallbackType = StandardOutputPrintCallback>
58 class OTBCommon_EXPORT_TEMPLATE StandardOneLineFilterWatcher : public FilterWatcherBase
59 {
60 public:
63  StandardOneLineFilterWatcher(itk::ProcessObject* process, const char* comment = "");
64 
65  StandardOneLineFilterWatcher(itk::ProcessObject* process, const std::string& comment = "");
66 
69 
71  ~StandardOneLineFilterWatcher() override = default;
72 
74  void SetStars(int count)
75  {
76  m_StarsCount = count;
77  }
78  const int& GetStars() const
79  {
80  return m_StarsCount;
81  }
83 
85  void SetCallback(PrintCallbackType* callback)
86  {
87  m_Callback = callback;
88  }
89 
90 protected:
92  void ShowProgress() override;
93 
95  void StartFilter() override;
96 
98  void EndFilter() override;
99 
100 private:
103 
107 
110  std::string m_Buffer;
111 
115  PrintCallbackType* m_Callback;
116 
119  std::shared_ptr<PrintCallbackType> m_DefaultCallback;
120 };
121 
122 } // end namespace otb
123 
124 #ifndef OTB_MANUAL_INSTANTIATION
126 #endif
127 
128 #endif
This class shows the percentage progress execution of the pipeline filtering process.
void SetCallback(PrintCallbackType *callback)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
std::shared_ptr< PrintCallbackType > m_DefaultCallback
This class is an abstract class Provides an interface to progress task mechanic.