OTB  10.0.0
Orfeo Toolbox
otbPipelineMemoryPrintCalculator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 #include <set>
26 #include <iosfwd>
27 
28 #include "OTBStreamingExport.h"
29 
30 namespace otb
31 {
68 class OTBStreaming_EXPORT PipelineMemoryPrintCalculator : public itk::Object
69 {
70 public:
73  using Superclass = itk::Object;
74  using Pointer = itk::SmartPointer<Self>;
75  using ConstPointer = itk::SmartPointer<const Self>;
76 
78  using ProcessObjectType = itk::ProcessObject;
79  using ProcessObjectPointerType = ProcessObjectType::Pointer;
80  using DataObjectType = itk::DataObject;
81  using DataObjectPointerType = DataObjectType::Pointer;
82  using MemoryPrintType = std::uint64_t;
83  using ProcessObjectPointerSetType = std::set<const ProcessObjectType*> ;
84 
86  itkTypeMacro(PipelineMemoryPrintCalculator, itk::Object);
87 
89  itkNewMacro(Self);
90 
92  itkGetMacro(MemoryPrint, MemoryPrintType);
93 
97  itkSetMacro(BiasCorrectionFactor, double);
98  itkGetMacro(BiasCorrectionFactor, double);
100 
102  static unsigned long EstimateOptimalNumberOfStreamDivisions(MemoryPrintType memoryPrint, MemoryPrintType availableMemory);
103 
105  itkSetObjectMacro(DataToWrite, DataObjectType);
106 
108  void Compute(bool propagate = true);
109 
111  static const double ByteToMegabyte;
112  static const double MegabyteToByte;
113 
116 
117 protected:
120 
123 
125  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
126 
129 
130 private:
132  void operator=(const Self&) = delete;
133 
136 
139 
142 
145 };
146 } // end of namespace otb
147 
148 #endif
Estimate pipeline memory usage and optimal stream divisions.
PipelineMemoryPrintCalculator(const Self &)=delete
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void operator=(const Self &)=delete
void Compute(bool propagate=true)
static unsigned long EstimateOptimalNumberOfStreamDivisions(MemoryPrintType memoryPrint, MemoryPrintType availableMemory)
MemoryPrintType EvaluateProcessObjectPrintRecursive(ProcessObjectType *process)
std::set< const ProcessObjectType * > ProcessObjectPointerSetType
MemoryPrintType EvaluateDataObjectPrint(DataObjectType *data)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.