Commit dad1313d authored by Antoine Regimbeau's avatar Antoine Regimbeau

REFAC: code modernization

parent 26eed39b
......@@ -43,8 +43,8 @@ public:
typedef TInput InputType;
typedef TOutput OutputType;
DotProductFunctor() {}
virtual ~DotProductFunctor() {}
DotProductFunctor() = default;
virtual ~DotProductFunctor() = default;
bool operator !=(const DotProductFunctor& ) const
{
......@@ -149,8 +149,4 @@ private:
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbDotProductImageFilter.hxx"
#endif
#endif
......@@ -77,7 +77,7 @@ public:
bool SetString(const std::string& str, size_t start=0 , size_t size=std::string::npos);
void Print(std::ostream& os);
void Print(std::ostream& os) const;
};
/** Decode the string into a list of GenericBandRange, band indexes are
......@@ -90,8 +90,8 @@ public:
bool ResolveBandRange(const std::string &bandRange, const unsigned int &nbBands, std::vector<unsigned int> &output) const;
protected:
ExtendedFilenameHelper() {}
~ExtendedFilenameHelper() override {}
ExtendedFilenameHelper() = default;
~ExtendedFilenameHelper() override = default;
private:
ExtendedFilenameHelper(const Self &) = delete;
......
......@@ -44,13 +44,13 @@ public:
{
m_Operator = ADDITION; //1;
};
virtual ~ImageAndVectorImageOperationFunctor(){}
virtual ~ImageAndVectorImageOperationFunctor() = default;
void SetOperator(OperatorType oper)
{
m_Operator = oper;
}
OperatorType GetOperator()
OperatorType GetOperator() const
{
return m_Operator;
}
......@@ -167,8 +167,8 @@ public:
void SetVectorInput(const VectorInputImageType *input);
/** Get the input images of this process object. */
const InputImageType * GetInput();
const VectorInputImageType * GetVectorInput();
const InputImageType * GetInput() const;
const VectorInputImageType * GetVectorInput() const;
/** Accessors */
itkGetMacro(UseAddition, bool);
......@@ -215,7 +215,7 @@ public:
protected:
ImageAndVectorImageOperationFilter();
~ImageAndVectorImageOperationFilter() override;
~ImageAndVectorImageOperationFilter() override = default;
/** This is a source, so it must set the spacing, size, and largest possible
* region for the output image that it will produce.
......
......@@ -35,12 +35,6 @@ ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
this->UseAddition();
}
template <class TInputImage, class TVectorInputImage, class TOutputImage>
ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
::~ImageAndVectorImageOperationFilter()
{
}
template <class TInputImage, class TVectorInputImage, class TOutputImage>
void
ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
......@@ -60,7 +54,7 @@ ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
template <class TInputImage, class TVectorInputImage, class TOutputImage>
const typename ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>::InputImageType *
ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
::GetInput()
::GetInput() const
{
if (this->GetNumberOfInputs() < 1) return 0;
......@@ -70,7 +64,7 @@ ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
template <class TInputImage, class TVectorInputImage, class TOutputImage>
const typename ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>::VectorInputImageType *
ImageAndVectorImageOperationFilter<TInputImage, TVectorInputImage, TOutputImage>
::GetVectorInput()
::GetVectorInput() const
{
if (this->GetNumberOfInputs() < 2) return nullptr;
......
......@@ -81,7 +81,7 @@ public:
itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
/** Dimension of the image available at run time. */
static unsigned int GetImageDimension()
static constexpr unsigned int GetImageDimension()
{
return VImageDimension;
}
......@@ -147,9 +147,9 @@ protected:
m_RequestedNumberOfSplits(0),
m_StreamVector(),
m_IsUpToDate(false)
{}
{};
~ImageRegionAdaptativeSplitter() override {}
~ImageRegionAdaptativeSplitter() override = default;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
......
......@@ -56,7 +56,7 @@ ImageRegionAdaptativeSplitter<VImageDimension>
template <unsigned int VImageDimension>
itk::ImageRegion<VImageDimension>
ImageRegionAdaptativeSplitter<VImageDimension>
::GetSplit(unsigned int i, unsigned int itkNotUsed(numberOfPieces), const RegionType& region)
::GetSplit(unsigned int i, unsigned int /*numberOfPieces*/, const RegionType& region)
{
// Set parameters
this->SetImageRegion(region);
......
......@@ -106,8 +106,8 @@ public:
const RegionType& region) override;
protected:
ImageRegionNonUniformMultidimensionalSplitter() {}
~ImageRegionNonUniformMultidimensionalSplitter() override {}
ImageRegionNonUniformMultidimensionalSplitter() = default;
~ImageRegionNonUniformMultidimensionalSplitter() override = default;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
......
......@@ -41,10 +41,9 @@ ImageRegionNonUniformMultidimensionalSplitter<VImageDimension>
// ::ceil( std::pow((double) requestedNumber, 1.0/(double) VImageDimension));
unsigned int numberOfPiecesLeft = requestedNumber;
unsigned int j, numPieces;
numPieces = 1;
unsigned int j(VImageDimension) , numPieces(1);
for (j = VImageDimension; j > 0; --j)
for (; j > 0 ; --j )
{
if (regionSize[j - 1] < numberOfPiecesLeft)
{
......@@ -87,16 +86,10 @@ ImageRegionNonUniformMultidimensionalSplitter<VImageDimension>
::GetSplit(unsigned int i, unsigned int numberOfPieces,
const RegionType& region)
{
RegionType splitRegion;
IndexType splitIndex;
SizeType splitSize, regionSize;
// Initialize the splitRegion to the requested region
splitRegion = region;
splitIndex = splitRegion.GetIndex();
splitSize = splitRegion.GetSize();
regionSize = region.GetSize();
RegionType splitRegion(region);
IndexType splitIndex(region.GetIndex());
SizeType splitSize(region.GetSize()) , regionSize(region.GetSize());
// requested number of splits per dimension
double splitsPerDimension[VImageDimension];
......@@ -104,8 +97,8 @@ ImageRegionNonUniformMultidimensionalSplitter<VImageDimension>
unsigned int numberOfPiecesLeft = numberOfPieces;
unsigned int j;
for (j = VImageDimension; j > 0; --j)
unsigned int j(VImageDimension);
for (; j > 0; --j )
{
if (regionSize[j - 1] < numberOfPiecesLeft)
{
......@@ -122,10 +115,9 @@ ImageRegionNonUniformMultidimensionalSplitter<VImageDimension>
// if a given dimension has fewer pixels that splitsPerDimension, then
// only split number of pixels times
unsigned int splits[VImageDimension], pixelsPerSplit[VImageDimension];
unsigned int numPieces;
unsigned int numPieces(1);
unsigned int ijk[VImageDimension];
unsigned int offsetTable[VImageDimension];
numPieces = 1;
for (j = 0; j < VImageDimension; ++j)
{
offsetTable[j] = numPieces;
......
......@@ -86,12 +86,9 @@ public:
/** Return the output image direction */
OutputImageDirectionType * GetOutputDirection();
void GenerateInputRequestedRegion() override;
protected:
ImageToModulusAndDirectionImageFilter();
~ImageToModulusAndDirectionImageFilter() override {}
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
~ImageToModulusAndDirectionImageFilter() override = default;
private:
ImageToModulusAndDirectionImageFilter(const Self &) = delete;
......
......@@ -34,9 +34,6 @@ template <class TInputImage, class TOutputImage, class TOutputImageDirection>
ImageToModulusAndDirectionImageFilter<TInputImage, TOutputImage, TOutputImageDirection>::
ImageToModulusAndDirectionImageFilter()
{
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredInputs(1);
this->SetNumberOfRequiredOutputs(2);
this->SetNumberOfRequiredOutputs(2);
this->SetNthOutput(0, OutputImageType::New());
......@@ -52,7 +49,7 @@ GetOutput() const
{
if (this->GetNumberOfOutputs() < 1)
{
return 0;
return nullptr;
}
return static_cast<const OutputImageType *>
(this->itk::ProcessObject::GetOutput(0));
......@@ -101,29 +98,6 @@ GetOutputDirection()
(this->itk::ProcessObject::GetOutput(1));
}
/**
* Standard "GenerateInputRequestedRegion" method
*/
template <class TInputImage, class TOutputImage, class TOutputImageDirection>
void
ImageToModulusAndDirectionImageFilter<TInputImage, TOutputImage, TOutputImageDirection>
::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
}
/**
* Standard "PrintSelf" method
*/
template <class TInputImage, class TOutputImage, class TOutputImageDirection>
void
ImageToModulusAndDirectionImageFilter<TInputImage, TOutputImage, TOutputImageDirection>::
PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
}
} // end namespace otb
#endif
......@@ -91,8 +91,8 @@ public:
typedef typename itk::NumericTraits< OutputPixelType >::ValueType OutputPixelValueType;
protected:
ImaginaryImageToComplexImageFilter() {}
~ImaginaryImageToComplexImageFilter() override {}
ImaginaryImageToComplexImageFilter() = default;
~ImaginaryImageToComplexImageFilter() override = default;
private:
ImaginaryImageToComplexImageFilter(const Self&) = delete;
......
......@@ -78,7 +78,7 @@ public:
typedef typename OutputImageType::PixelType TPixel;
/** Get the pointer from which the image data is imported. */
TPixel *GetImportPointer();
const TPixel *GetImportPointer() const;
/** Set the pointer from which the image data is imported. "num" is
* the number of pixels in the block of memory. If
......
......@@ -33,20 +33,17 @@ namespace otb
*/
template <class TOutputImage>
ImportImageFilter<TOutputImage>
::ImportImageFilter()
::ImportImageFilter() :
m_ImportPointer(nullptr),
m_FilterManageMemory(false),
m_Size(0)
{
unsigned int idx;
for (idx = 0; idx < TOutputImage::ImageDimension; ++idx)
for (unsigned int idx = 0; idx < TOutputImage::ImageDimension; ++idx)
{
m_Spacing[idx] = 1.0;
m_Origin[idx] = 0.0;
}
m_Direction.SetIdentity();
m_ImportPointer = nullptr;
m_FilterManageMemory = false;
m_Size = 0;
}
/**
......@@ -127,9 +124,9 @@ ImportImageFilter<TOutputImage>
*
*/
template <class TOutputImage>
typename ImportImageFilter<TOutputImage>::TPixel*
const typename ImportImageFilter<TOutputImage>::TPixel*
ImportImageFilter<TOutputImage>
::GetImportPointer()
::GetImportPointer() const
{
return m_ImportPointer;
}
......@@ -143,7 +140,8 @@ ImportImageFilter<TOutputImage>
::EnlargeOutputRequestedRegion(itk::DataObject *output)
{
// call the superclass' implementation of this method
Superclass::EnlargeOutputRequestedRegion(output);
// Superclass::EnlargeOutputRequestedRegion(output);
// Does nothing
// get pointer to the output
OutputImagePointer outputPtr = this->GetOutput();
......@@ -162,7 +160,8 @@ ImportImageFilter<TOutputImage>
::GenerateOutputInformation()
{
// call the superclass' implementation of this method
Superclass::GenerateOutputInformation();
// Superclass::GenerateOutputInformation();
// Does nothing as this->GetPrimaryInput() = nullptr
// get pointer to the output
OutputImagePointer outputPtr = this->GetOutput();
......
......@@ -79,7 +79,7 @@ public:
typedef typename TOutputPixel::ValueType TPixel;
/** Get the pointer from which the image data is imported. */
TPixel *GetImportPointer();
const TPixel *GetImportPointer() const;
/** Set the pointer from which the image data is imported. "num" is
* the number of pixels in the block of memory. If
......
......@@ -33,20 +33,17 @@ namespace otb
*/
template <class TOutputImage>
ImportVectorImageFilter<TOutputImage>
::ImportVectorImageFilter()
::ImportVectorImageFilter() :
m_ImportPointer(nullptr),
m_FilterManageMemory(false),
m_Size(0)
{
unsigned int idx;
for (idx = 0; idx < TOutputImage::ImageDimension; ++idx)
for (unsigned int idx = 0; idx < TOutputImage::ImageDimension; ++idx)
{
m_Spacing[idx] = 1.0;
m_Origin[idx] = 0.0;
}
m_Direction.SetIdentity();
m_ImportPointer = 0;
m_FilterManageMemory = false;
m_Size = 0;
}
/**
......@@ -128,9 +125,9 @@ ImportVectorImageFilter<TOutputImage>
*
*/
template <class TOutputImage>
typename ImportVectorImageFilter<TOutputImage>::TPixel*
const typename ImportVectorImageFilter<TOutputImage>::TPixel*
ImportVectorImageFilter<TOutputImage>
::GetImportPointer()
::GetImportPointer() const
{
return m_ImportPointer;
}
......@@ -144,7 +141,8 @@ ImportVectorImageFilter<TOutputImage>
::EnlargeOutputRequestedRegion(itk::DataObject *output)
{
// call the superclass' implementation of this method
Superclass::EnlargeOutputRequestedRegion(output);
// Superclass::EnlargeOutputRequestedRegion(output);
// Does nothing
// get pointer to the output
OutputImagePointer outputPtr = this->GetOutput();
......@@ -163,7 +161,8 @@ ImportVectorImageFilter<TOutputImage>
::GenerateOutputInformation()
{
// call the superclass' implementation of this method
Superclass::GenerateOutputInformation();
// Superclass::GenerateOutputInformation();
// Does nothing as this->GetPrimaryInput() = nullptr
// get pointer to the output
OutputImagePointer outputPtr = this->GetOutput();
......
......@@ -65,14 +65,14 @@ public:
void LogSetupInformation();
/** Return true if the LogSetupInformation has already been called*/
bool IsLogSetupInformationDone();
bool IsLogSetupInformationDone() const;
/** Set the flag m_LogSetupInfoDone to true */
void LogSetupInformationDone();
protected:
Logger();
virtual ~Logger() override;
virtual ~Logger() override = default;
private:
Logger(const Self &) = delete;
......
......@@ -65,12 +65,8 @@ public:
OutputPixelType Convert (InputPixelType input);
protected:
RGBAPixelConverter(){}
~RGBAPixelConverter() override{}
void PrintSelf(std::ostream& os, itk::Indent indent) const override
{
Superclass::PrintSelf(os, indent);
}
RGBAPixelConverter() = default;
~RGBAPixelConverter() override = default;
private:
RGBAPixelConverter(const Self&) = delete;
......@@ -102,12 +98,8 @@ public:
OutputPixelType Convert (InputPixelType input);
protected:
RGBAPixelConverter(){}
~RGBAPixelConverter() override{}
void PrintSelf(std::ostream& os, itk::Indent indent) const override
{
Superclass::PrintSelf(os, indent);
}
RGBAPixelConverter() = default;
~RGBAPixelConverter() override = default;
private:
RGBAPixelConverter(const Self&) = delete;
......@@ -139,12 +131,8 @@ public:
OutputPixelType Convert (InputPixelType input);
protected:
RGBAPixelConverter(){}
~RGBAPixelConverter() override{}
void PrintSelf(std::ostream& os, itk::Indent indent) const override
{
Superclass::PrintSelf(os, indent);
}
RGBAPixelConverter() = default;
~RGBAPixelConverter() override = default;
private:
RGBAPixelConverter(const Self&) = delete;
......
......@@ -100,7 +100,7 @@ protected:
};
/** Destructor */
~Rectangle() override {}
~Rectangle() override = default;
/**PrintSelf method */
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
......
......@@ -192,7 +192,7 @@ ExtendedFilenameHelper::GenericBandRange
void
ExtendedFilenameHelper::GenericBandRange
::Print(std::ostream& os)
::Print(std::ostream& os) const
{
if (this->first)
{
......
......@@ -62,10 +62,6 @@ Logger::Logger()
m_LogSetupInfoDone = false;
}
Logger::~Logger()
{
}
void Logger::LogSetupInformation()
{
if (! IsLogSetupInformationDone())
......@@ -123,7 +119,7 @@ std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, st
return s.str();
}
bool Logger::IsLogSetupInformationDone()
bool Logger::IsLogSetupInformationDone() const
{
return m_LogSetupInfoDone;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment