OTB  9.0.0
Orfeo Toolbox
otbVectorDataToSpecificDescriptionFilterBase.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbVectorDataToSpecificDescriptionFilterBase_hxx
22 #define otbVectorDataToSpecificDescriptionFilterBase_hxx
23 
25 
26 namespace otb
27 {
28 
29 // Constructor
30 template <class TVectorData>
32 {
33  this->SetNumberOfRequiredInputs(1);
34 }
35 
36 template <class TVectorData>
38 {
39  // Process object is not const-correct so the const_cast is required here
40  // input(0) is dedicated to the input vector data, support #i is
41  // stored in input(i+1)
42  this->itk::ProcessObject::SetNthInput(idx + 1, const_cast<DataObject*>(support));
43 }
44 
45 template <class TVectorData>
48 {
49  if (this->GetNumberOfInputs() < idx + 2)
50  {
51  return nullptr;
52  }
53 
54  return static_cast<const DataObject*>(this->itk::ProcessObject::GetInput(idx + 1));
55 }
56 
57 // PrintSelf Method
58 template <class TVectorData>
59 void VectorDataToSpecificDescriptionFilterBase<TVectorData>::PrintSelf(std::ostream& os, itk::Indent indent) const
60 {
61  Superclass::PrintSelf(os, indent);
62  os << indent << "Number of Support: " << (int)(this->GetNumberOfInputs()) - 1 << std::endl;
63 }
64 
65 } // end namespace otb
66 
67 #endif
otb::VectorDataToSpecificDescriptionFilterBase::GetSupport
const itk::DataObject * GetSupport(unsigned int idx)
Definition: otbVectorDataToSpecificDescriptionFilterBase.hxx:47
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::VectorDataToSpecificDescriptionFilterBase::DataObject
itk::DataObject DataObject
Definition: otbVectorDataToSpecificDescriptionFilterBase.h:67
otb::VectorDataToSpecificDescriptionFilterBase::AddSupport
virtual void AddSupport(const itk::DataObject *support, unsigned int idx)
Definition: otbVectorDataToSpecificDescriptionFilterBase.hxx:37
otb::VectorDataToSpecificDescriptionFilterBase::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbVectorDataToSpecificDescriptionFilterBase.hxx:59
otbVectorDataToSpecificDescriptionFilterBase.h
otb::VectorDataToSpecificDescriptionFilterBase::VectorDataToSpecificDescriptionFilterBase
VectorDataToSpecificDescriptionFilterBase()
Definition: otbVectorDataToSpecificDescriptionFilterBase.hxx:31