OTB  6.1.0
Orfeo Toolbox
otbVectorDataToSpecificDescriptionFilterBase.txx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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_txx
22 #define otbVectorDataToSpecificDescriptionFilterBase_txx
23 
25 
26 namespace otb
27 {
28 
29 // Constructor
30 template <class TVectorData>
33 {
34  this->SetNumberOfRequiredInputs(1);
35 }
36 
37 template <class TVectorData>
38 void
40 ::AddSupport(const DataObject * support, unsigned int idx)
41 {
42  // Process object is not const-correct so the const_cast is required here
43  // input(0) is dedicated to the input vector data, support #i is
44  // stored in input(i+1)
46  const_cast<DataObject *>(support));
47 }
48 
49 template <class TVectorData>
51 ::DataObject *
53 ::GetSupport(unsigned int idx)
54 {
55  if (this->GetNumberOfInputs() < idx+2)
56  {
57  return ITK_NULLPTR;
58  }
59 
60  return static_cast<const DataObject *>
61  (this->itk::ProcessObject::GetInput(idx+1));
62 }
63 
64 // PrintSelf Method
65 template <class TVectorData>
66 void
68 ::PrintSelf(std::ostream& os, itk::Indent indent) const
69 {
70  Superclass::PrintSelf(os, indent);
71  os<<indent<<"Number of Support: "<<(int)(this->GetNumberOfInputs())-1<<std::endl;
72 }
73 
74 } // end namespace otb
75 
76 #endif
void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE
DataObject * GetInput(const DataObjectIdentifierType &key)
Base class for VectorDataToSpecificDescriptionFilters.
virtual void AddSupport(const itk::DataObject *support, unsigned int idx)
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)