OTB  9.0.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-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 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
otbStandardOutputPrintCallback.h
otb::StandardOneLineFilterWatcher
This class shows the percentage progress execution of the pipeline filtering process.
Definition: otbStandardOneLineFilterWatcher.h:58
otb::StandardOneLineFilterWatcher::SetStars
void SetStars(int count)
Definition: otbStandardOneLineFilterWatcher.h:74
otb::StandardOneLineFilterWatcher::m_Callback
PrintCallbackType * m_Callback
Definition: otbStandardOneLineFilterWatcher.h:115
otb::StandardOneLineFilterWatcher::m_DefaultCallback
std::shared_ptr< PrintCallbackType > m_DefaultCallback
Definition: otbStandardOneLineFilterWatcher.h:119
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbFilterWatcherBase.h
otb::StandardOneLineFilterWatcher::m_CurrentNbStars
int m_CurrentNbStars
Definition: otbStandardOneLineFilterWatcher.h:106
otb::StandardOneLineFilterWatcher::GetStars
const int & GetStars() const
Definition: otbStandardOneLineFilterWatcher.h:78
otbStandardOneLineFilterWatcher.hxx
otb::FilterWatcherBase
This class is an abstract class Provides an interface to progress task mechanic.
Definition: otbFilterWatcherBase.h:48
otb::StandardOneLineFilterWatcher::m_Buffer
std::string m_Buffer
Definition: otbStandardOneLineFilterWatcher.h:110
otb::StandardOneLineFilterWatcher::SetCallback
void SetCallback(PrintCallbackType *callback)
Definition: otbStandardOneLineFilterWatcher.h:85
otb::StandardOneLineFilterWatcher::m_StarsCount
int m_StarsCount
Definition: otbStandardOneLineFilterWatcher.h:102