Commit 29522e41 authored by Manuel Grizonnet's avatar Manuel Grizonnet

ENH: Explicitly recognize virtual functions in applications

        clang-tidy tool can insert missing override keyword as a macro so that missing [optional] virtual identifiers can be easily added.

        build otb with clang 3.8 and use cmake option CMAKE_EXPORT_COMPILE_COMMANDS=ON. Most modules and third parties have been activated.

        #Run clang modernize check using utility script which allow to process the code in parallel (only on Applications directory)
        python run-clang-tidy.py -clang-tidy-binary ~/software/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-tidy -checks=-*,modernize-use-override -header-filter=/home/grizonnetm/projets/otb/src/OTB/Modules/Modules/Applications/.*/include/.* -j8 -fix -p ~/projets/otb/bin/release/OTB-clang3.8/ ~/projets/otb/src/OTB/Modules/Applications/*/app/*.cxx  > ~/temporary/run-clang-tidy-app-log.txt

        #Replace override by ITK macro (to maintain compat with c++98) in Modules/Applications
        find . -type f -print -name "*.cxx" |xargs perl -pi -e 's/\ override/\ ITK_OVERRIDE/g'
parent 3de2b346
......@@ -40,7 +40,7 @@ public:
itkTypeMacro(MultivariateAlterationDetector, otb::Wrapper::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("MultivariateAlterationDetector");
SetDescription("Multivariate Alteration Detector");
......@@ -104,11 +104,11 @@ private:
SetDocExampleParameterValue("out", "detectedChangeImage.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
typedef otb::MultivariateAlterationDetectorImageFilter<
FloatVectorImageType,
......
......@@ -53,7 +53,7 @@ public:
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("ClassificationMapRegularization");
SetDescription("Filters the input labeled image using Majority Voting in a ball shaped neighbordhood.");
......@@ -111,12 +111,12 @@ private:
SetDocExampleParameterValue("ip.undecidedlabel", "7");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// Majority Voting
m_NeighMajVotingFilter = NeighborhoodMajorityVotingFilterType::New();
......
......@@ -71,7 +71,7 @@ public:
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("ComputeConfusionMatrix");
SetDescription("Computes the confusion matrix of a classification");
......@@ -132,7 +132,7 @@ private:
SetDocExampleParameterValue("nodatalabel","255");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
......@@ -209,7 +209,7 @@ private:
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
Int32ImageType* input = this->GetParameterInt32Image("in");
......
......@@ -42,7 +42,7 @@ public:
itkTypeMacro(ComputeImagesStatistics, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("ComputeImagesStatistics");
SetDescription("Computes global mean and standard deviation for each band from a set of images and optionally saves the results in an XML file.");
......@@ -71,12 +71,12 @@ private:
SetDocExampleParameterValue("out", "EstimateImageStatisticsQB1.xml");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
//Statistics estimator
typedef otb::StreamingStatisticsVectorImageFilter<FloatVectorImageType> StreamingStatisticsVImageFilterType;
......
......@@ -42,7 +42,7 @@ public:
;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("ComputeOGRLayersFeaturesStatistics");
SetDescription("Compute statistics of the features in a set of OGR Layers");
......@@ -70,7 +70,7 @@ private:
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
if ( HasValue("inshp") )
{
......@@ -101,7 +101,7 @@ private:
}
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
clock_t tic = clock();
......
......@@ -73,7 +73,7 @@ public:
;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("ComputePolylineFeatureFromImage");
SetDescription("This application compute for each studied polyline, contained in the input VectorData, the chosen descriptors.");
......@@ -111,12 +111,12 @@ private:
SetDocExampleParameterValue("out", "PolylineFeatureFromImage_LI_NONDVI_gt.shp");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// Vector Data into Image projection
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
......
......@@ -48,12 +48,12 @@ typedef itk::AmoebaOptimizer OptimizerType;
typedef const OptimizerType * OptimizerPointer;
void Execute(itk::Object *caller, const itk::EventObject & event)
void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE
{
Execute( (const itk::Object *)caller, event);
}
void Execute(const itk::Object * object, const itk::EventObject & event)
void Execute(const itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE
{
OptimizerPointer optimizer =
dynamic_cast< OptimizerPointer >( object );
......@@ -112,7 +112,7 @@ public:
itkTypeMacro(DSFuzzyModelEstimation, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("DSFuzzyModelEstimation");
SetDescription("Estimate feature fuzzy model parameters using 2 vector data (ground truth samples and wrong samples).");
......@@ -179,7 +179,7 @@ private:
SetDocExampleParameterValue("out", "DSFuzzyModelEstimation.xml");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
......@@ -189,7 +189,7 @@ private:
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
//Instantiate
......
......@@ -90,7 +90,7 @@ public:
itkTypeMacro(FusionOfClassifications, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("FusionOfClassifications");
SetDescription("Fuses several classifications maps of the same image on the basis of class labels.");
......@@ -168,7 +168,7 @@ private:
SetDocExampleParameterValue("out","classification_fused.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
......@@ -280,7 +280,7 @@ private:
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// Clear any previous filter
m_Filters.clear();
......
......@@ -62,7 +62,7 @@ public:
typedef ClassificationFilterType::ConfidenceImageType ConfidenceImageType;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("ImageClassifier");
SetDescription("Performs a classification of the input image according to a model file.");
......@@ -119,12 +119,12 @@ private:
SetDocExampleParameterValue("out", "clLabeledImageQB1.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// Load input image
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
......
......@@ -164,7 +164,7 @@ public:
itkTypeMacro(KMeansClassification, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("KMeansClassification");
SetDescription("Unsupervised KMeans image classification");
......@@ -218,7 +218,7 @@ private:
SetDocExampleParameterValue("out", "ClassificationFilterOutput.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// test of input image //
if (HasValue("in"))
......@@ -251,7 +251,7 @@ private:
}
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
GetLogger()->Debug("Entering DoExecute\n");
......
......@@ -51,7 +51,7 @@ public:
;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("OGRLayerClassifier");
SetDescription("Classify an OGR layer based on a machine learning model and a list of features to consider.");
......@@ -89,7 +89,7 @@ private:
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
if ( HasValue("inshp") )
{
......@@ -120,7 +120,7 @@ private:
}
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
#ifdef OTB_USE_LIBSVM
......
......@@ -51,7 +51,7 @@ private:
}
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("PolygonClassStatistics");
SetDescription("Computes statistics on a training polygon set.");
......@@ -108,12 +108,12 @@ private:
SetDocExampleParameterValue("out","polygonStat.xml");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
otb::ogr::DataSource::Pointer vectors =
otb::ogr::DataSource::New(this->GetParameterString("vec"));
......
......@@ -103,7 +103,7 @@ public:
typedef otb::MachineLearningModelFactory<ValueType, LabelType> MachineLearningModelFactoryType;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("PredictRegression");
SetDescription("Performs a prediction of the input image according to a regression model file.");
......@@ -170,12 +170,12 @@ private:
SetDocExampleParameterValue("out", "clLabeledImageQB1.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// Load input image
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
......
......@@ -73,7 +73,7 @@ private:
m_Classifier = ClassificationFilterType::New();
}
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("SOMClassification");
SetDescription("SOM image classification.");
......@@ -173,12 +173,12 @@ private:
SetDocExampleParameterValue("iv", "0");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// initiating random number generation
itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer
......
......@@ -102,7 +102,7 @@ protected:
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("TrainImagesClassifier");
SetDescription(
......@@ -199,7 +199,7 @@ void DoInit()
SetDocExampleParameterValue("io.confmatout", "svmConfusionMatrixQB1.csv");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
......@@ -275,7 +275,7 @@ void LogConfusionMatrix(ConfusionMatrixCalculatorType* confMatCalc)
otbAppLogINFO("Confusion matrix (rows = reference labels, columns = produced labels):\n" << os.str());
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
//Create training and validation for list samples and label list samples
ConcatenateLabelListSampleFilterType::Pointer concatenateTrainingLabels =
......
......@@ -51,7 +51,7 @@ public:
;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("TrainOGRLayersClassifier");
SetDescription("Train a SVM classifier based on labeled geometries and a list of features to consider.");
......@@ -88,7 +88,7 @@ private:
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
if ( HasValue("inshp") )
{
......@@ -119,7 +119,7 @@ private:
}
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
#ifdef OTB_USE_LIBSVM
clock_t tic = clock();
......
......@@ -95,7 +95,7 @@ protected:
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("TrainRegression");
SetDescription(
......@@ -172,7 +172,7 @@ void DoInit()
SetDocExampleParameterValue("classifier", "libsvm");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
if (HasValue("io.csv") && IsParameterEnabled("io.csv"))
{
......@@ -253,7 +253,7 @@ void ParseCSVPredictors(std::string path, ListSampleType* outputList)
ifs.close();
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
GetLogger()->Debug("Entering DoExecute\n");
//Create training and validation for list samples and label list samples
......
......@@ -55,7 +55,7 @@ public:
itkTypeMacro(VectorDataDSValidation, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("VectorDataDSValidation");
SetDescription("Vector data validation based on the fusion of features using Dempster-Shafer evidence theory framework.");
......@@ -102,7 +102,7 @@ private:
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
......@@ -112,7 +112,7 @@ private:
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
//Read the vector data
......
......@@ -77,7 +77,7 @@ public:
itkTypeMacro(HomologousPointsExtraction, otb::Wrapper::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("HomologousPointsExtraction");
SetDocName("Homologous points extraction");
......@@ -197,7 +197,7 @@ private:
SetDocExampleParameterValue("out","homologous.txt");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
}
......@@ -321,7 +321,7 @@ private:
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
OGRMultiLineString mls;
......
......@@ -86,7 +86,7 @@ public:
;
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("DimensionalityReduction");
SetDescription("Perform Dimension reduction of the input image.");
......@@ -175,7 +175,7 @@ private:
SetDocExampleParameterValue("method", "pca");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
if (HasValue("in"))
{
......@@ -223,7 +223,7 @@ private:
}
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
// Get Parameters
......
......@@ -58,7 +58,7 @@ itkTypeMacro(EdgeExtraction, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("EdgeExtraction");
SetDescription("Computes edge features on every pixel of the input image selected channel");
......@@ -121,12 +121,12 @@ SetDocExampleParameterValue("channel", "1");
SetDocExampleParameterValue("out", "Edges.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
inImage->UpdateOutputInformation();
......
......@@ -50,7 +50,7 @@ public:
itkTypeMacro(LineSegmentDetection, otb::Wrapper::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("LineSegmentDetection");
SetDescription("Detect line segments in raster");
......@@ -82,11 +82,11 @@ private:
SetDocExampleParameterValue("out", "LineSegmentDetection.shp");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
typedef otb::VectorImageToAmplitudeImageFilter<FloatVectorImageType, FloatImageType>
VectorImageToAmplitudeImageFilterType;
......
......@@ -51,7 +51,7 @@ public:
itkTypeMacro(Despeckle, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("Despeckle");
SetDescription("Perform speckle noise reduction on SAR image.");
......@@ -123,12 +123,12 @@ private:
SetDocExampleParameterValue("out", "despeckle.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
FloatVectorImageType* inVImage = GetParameterImage("in");
......
......@@ -52,7 +52,7 @@ public:
itkTypeMacro(Smoothing, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("Smoothing");
SetDescription("Apply a smoothing filter to an image");
......@@ -120,12 +120,12 @@ private:
SetDocExampleParameterValue("type.anidif.conductance", "1.5", exId);
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
GetLogger()->Debug("Entering DoExecute\n");
......
......@@ -50,7 +50,7 @@ public:
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("BundleToPerfectSensor");
SetDescription("Perform P+XS pansharpening");
......@@ -102,7 +102,7 @@ private:
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
if(!HasUserValue("mode") && HasValue("inp") && HasValue("inxs") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inp"),GetParameterImage("inxs")))
{
......@@ -111,7 +111,7 @@ private:
}
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
FloatVectorImageType* panchroV = GetParameterImage("inp");
FloatVectorImageType* xs = GetParameterImage("inxs");
......
......@@ -70,7 +70,7 @@ public:
private:
void DoInit()
void DoInit() ITK_OVERRIDE
{
SetName("Pansharpening");
SetDescription("Perform P+XS pansharpening");
......@@ -134,12 +134,12 @@ private:
}
void DoUpdateParameters()
void DoUpdateParameters() ITK_OVERRIDE
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
void DoExecute() ITK_OVERRIDE
{
FloatVectorImageType* panchroV = GetParameterImage("inp");
if ( panchroV->GetNumberOfComponentsPerPixel() != 1 )
......
......@@ -89,7 +89,7 @@ public:
itkTypeMacro(HyperspectralUnmixing, otb::Application);
private:
void DoInit()
void DoInit() ITK_OVERRIDE