Skip to content

Commit

Permalink
Merge pull request InsightSoftwareConsortium#4872 from N-Dekker/Remov…
Browse files Browse the repository at this point in the history
…e-const-from-string-return-type

STYLE: Remove `const` from `const std::string` return types
  • Loading branch information
thewtex authored Oct 9, 2024
2 parents 50cc93a + 8a1498c commit 8e67720
Show file tree
Hide file tree
Showing 52 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/SpatialObjects/include/itkSpatialObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ITK_TEMPLATE_EXPORT SpatialObject : public DataObject
itkSetMacro(TypeName, std::string);

/** Get the typename of the SpatialObject */
virtual const std::string
virtual std::string
GetTypeName() const
{
return m_TypeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ template <>
class NumericTraits<std::string>
{
public:
static const std::string
static std::string
ZeroValue()
{
return std::string("");
Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/TransformBase/include/itkTransformIOBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ITKIOTransformBase_TEMPLATE_EXPORT TransformIOBaseTemplate : public LightP

/* The following struct returns the string name of computation type */
/* default implementation */
static inline const std::string
static inline std::string
GetTypeNameString()
{
itkGenericExceptionMacro("Unknown ScalarType" << typeid(ScalarType).name());
Expand Down Expand Up @@ -203,14 +203,14 @@ TransformIOBaseTemplate<double>::CorrectTransformPrecisionType(std::string & inp
}

template <>
inline const std::string
inline std::string
TransformIOBaseTemplate<float>::GetTypeNameString()
{
return std::string("float");
}

template <>
inline const std::string
inline std::string
TransformIOBaseTemplate<double>::GetTypeNameString()
{
return std::string("double");
Expand Down
4 changes: 2 additions & 2 deletions Modules/IO/TransformHDF5/include/itkHDF5TransformIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ class ITK_TEMPLATE_EXPORT HDF5TransformIOTemplate
GetH5TypeFromString() const;
};

const std::string ITKIOTransformHDF5_EXPORT
GetTransformName(int);
std::string ITKIOTransformHDF5_EXPORT
GetTransformName(int);

/** This helps to meet backward compatibility */
using HDF5TransformIO = HDF5TransformIOTemplate<double>;
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/TransformHDF5/src/itkHDF5TransformIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ const std::string HDF5CommonPathNames::OSVersion("/OSVersion");
// Since (for now) transforms are ordered in a file, but
// not named, I name them by their order in the file,
// beginning with zero.
const std::string
std::string
GetTransformName(int i)
{
std::stringstream s;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/include/itkAmoebaOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ITKOptimizers_EXPORT AmoebaOptimizer : public SingleValuedNonLinearVnlOpti
itkGetConstMacro(FunctionConvergenceTolerance, double);

/** Report the reason for stopping. */
const std::string
std::string
GetStopConditionDescription() const override;

/** Return Current Value */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ITKOptimizers_EXPORT CumulativeGaussianOptimizer : public MultipleValuedNo
PrintArray(MeasureType * array);

/** Report the reason for stopping. */
const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class ITKOptimizers_EXPORT ExhaustiveOptimizer : public SingleValuedNonLinearOpt
itkGetConstReferenceMacro(MaximumNumberOfIterations, SizeValueType);

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class ITKOptimizers_EXPORT GradientDescentOptimizer : public SingleValuedNonLine

/** Get Stop condition. */
itkGetConstReferenceMacro(StopCondition, StopConditionGradientDescentOptimizerEnum);
const std::string
std::string
GetStopConditionDescription() const override;

/** Get Gradient condition. */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/include/itkLBFGSBOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class ITKOptimizers_EXPORT LBFGSBOptimizer : public SingleValuedNonLinearVnlOpti
itkGetConstReferenceMacro(InfinityNormOfProjectedGradient, double);

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

/** Returns false unconditionally because LBFGSBOptimizer does not support using scales. */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/include/itkLBFGSOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class ITKOptimizers_EXPORT LBFGSOptimizer : public SingleValuedNonLinearVnlOptim
GetValue() const;

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ITKOptimizers_EXPORT LevenbergMarquardtOptimizer : public MultipleValuedNo
MeasureType
GetValue() const;

const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class ITKOptimizers_EXPORT OnePlusOneEvolutionaryOptimizer : public SingleValued
itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
itkSetMacro(MetricWorstPossibleValue, double);

const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/include/itkOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ITKOptimizers_EXPORT Optimizer : public Object
{}

/** Get the reason for termination */
virtual const std::string
virtual std::string
GetStopConditionDescription() const;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class ITKOptimizers_EXPORT ParticleSwarmOptimizerBase : public SingleValuedNonLi
GetValue() const;

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

/** Print the swarm information to the given output stream. Each line
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/include/itkPowellOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ITKOptimizers_EXPORT PowellOptimizer : public SingleValuedNonLinearOptimiz
itkGetConstReferenceMacro(MetricWorstPossibleValue, double);
itkSetMacro(MetricWorstPossibleValue, double);

const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ITKOptimizers_EXPORT RegularStepGradientDescentBaseOptimizer : public Sing
itkGetConstReferenceMacro(Gradient, DerivativeType);

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/include/itkSPSAOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class ITKOptimizers_EXPORT SPSAOptimizer : public SingleValuedNonLinearOptimizer
itkGetConstMacro(Tolerance, double);

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkAmoebaOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AmoebaOptimizer::AmoebaOptimizer()
AmoebaOptimizer::~AmoebaOptimizer() = default;


const std::string
std::string
AmoebaOptimizer::GetStopConditionDescription() const
{
return this->m_StopConditionDescription.str();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ CumulativeGaussianOptimizer::VerticalBestShift(MeasureType * originalArray, Meas
return (c / size);
}

const std::string
std::string
CumulativeGaussianOptimizer::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkExhaustiveOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ ExhaustiveOptimizer::IncrementIndex(ParametersType & newPosition)
}
}

const std::string
std::string
ExhaustiveOptimizer::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GradientDescentOptimizer::GradientDescentOptimizer()
m_StopConditionDescription << this->GetNameOfClass() << ": ";
}

const std::string
std::string
GradientDescentOptimizer::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkLBFGSBOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ LBFGSBOptimizerHelper::report_iter()
}
}

const std::string
std::string
LBFGSBOptimizer::GetStopConditionDescription() const
{
std::ostringstream stopConditionDescription;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkLBFGSOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ LBFGSOptimizer::GetOptimizer()
return m_VnlOptimizer.get();
}

const std::string
std::string
LBFGSOptimizer::GetStopConditionDescription() const
{
m_StopConditionDescription.str("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ LevenbergMarquardtOptimizer::GetOptimizer() const
return m_VnlOptimizer.get();
}

const std::string
std::string
LevenbergMarquardtOptimizer::GetStopConditionDescription() const
{
std::ostringstream reason, outcome;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ OnePlusOneEvolutionaryOptimizer::StartOptimization()
*
*/

const std::string
std::string
OnePlusOneEvolutionaryOptimizer::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Optimizer::SetCurrentPosition(const ParametersType & param)
this->Modified();
}

const std::string
std::string
Optimizer::GetStopConditionDescription() const
{
std::ostringstream description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ParticleSwarmOptimizerBase::GetValue() const
}


const std::string
std::string
ParticleSwarmOptimizerBase::GetStopConditionDescription() const
{
return this->m_StopConditionDescription.str();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkPowellOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ PowellOptimizer::StartOptimization()
/**
*
*/
const std::string
std::string
PowellOptimizer::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ RegularStepGradientDescentBaseOptimizer::AdvanceOneStep()
this->InvokeEvent(IterationEvent());
}

const std::string
std::string
RegularStepGradientDescentBaseOptimizer::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Optimizers/src/itkSPSAOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ SPSAOptimizer::GuessParameters(SizeValueType numberOfGradientEstimates, double i
this->SetSa(initialStepSize * std::pow(m_A + 1.0, m_Alpha) / averageAbsoluteGradient.max_value());
}

const std::string
std::string
SPSAOptimizer::GetStopConditionDescription() const
{
std::ostringstream reason;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ITKOptimizersv4_EXPORT AmoebaOptimizerv4 : public SingleValuedNonLinearVnl
itkGetConstMacro(FunctionConvergenceTolerance, double);

/** Report the reason for stopping. */
const std::string
std::string
GetStopConditionDescription() const override;

/** Method for getting access to the internal optimizer. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ITK_TEMPLATE_EXPORT ExhaustiveOptimizerv4
itkGetConstReferenceMacro(CurrentIndex, ParametersType);

/** Get the reason for termination */
const std::string
std::string
GetStopConditionDescription() const override;

/** Set the position to initialize the optimization. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ ExhaustiveOptimizerv4<TInternalComputationValueType>::IncrementIndex(ParametersT
}

template <typename TInternalComputationValueType>
const std::string
std::string
ExhaustiveOptimizerv4<TInternalComputationValueType>::GetStopConditionDescription() const
{
return m_StopConditionDescription.str();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ITK_TEMPLATE_EXPORT GradientDescentOptimizerBasev4Template
StopOptimization();

/** Get the reason for termination */
const StopConditionReturnStringType
StopConditionReturnStringType
GetStopConditionDescription() const override;

/** Modify the gradient in place, to advance the optimization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ GradientDescentOptimizerBasev4Template<TInternalComputationValueType>::PrintSelf
template <typename TInternalComputationValueType>
auto
GradientDescentOptimizerBasev4Template<TInternalComputationValueType>::GetStopConditionDescription() const
-> const StopConditionReturnStringType
-> StopConditionReturnStringType
{
return this->m_StopConditionDescription.str();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class ITK_TEMPLATE_EXPORT LBFGS2Optimizerv4Template
void
ResumeOptimization() override;

virtual const StopConditionReturnStringType
virtual StopConditionReturnStringType
GetStopConditionDescription() const override;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ LBFGS2Optimizerv4Template<TInternalComputationValueType>::UpdateProgress(
}

template <typename TInternalComputationValueType>
const typename LBFGS2Optimizerv4Template<TInternalComputationValueType>::StopConditionReturnStringType
typename LBFGS2Optimizerv4Template<TInternalComputationValueType>::StopConditionReturnStringType
LBFGS2Optimizerv4Template<TInternalComputationValueType>::GetStopConditionDescription() const
{
switch (m_StatusCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ITK_TEMPLATE_EXPORT LBFGSOptimizerBasev4 : public SingleValuedNonLinearVnl
itkGetConstMacro(GradientConvergenceTolerance, double);

/** Get the reason for termination */
const StopConditionReturnStringType
StopConditionReturnStringType
GetStopConditionDescription() const override;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ITK_TEMPLATE_EXPORT MultiGradientOptimizerv4Template
ResumeOptimization() override;

/** Get the reason for termination */
const StopConditionReturnStringType
StopConditionReturnStringType
GetStopConditionDescription() const override;

/** Get the list of optimizers currently held. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ MultiGradientOptimizerv4Template<TInternalComputationValueType>::GetMetricValues
template <typename TInternalComputationValueType>
auto
MultiGradientOptimizerv4Template<TInternalComputationValueType>::GetStopConditionDescription() const
-> const StopConditionReturnStringType
-> StopConditionReturnStringType
{
return this->m_StopConditionDescription.str();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ITK_TEMPLATE_EXPORT MultiStartOptimizerv4Template
ResumeOptimization();

/** Get the reason for termination */
const StopConditionReturnStringType
StopConditionReturnStringType
GetStopConditionDescription() const override;

/** Get the list of parameters over which to search. */
Expand Down
Loading

0 comments on commit 8e67720

Please sign in to comment.