OTB  10.0.0
Orfeo Toolbox
otbUnaryFunctorObjectListFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbUnaryFunctorObjectListFilter_h
22 #define otbUnaryFunctorObjectListFilter_h
23 
25 
26 namespace otb
27 {
28 
40 template <class TInputList, class TOutputList, class TFunction>
41 class ITK_EXPORT UnaryFunctorObjectListFilter : public otb::ObjectListToObjectListFilter<TInputList, TOutputList>
42 {
43 public:
47  typedef itk::SmartPointer<Self> Pointer;
48  typedef itk::SmartPointer<const Self> ConstPointer;
49 
51  itkNewMacro(Self);
52 
55 
57  typedef TFunction FunctorType;
58  typedef TInputList InputListType;
59  typedef TOutputList OutputListType;
60  typedef typename TInputList::ConstPointer InputListPointer;
61  typedef typename TOutputList::Pointer OutputListPointer;
62  typedef typename TInputList::ConstIterator InputListIterator;
63  typedef typename TOutputList::ConstIterator OutputListIterator;
64 
70  {
71  return m_Functor;
72  }
73 
74  const FunctorType& GetFunctor() const
75  {
76  return m_Functor;
77  }
78 
85  void SetFunctor(const FunctorType& functor)
86  {
87  if (m_Functor != functor)
88  {
89  m_Functor = functor;
90  this->Modified();
91  }
92  }
94 
95 protected:
98  {
99  }
100 
103  void AfterThreadedGenerateData() override;
104 
107  void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) override;
108 
111 private:
113  void operator=(const Self&) = delete;
114 
116 };
117 
118 } // end namespace otb
119 
120 #ifndef OTB_MANUAL_INSTANTIATION
122 #endif
123 
124 #endif
Base class for all process objects that output ObjectList data.
Base class for filters that take an ObjectList as input and produce an ObjectList as output.
Process each element in the ObjectList with the functor.
void SetFunctor(const FunctorType &functor)
void operator=(const Self &)=delete
otb::ObjectListToObjectListFilter< TInputList, TOutputList > Superclass
UnaryFunctorObjectListFilter(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.