OTB  6.7.0
Orfeo Toolbox
otbUnaryFunctorObjectListBooleanFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 otbUnaryFunctorObjectListBooleanFilter_h
22 #define otbUnaryFunctorObjectListBooleanFilter_h
23 
25 
26 namespace otb
27 {
28 
40 template <class TInputList, class TOutputList, class TFunction>
42  public otb::ObjectListToObjectListFilter<TInputList, TOutputList>
43 {
44 public:
50 
52  itkNewMacro(Self);
53 
56 
58  typedef TFunction FunctorType;
59  typedef TInputList InputListType;
60  typedef TOutputList OutputListType;
61  typedef typename TInputList::ConstPointer InputListPointer;
62  typedef typename TOutputList::Pointer OutputListPointer;
63  typedef typename TInputList::ConstIterator InputListIterator;
64  typedef typename TOutputList::ConstIterator OutputListIterator;
65 
71  {
72  return m_Functor;
73  }
74  const FunctorType& GetFunctor() const
75  {
76  return m_Functor;
77  }
79 
86  void SetFunctor(const FunctorType& functor)
87  {
88  if (m_Functor != functor)
89  {
90  m_Functor = functor;
91  this->Modified();
92  }
93  }
95 
96 protected:
99 
102  void AfterThreadedGenerateData() override;
103 
106  void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) override;
107 
110  {
112  };
113 
116 private:
117  UnaryFunctorObjectListBooleanFilter(const Self &) = delete;
118  void operator =(const Self&) = delete;
119 
121 };
122 
123 } // end namespace otb
124 
125 #ifndef OTB_MANUAL_INSTANTIATION
127 #endif
128 
129 #endif
otb::ObjectListToObjectListFilter< TInputList, TOutputList > Superclass
Filter an ObjectList and keep elements according to the functor value.
unsigned int ThreadIdType
Base class for filters that take an ObjectList as input and produce an ObjectList as output...