OTB  6.7.0
Orfeo Toolbox
otbStatisticsXMLFileWriter.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 otbStatisticsXMLFileWriter_h
22 #define otbStatisticsXMLFileWriter_h
23 
24 #include "itkProcessObject.h"
25 #include <utility>
26 #include <string>
27 
28 namespace otb {
29 
42 template < class TMeasurementVector>
44  public itk::Object
45 {
46 public:
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 
93  virtual void GenerateData();
94 
97  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
98 
99 private:
100  StatisticsXMLFileWriter(const Self&) = delete;
101  void operator=(const Self&) = delete;
102 
103  std::string m_FileName;
106 
107 }; // end of class StatisticsXMLFileWriter
108 
109 } // end of namespace otb
110 
111 #ifndef OTB_MANUAL_INSTANTIATION
113 #endif
114 
115 #endif
Write in a xml file the values stored in a MeasurementVector set as input.
MeasurementVectorContainer m_MeasurementVectorContainer
std::map< std::string, std::string > GenericMapType
void operator=(const Self &)=delete
void AddInputMap(const char *name, const MapType &map)
itk::SmartPointer< const Self > ConstPointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
MeasurementVectorType::ValueType InputValueType
std::vector< InputDataType > MeasurementVectorContainer
void AddInput(const char *name, const MeasurementVectorType &inputVector)
std::map< std::string, GenericMapType > GenericMapContainer
std::pair< std::string, MeasurementVectorType > InputDataType