OTB  6.7.0
Orfeo Toolbox
otbPipelineMemoryPrintCalculator.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 otbPipelineMemoryPrintCalculator_h
22 #define otbPipelineMemoryPrintCalculator_h
23 
24 #include "itkProcessObject.h"
25 #if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
26 #include "itksys/FundamentalType.h"
27 #else
28 #include "itk_kwiml.h"
29 #endif
30 #include <set>
31 #include <iosfwd>
32 
33 #include "OTBStreamingExport.h"
34 
35 namespace otb
36 {
73 class OTBStreaming_EXPORT PipelineMemoryPrintCalculator :
74  public itk::Object
75 {
76 public:
82 
88 #if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
89  typedef ::itksysFundamentalType_UInt64 MemoryPrintType;
90 #else
91  typedef KWIML_INT_uint64_t MemoryPrintType;
92 #endif
93  typedef std::set<const ProcessObjectType *> ProcessObjectPointerSetType;
94 
97 
99  itkNewMacro(Self);
100 
102  itkGetMacro(MemoryPrint, MemoryPrintType);
103 
107  itkSetMacro(BiasCorrectionFactor, double);
108  itkGetMacro(BiasCorrectionFactor, double);
110 
112  static unsigned long EstimateOptimalNumberOfStreamDivisions(
113  MemoryPrintType memoryPrint, MemoryPrintType availableMemory);
114 
116  itkSetObjectMacro(DataToWrite, DataObjectType);
117 
119  void Compute(bool propagate=true);
120 
122  static const double ByteToMegabyte;
123  static const double MegabyteToByte;
124 
126  MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data);
127 
128 protected:
131 
133  ~PipelineMemoryPrintCalculator() override;
134 
136  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
137 
139  MemoryPrintType EvaluateProcessObjectPrintRecursive(ProcessObjectType * process);
140 
141 private:
142  PipelineMemoryPrintCalculator(const Self &) = delete;
143  void operator =(const Self&) = delete;
144 
147 
150 
153 
156 
157 };
158 } // end of namespace otb
159 
160 #endif
std::set< const ProcessObjectType * > ProcessObjectPointerSetType
Estimate pipeline memory usage and optimal stream divisions.