OTB  9.0.0
Orfeo Toolbox
otbStatisticsXMLFileWriter.h
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 otbStatisticsXMLFileWriter_h
22 #define otbStatisticsXMLFileWriter_h
23 
24 #include "itkProcessObject.h"
25 #include <utility>
26 #include <string>
27 
28 namespace otb
29 {
30 
43 template <class TMeasurementVector>
44 class StatisticsXMLFileWriter : public itk::Object
45 {
46 public:
49  typedef itk::Object Superclass;
50  typedef itk::SmartPointer<Self> Pointer;
51  typedef itk::SmartPointer<const Self> ConstPointer;
52 
54  itkTypeMacro(StatisticsXMLFileWriter, itk::Object);
55 
57  itkNewMacro(Self);
58 
60  typedef TMeasurementVector MeasurementVectorType;
61  typedef typename MeasurementVectorType::ValueType InputValueType;
62 
64  typedef std::pair<std::string, MeasurementVectorType> InputDataType;
65  typedef std::vector<InputDataType> MeasurementVectorContainer;
66 
67  typedef std::map<std::string, std::string> GenericMapType;
68  typedef std::map<std::string, GenericMapType> GenericMapContainer;
69 
71  void AddInput(const char* name, const MeasurementVectorType& inputVector);
72 
74  template <typename MapType>
75  void AddInputMap(const char* name, const MapType& map);
76 
78  void CleanInputs();
79 
81  void Update()
82  {
83  this->GenerateData();
84  }
85 
87  itkSetStringMacro(FileName);
88  itkGetStringMacro(FileName);
90 
91 protected:
92  virtual void GenerateData();
93 
96  {
97  }
98  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
99 
100 private:
101  StatisticsXMLFileWriter(const Self&) = delete;
102  void operator=(const Self&) = delete;
103 
104  std::string m_FileName;
107 
108 }; // end of class StatisticsXMLFileWriter
109 
110 } // end of namespace otb
111 
112 #ifndef OTB_MANUAL_INSTANTIATION
114 #endif
115 
116 #endif
otb::StatisticsXMLFileWriter::InputDataType
std::pair< std::string, MeasurementVectorType > InputDataType
Definition: otbStatisticsXMLFileWriter.h:64
otb::StatisticsXMLFileWriter::GenericMapType
std::map< std::string, std::string > GenericMapType
Definition: otbStatisticsXMLFileWriter.h:67
otb::StatisticsXMLFileWriter::InputValueType
MeasurementVectorType::ValueType InputValueType
Definition: otbStatisticsXMLFileWriter.h:61
otb::StatisticsXMLFileWriter::AddInputMap
void AddInputMap(const char *name, const MapType &map)
Definition: otbStatisticsXMLFileWriter.hxx:152
otb::StatisticsXMLFileWriter::MeasurementVectorContainer
std::vector< InputDataType > MeasurementVectorContainer
Definition: otbStatisticsXMLFileWriter.h:65
otb::StatisticsXMLFileWriter::Self
StatisticsXMLFileWriter Self
Definition: otbStatisticsXMLFileWriter.h:48
otb::StatisticsXMLFileWriter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStatisticsXMLFileWriter.h:51
otb::StatisticsXMLFileWriter::~StatisticsXMLFileWriter
~StatisticsXMLFileWriter() override
Definition: otbStatisticsXMLFileWriter.h:95
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::StatisticsXMLFileWriter::StatisticsXMLFileWriter
StatisticsXMLFileWriter()
Definition: otbStatisticsXMLFileWriter.hxx:35
otb::StatisticsXMLFileWriter::m_FileName
std::string m_FileName
Definition: otbStatisticsXMLFileWriter.h:104
otb::StatisticsXMLFileWriter::Update
void Update()
Definition: otbStatisticsXMLFileWriter.h:81
otb::StatisticsXMLFileWriter::operator=
void operator=(const Self &)=delete
otb::StatisticsXMLFileWriter::GenericMapContainer
std::map< std::string, GenericMapType > GenericMapContainer
Definition: otbStatisticsXMLFileWriter.h:68
otb::StatisticsXMLFileWriter::MeasurementVectorType
TMeasurementVector MeasurementVectorType
Definition: otbStatisticsXMLFileWriter.h:57
otb::StatisticsXMLFileWriter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStatisticsXMLFileWriter.h:50
otb::StatisticsXMLFileWriter::Superclass
itk::Object Superclass
Definition: otbStatisticsXMLFileWriter.h:49
otb::StatisticsXMLFileWriter::AddInput
void AddInput(const char *name, const MeasurementVectorType &inputVector)
Definition: otbStatisticsXMLFileWriter.hxx:41
otb::StatisticsXMLFileWriter::m_GenericMapContainer
GenericMapContainer m_GenericMapContainer
Definition: otbStatisticsXMLFileWriter.h:106
otb::StatisticsXMLFileWriter::CleanInputs
void CleanInputs()
Definition: otbStatisticsXMLFileWriter.hxx:175
otb::StatisticsXMLFileWriter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbStatisticsXMLFileWriter.hxx:183
otb::StatisticsXMLFileWriter
Write in a xml file the values stored in a MeasurementVector set as input.
Definition: otbStatisticsXMLFileWriter.h:44
otb::StatisticsXMLFileWriter::GenerateData
virtual void GenerateData()
Definition: otbStatisticsXMLFileWriter.hxx:60
otbStatisticsXMLFileWriter.hxx
otb::StatisticsXMLFileWriter::m_MeasurementVectorContainer
MeasurementVectorContainer m_MeasurementVectorContainer
Definition: otbStatisticsXMLFileWriter.h:105