OTB  9.0.0
Orfeo Toolbox
otbPipelineMemoryPrintCalculator.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 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 : public itk::Object
74 {
75 public:
78  typedef itk::Object Superclass;
79  typedef itk::SmartPointer<Self> Pointer;
80  typedef itk::SmartPointer<const Self> ConstPointer;
81 
83  typedef itk::ProcessObject ProcessObjectType;
84  typedef ProcessObjectType::Pointer ProcessObjectPointerType;
85  typedef itk::DataObject DataObjectType;
86  typedef DataObjectType::Pointer DataObjectPointerType;
87 #if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 8)
88  typedef ::itksysFundamentalType_UInt64 MemoryPrintType;
89 #else
90  typedef KWIML_INT_uint64_t MemoryPrintType;
91 #endif
92  typedef std::set<const ProcessObjectType*> ProcessObjectPointerSetType;
93 
95  itkTypeMacro(PipelineMemoryPrintCalculator, itk::Object);
96 
98  itkNewMacro(Self);
99 
101  itkGetMacro(MemoryPrint, MemoryPrintType);
102 
106  itkSetMacro(BiasCorrectionFactor, double);
107  itkGetMacro(BiasCorrectionFactor, double);
109 
111  static unsigned long EstimateOptimalNumberOfStreamDivisions(MemoryPrintType memoryPrint, MemoryPrintType availableMemory);
112 
114  itkSetObjectMacro(DataToWrite, DataObjectType);
115 
117  void Compute(bool propagate = true);
118 
120  static const double ByteToMegabyte;
121  static const double MegabyteToByte;
122 
124  MemoryPrintType EvaluateDataObjectPrint(DataObjectType* data);
125 
126 protected:
129 
131  ~PipelineMemoryPrintCalculator() override;
132 
134  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
135 
137  MemoryPrintType EvaluateProcessObjectPrintRecursive(ProcessObjectType* process);
138 
139 private:
140  PipelineMemoryPrintCalculator(const Self&) = delete;
141  void operator=(const Self&) = delete;
142 
145 
148 
151 
154 };
155 } // end of namespace otb
156 
157 #endif
otb::PipelineMemoryPrintCalculator::MemoryPrintType
::itksysFundamentalType_UInt64 MemoryPrintType
Definition: otbPipelineMemoryPrintCalculator.h:88
otb::PipelineMemoryPrintCalculator
Estimate pipeline memory usage and optimal stream divisions.
Definition: otbPipelineMemoryPrintCalculator.h:73
otb::PipelineMemoryPrintCalculator::ByteToMegabyte
static const double ByteToMegabyte
Definition: otbPipelineMemoryPrintCalculator.h:120
otb::PipelineMemoryPrintCalculator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbPipelineMemoryPrintCalculator.h:79
otb::PipelineMemoryPrintCalculator::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbPipelineMemoryPrintCalculator.h:80
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::PipelineMemoryPrintCalculator::DataObjectType
itk::DataObject DataObjectType
Definition: otbPipelineMemoryPrintCalculator.h:85
otb::PipelineMemoryPrintCalculator::Self
PipelineMemoryPrintCalculator Self
Definition: otbPipelineMemoryPrintCalculator.h:77
otb::PipelineMemoryPrintCalculator::ProcessObjectPointerSetType
std::set< const ProcessObjectType * > ProcessObjectPointerSetType
Definition: otbPipelineMemoryPrintCalculator.h:92
otb::PipelineMemoryPrintCalculator::m_DataToWrite
DataObjectPointerType m_DataToWrite
Definition: otbPipelineMemoryPrintCalculator.h:147
otb::PipelineMemoryPrintCalculator::ProcessObjectType
itk::ProcessObject ProcessObjectType
Definition: otbPipelineMemoryPrintCalculator.h:83
otb::PipelineMemoryPrintCalculator::m_BiasCorrectionFactor
double m_BiasCorrectionFactor
Definition: otbPipelineMemoryPrintCalculator.h:150
otb::PipelineMemoryPrintCalculator::MegabyteToByte
static const double MegabyteToByte
Definition: otbPipelineMemoryPrintCalculator.h:121
otb::PipelineMemoryPrintCalculator::ProcessObjectPointerType
ProcessObjectType::Pointer ProcessObjectPointerType
Definition: otbPipelineMemoryPrintCalculator.h:84
otb::PipelineMemoryPrintCalculator::DataObjectPointerType
DataObjectType::Pointer DataObjectPointerType
Definition: otbPipelineMemoryPrintCalculator.h:86
otb::PipelineMemoryPrintCalculator::Superclass
itk::Object Superclass
Definition: otbPipelineMemoryPrintCalculator.h:78
otb::PipelineMemoryPrintCalculator::m_MemoryPrint
MemoryPrintType m_MemoryPrint
Definition: otbPipelineMemoryPrintCalculator.h:144
otb::PipelineMemoryPrintCalculator::m_VisitedProcessObjects
ProcessObjectPointerSetType m_VisitedProcessObjects
Definition: otbPipelineMemoryPrintCalculator.h:153