From 270f8b699f6b5754bda1360f60b7025de345e547 Mon Sep 17 00:00:00 2001 From: Steven Hahn <hahnse@ornl.gov> Date: Sat, 16 Jan 2016 10:08:03 -0500 Subject: [PATCH] Changes suggested by clang-tidy: modernize-use-nullptr. --- Framework/API/src/Algorithm.cpp | 8 +- Framework/API/src/AlgorithmProxy.cpp | 2 +- Framework/API/src/ChopperModel.cpp | 2 +- Framework/API/src/CompositeFunction.cpp | 2 +- Framework/API/src/ConstraintFactory.cpp | 2 +- Framework/API/src/DeprecatedAlgorithm.cpp | 2 +- Framework/API/src/ExperimentInfo.cpp | 6 +- Framework/API/src/FrameworkManager.cpp | 2 +- Framework/API/src/FunctionDomain1D.cpp | 10 +-- Framework/API/src/FunctionDomainMD.cpp | 2 +- Framework/API/src/IFunction.cpp | 6 +- Framework/API/src/IFunctionMD.cpp | 2 +- ...ImplicitFunctionParameterParserFactory.cpp | 6 +- .../API/src/ImplicitFunctionParserFactory.cpp | 2 +- Framework/API/src/LogManager.cpp | 2 +- Framework/API/src/MDGeometry.cpp | 4 +- Framework/API/src/MatrixWorkspace.cpp | 12 +-- .../API/src/MatrixWorkspaceMDIterator.cpp | 2 +- Framework/API/src/ParamFunction.cpp | 4 +- Framework/API/src/Progress.cpp | 2 +- Framework/API/src/PropertyNexus.cpp | 4 +- Framework/API/src/Sample.cpp | 18 ++--- Framework/API/src/SpectrumDetectorMapping.cpp | 2 +- .../Algorithms/src/AbsorptionCorrection.cpp | 2 +- Framework/Algorithms/src/AddNote.cpp | 2 +- Framework/Algorithms/src/AddTimeSeriesLog.cpp | 2 +- Framework/Algorithms/src/AlignDetectors.cpp | 4 +- Framework/Algorithms/src/ApplyCalibration.cpp | 4 +- Framework/Algorithms/src/BinaryOperation.cpp | 2 +- Framework/Algorithms/src/ChangeBinOffset.cpp | 4 +- Framework/Algorithms/src/ChangeTimeZero.cpp | 2 +- .../Algorithms/src/CompareWorkspaces.cpp | 6 +- .../Algorithms/src/ConvertAxisByFormula.cpp | 2 +- Framework/Algorithms/src/ConvertUnits.cpp | 4 +- .../src/ConvertUnitsUsingDetectorTable.cpp | 2 +- .../Algorithms/src/CopyDetectorMapping.cpp | 4 +- .../src/CopyInstrumentParameters.cpp | 2 +- Framework/Algorithms/src/CopySample.cpp | 4 +- Framework/Algorithms/src/CorrectKiKf.cpp | 2 +- .../Algorithms/src/CreateSampleWorkspace.cpp | 4 +- Framework/Algorithms/src/CreateWorkspace.cpp | 4 +- .../Algorithms/src/DetectorDiagnostic.cpp | 6 +- .../Algorithms/src/DetectorEfficiencyCor.cpp | 2 +- .../src/DetectorEfficiencyVariation.cpp | 6 +- .../DiffractionEventCalibrateDetectors.cpp | 2 +- .../Algorithms/src/DiffractionFocussing2.cpp | 12 +-- .../Algorithms/src/ExportTimeSeriesLog.cpp | 2 +- Framework/Algorithms/src/ExtractSpectra.cpp | 14 ++-- Framework/Algorithms/src/FilterByLogValue.cpp | 2 +- .../src/FindDetectorsOutsideLimits.cpp | 6 +- Framework/Algorithms/src/FindPeaks.cpp | 2 +- .../Algorithms/src/GenerateEventsFilter.cpp | 2 +- Framework/Algorithms/src/GetAllEi.cpp | 4 +- .../src/GetDetOffsetsMultiPeaks.cpp | 2 +- .../src/GetTimeSeriesLogInformation.cpp | 2 +- .../Algorithms/src/He3TubeEfficiency.cpp | 6 +- .../Algorithms/src/InterpolatingRebin.cpp | 6 +- Framework/Algorithms/src/MaskBins.cpp | 2 +- .../Algorithms/src/MedianDetectorTest.cpp | 14 ++-- Framework/Algorithms/src/MergeRuns.cpp | 2 +- Framework/Algorithms/src/ModeratorTzero.cpp | 2 +- .../Algorithms/src/ModeratorTzeroLinear.cpp | 2 +- .../Algorithms/src/MonteCarloAbsorption.cpp | 4 +- .../MultipleScatteringCylinderAbsorption.cpp | 10 +-- .../Algorithms/src/NormaliseByDetector.cpp | 2 +- .../Algorithms/src/PerformIndexOperations.cpp | 6 +- Framework/Algorithms/src/Q1D2.cpp | 4 +- Framework/Algorithms/src/Rebin.cpp | 2 +- .../src/ReflectometryReductionOne.cpp | 4 +- Framework/Algorithms/src/RemoveBackground.cpp | 6 +- Framework/Algorithms/src/RemoveBins.cpp | 2 +- Framework/Algorithms/src/RemoveLowResTOF.cpp | 4 +- Framework/Algorithms/src/ResampleX.cpp | 4 +- Framework/Algorithms/src/ResetNegatives.cpp | 2 +- Framework/Algorithms/src/ScaleX.cpp | 4 +- Framework/Algorithms/src/Segfault.cpp | 2 +- Framework/Algorithms/src/SmoothNeighbours.cpp | 4 +- .../src/SpecularReflectionAlgorithm.cpp | 4 +- .../Algorithms/src/SphericalAbsorption.cpp | 2 +- .../Algorithms/src/SumEventsByLogValue.cpp | 14 ++-- Framework/Algorithms/src/Transpose.cpp | 2 +- Framework/Algorithms/src/UnaryOperation.cpp | 2 +- Framework/Algorithms/src/UnwrapMonitor.cpp | 4 +- Framework/Algorithms/src/UnwrapSNS.cpp | 8 +- .../src/WeightedMeanOfWorkspace.cpp | 2 +- Framework/Algorithms/src/WorkspaceJoiners.cpp | 2 +- Framework/Crystal/src/AnvredCorrection.cpp | 6 +- Framework/Crystal/src/CentroidPeaks.cpp | 2 +- .../src/ConnectedComponentLabeling.cpp | 2 +- Framework/Crystal/src/FilterPeaks.cpp | 2 +- .../src/GoniometerAnglesFromPhiRotation.cpp | 2 +- .../Crystal/src/IntegratePeakTimeSlices.cpp | 4 +- Framework/Crystal/src/LoadHKL.cpp | 2 +- Framework/Crystal/src/LoadIsawPeaks.cpp | 42 +++++------ Framework/Crystal/src/LoadIsawUB.cpp | 4 +- .../src/OptimizeExtinctionParameters.cpp | 2 +- Framework/Crystal/src/PeakIntegration.cpp | 2 +- Framework/Crystal/src/SaveIsawUB.cpp | 2 +- Framework/Crystal/src/SetUB.cpp | 2 +- Framework/Crystal/src/SortPeaksWorkspace.cpp | 6 +- .../Algorithms/CalculateGammaBackground.cpp | 2 +- .../src/Algorithms/CalculateMSVesuvio.cpp | 8 +- .../src/Algorithms/ConvolveWorkspaces.cpp | 2 +- .../CurveFitting/src/Algorithms/Fit1D.cpp | 16 ++-- .../CurveFitting/src/Algorithms/LeBailFit.cpp | 2 +- Framework/CurveFitting/src/FitMW.cpp | 2 +- .../src/FuncMinimizers/DerivMinimizer.cpp | 16 ++-- .../LevenbergMarquardtMinimizer.cpp | 2 +- .../src/FuncMinimizers/SimplexMinimizer.cpp | 8 +- .../src/FunctionDomain1DSpectrumCreator.cpp | 2 +- .../src/Functions/BivariateNormal.cpp | 16 ++-- .../src/Functions/Convolution.cpp | 2 +- .../src/Functions/IkedaCarpenterPV.cpp | 2 +- .../CurveFitting/src/Functions/Voigt.cpp | 4 +- Framework/CurveFitting/src/GSLMatrix.cpp | 8 +- .../CurveFitting/src/IFittingAlgorithm.cpp | 2 +- .../src/FilterEventsByLogValuePreNexus.cpp | 4 +- .../DataHandling/src/FindDetectorsPar.cpp | 2 +- .../DataHandling/src/GroupDetectors2.cpp | 2 +- Framework/DataHandling/src/ISISRunLogs.cpp | 6 +- .../DataHandling/src/LoadANSTOHelper.cpp | 6 +- Framework/DataHandling/src/LoadAscii2.cpp | 2 +- Framework/DataHandling/src/LoadBBY.cpp | 2 +- .../src/LoadDetectorsGroupingFile.cpp | 4 +- Framework/DataHandling/src/LoadEventNexus.cpp | 20 ++--- .../DataHandling/src/LoadEventPreNexus.cpp | 4 +- .../DataHandling/src/LoadEventPreNexus2.cpp | 4 +- Framework/DataHandling/src/LoadGSS.cpp | 6 +- Framework/DataHandling/src/LoadHelper.cpp | 2 +- Framework/DataHandling/src/LoadILL.cpp | 2 +- Framework/DataHandling/src/LoadISISNexus2.cpp | 2 +- .../src/LoadInstrumentFromRaw.cpp | 2 +- Framework/DataHandling/src/LoadIsawDetCal.cpp | 2 +- Framework/DataHandling/src/LoadLog.cpp | 4 +- .../src/LoadLogsForSNSPulsedMagnet.cpp | 2 +- Framework/DataHandling/src/LoadMask.cpp | 6 +- Framework/DataHandling/src/LoadMcStas.cpp | 2 +- Framework/DataHandling/src/LoadMuonNexus2.cpp | 2 +- Framework/DataHandling/src/LoadNexusLogs.cpp | 2 +- .../DataHandling/src/LoadNexusMonitors2.cpp | 2 +- .../DataHandling/src/LoadNexusProcessed.cpp | 26 +++---- .../DataHandling/src/LoadRaw/isisraw.cpp | 74 +++++++++---------- .../DataHandling/src/LoadRaw/isisraw2.cpp | 2 +- Framework/DataHandling/src/LoadRawHelper.cpp | 4 +- .../src/LoadSampleDetailsFromRaw.cpp | 2 +- .../src/MoveInstrumentComponent.cpp | 4 +- .../DataHandling/src/ProcessDasNexusLog.cpp | 2 +- .../src/RotateInstrumentComponent.cpp | 4 +- Framework/DataHandling/src/SaveFocusedXYE.cpp | 4 +- Framework/DataHandling/src/SaveGSS.cpp | 10 +-- Framework/DataHandling/src/SaveISISNexus.cpp | 2 +- .../DataHandling/src/SaveNexusProcessed.cpp | 8 +- .../src/SaveToSNSHistogramNexus.cpp | 4 +- Framework/DataHandling/src/SetScalingPSD.cpp | 2 +- .../DataObjects/src/AffineMatrixParameter.cpp | 4 +- .../DataObjects/src/BoxControllerNeXusIO.cpp | 4 +- .../DataObjects/src/CoordTransformAffine.cpp | 6 +- Framework/DataObjects/src/EventList.cpp | 12 +-- Framework/DataObjects/src/EventWorkspace.cpp | 4 +- .../DataObjects/src/EventWorkspaceMRU.cpp | 4 +- Framework/DataObjects/src/MDBoxFlatTree.cpp | 4 +- Framework/DataObjects/src/MDEventFactory.cpp | 4 +- .../DataObjects/src/MDHistoWorkspace.cpp | 6 +- .../src/MDHistoWorkspaceIterator.cpp | 4 +- Framework/DataObjects/src/Peak.cpp | 6 +- .../src/PeakShapeEllipsoidFactory.cpp | 2 +- .../src/PeakShapeSphericalFactory.cpp | 2 +- .../src/ReflectometryTransform.cpp | 2 +- Framework/Geometry/src/ComponentParser.cpp | 8 +- Framework/Geometry/src/IObjComponent.cpp | 4 +- Framework/Geometry/src/Instrument.cpp | 20 ++--- .../Geometry/src/Instrument/CompAssembly.cpp | 6 +- .../Geometry/src/Instrument/Component.cpp | 12 +-- .../src/Instrument/ComponentHelper.cpp | 4 +- .../Instrument/InstrumentDefinitionParser.cpp | 22 +++--- .../Geometry/src/Instrument/ObjComponent.cpp | 8 +- .../Geometry/src/Instrument/ParameterMap.cpp | 2 +- .../src/Instrument/RectangularDetector.cpp | 10 +-- .../MDGeometry/CompositeImplicitFunction.cpp | 2 +- .../src/MDGeometry/IMDDimensionFactory.cpp | 14 ++-- .../src/MDGeometry/MDGeometryXMLBuilder.cpp | 18 ++--- .../src/MDGeometry/MDGeometryXMLParser.cpp | 12 +-- Framework/Geometry/src/Math/Acomp.cpp | 2 +- Framework/Geometry/src/Objects/Object.cpp | 34 ++++----- Framework/Geometry/src/Objects/RuleItems.cpp | 16 ++-- Framework/Geometry/src/Objects/Rules.cpp | 24 +++--- .../Geometry/src/Objects/ShapeFactory.cpp | 6 +- .../src/Rendering/BitmapGeometryHandler.cpp | 2 +- .../src/Rendering/CacheGeometryGenerator.cpp | 12 +-- .../src/Rendering/CacheGeometryHandler.cpp | 30 ++++---- .../src/Rendering/GeometryHandler.cpp | 6 +- .../src/Rendering/GluGeometryHandler.cpp | 10 +-- .../src/Rendering/OCGeometryGenerator.cpp | 18 ++--- .../src/Rendering/OCGeometryHandler.cpp | 28 +++---- .../src/Rendering/OCGeometryRenderer.cpp | 4 +- .../src/Rendering/vtkGeometryCacheReader.cpp | 20 ++--- .../Geometry/src/Surfaces/SurfaceFactory.cpp | 2 +- .../ICat/src/CatalogDownloadDataFiles.cpp | 2 +- Framework/ICat/src/CatalogPublish.cpp | 2 +- Framework/ICat/src/ICat3/ICat3Helper.cpp | 14 ++-- Framework/ICat/src/ICat4/ICat4Catalog.cpp | 10 +-- .../ISISLiveData/src/FakeISISEventDAE.cpp | 4 +- Framework/Kernel/src/ConfigService.cpp | 10 +-- Framework/Kernel/src/DataItem.cpp | 2 +- Framework/Kernel/src/DateAndTime.cpp | 4 +- Framework/Kernel/src/DateValidator.cpp | 2 +- Framework/Kernel/src/DiskBuffer.cpp | 6 +- Framework/Kernel/src/EnabledWhenProperty.cpp | 4 +- Framework/Kernel/src/FilterChannel.cpp | 4 +- .../Kernel/src/FilteredTimeSeriesProperty.cpp | 2 +- Framework/Kernel/src/InternetHelper.cpp | 20 ++--- Framework/Kernel/src/LibraryWrapper.cpp | 4 +- Framework/Kernel/src/LogFilter.cpp | 4 +- Framework/Kernel/src/LogParser.cpp | 6 +- .../src/Math/Optimization/SLSQPMinimizer.cpp | 2 +- Framework/Kernel/src/Matrix.cpp | 12 +-- Framework/Kernel/src/Memory.cpp | 2 +- Framework/Kernel/src/MersenneTwister.cpp | 6 +- Framework/Kernel/src/NetworkProxyOSX.cpp | 8 +- Framework/Kernel/src/NexusDescriptor.cpp | 2 +- Framework/Kernel/src/Property.cpp | 6 +- Framework/Kernel/src/PropertyManager.cpp | 4 +- Framework/Kernel/src/RemoteJobManager.cpp | 4 +- Framework/Kernel/src/SingletonHolder.cpp | 8 +- Framework/Kernel/src/SobolSequence.cpp | 4 +- Framework/Kernel/src/TimeSeriesProperty.cpp | 2 +- Framework/Kernel/src/Timer.cpp | 6 +- Framework/LiveData/src/ADARA/ADARAPackets.cpp | 36 ++++----- Framework/LiveData/src/ADARA/ADARAParser.cpp | 4 +- Framework/LiveData/src/FakeISISHistoDAE.cpp | 4 +- .../LiveData/src/FileEventDataListener.cpp | 8 +- .../LiveData/src/ISISHistoDataListener.cpp | 6 +- .../src/ISISLiveEventDataListener.cpp | 2 +- Framework/LiveData/src/LoadDAE/idc.cpp | 8 +- .../LiveData/src/LoadDAE/isisds_command.cpp | 30 ++++---- .../LiveData/src/SNSLiveEventDataListener.cpp | 4 +- .../src/TOPAZLiveEventDataListener.cpp | 2 +- Framework/MDAlgorithms/src/BinMD.cpp | 6 +- .../MDAlgorithms/src/ConvToMDEventsWS.cpp | 6 +- .../MDAlgorithms/src/ConvToMDHistoWS.cpp | 6 +- .../src/ConvertCWSDExpToMomentum.cpp | 2 +- .../src/ConvertToDiffractionMDWorkspace.cpp | 4 +- Framework/MDAlgorithms/src/DivideMD.cpp | 2 +- Framework/MDAlgorithms/src/FindPeaksMD.cpp | 2 +- Framework/MDAlgorithms/src/FitMD.cpp | 2 +- Framework/MDAlgorithms/src/IntegrateFlux.cpp | 2 +- .../src/IntegrateMDHistoWorkspace.cpp | 2 +- Framework/MDAlgorithms/src/LoadMD.cpp | 2 +- Framework/MDAlgorithms/src/LoadSQW.cpp | 2 +- .../MDAlgorithms/src/MDEventWSWrapper.cpp | 2 +- Framework/MDAlgorithms/src/MDNormDirectSC.cpp | 4 +- Framework/MDAlgorithms/src/MDNormSCD.cpp | 2 +- Framework/MDAlgorithms/src/MDTransfModQ.cpp | 8 +- Framework/MDAlgorithms/src/MDTransfNoQ.cpp | 2 +- Framework/MDAlgorithms/src/MDTransfQ3D.cpp | 8 +- Framework/MDAlgorithms/src/MergeMD.cpp | 2 +- Framework/MDAlgorithms/src/MergeMDFiles.cpp | 8 +- Framework/MDAlgorithms/src/MultiplyMD.cpp | 2 +- .../src/PreprocessDetectorsToMD.cpp | 4 +- .../Quantification/CachedExperimentInfo.cpp | 2 +- .../src/Quantification/ForegroundModel.cpp | 10 +-- .../MDResolutionConvolution.cpp | 4 +- .../Resolution/TobyFitResolutionModel.cpp | 6 +- .../Resolution/TobyFitYVector.cpp | 10 +-- .../ResolutionConvolvedCrossSection.cpp | 2 +- Framework/MDAlgorithms/src/ReplicateMD.cpp | 2 +- Framework/MDAlgorithms/src/SliceMD.cpp | 4 +- .../MDAlgorithms/src/SlicingAlgorithm.cpp | 10 +-- Framework/MDAlgorithms/src/SmoothMD.cpp | 2 +- Framework/MDAlgorithms/src/TransposeMD.cpp | 2 +- .../src/UnitsConversionHelper.cpp | 6 +- Framework/Nexus/src/MuonNexusReader.cpp | 2 +- Framework/Nexus/src/NexusClasses.cpp | 8 +- Framework/Nexus/src/NexusFileIO.cpp | 8 +- .../mantid/api/src/CloneMatrixWorkspace.cpp | 2 +- .../api/src/Exports/AlgorithmFactory.cpp | 2 +- .../api/src/Exports/FunctionFactory.cpp | 2 +- .../mantid/api/src/Exports/IAlgorithm.cpp | 4 +- .../api/src/Exports/IMDHistoWorkspace.cpp | 4 +- .../api/src/Exports/ITableWorkspace.cpp | 6 +- .../mantid/api/src/ExtractWorkspace.cpp | 2 +- .../api/src/FitFunctions/IFunctionAdapter.cpp | 2 +- .../src/PythonAlgorithm/AlgorithmAdapter.cpp | 4 +- .../kernel/src/Converters/NumpyFunctions.cpp | 2 +- .../kernel/src/Environment/ErrorHandling.cpp | 4 +- .../src/Registry/SequenceTypeHandler.cpp | 2 +- .../src/MantidWebServiceAPIHelper.cpp | 4 +- Framework/SINQ/src/InvertMDDim.cpp | 2 +- .../PoldiUtilities/PoldiDetectorFactory.cpp | 2 +- Framework/SINQ/src/SINQHMListener.cpp | 4 +- .../src/ComponentCreationHelper.cpp | 13 ++-- .../TestHelpers/src/MDEventsTestHelper.cpp | 52 ++++++------- Framework/TestHelpers/src/NexusTestHelper.cpp | 2 +- .../src/WorkspaceCreationHelper.cpp | 8 +- .../src/AlignAndFocusPowder.cpp | 2 +- .../src/SANSSolidAngleCorrection.cpp | 2 +- 296 files changed, 867 insertions(+), 880 deletions(-) diff --git a/Framework/API/src/Algorithm.cpp b/Framework/API/src/Algorithm.cpp index 01687e11653..ec415108ecc 100644 --- a/Framework/API/src/Algorithm.cpp +++ b/Framework/API/src/Algorithm.cpp @@ -86,8 +86,8 @@ size_t Algorithm::g_execCount = 0; /// Constructor Algorithm::Algorithm() : PropertyManagerOwner(), m_cancel(false), m_parallelException(false), - m_log("Algorithm"), g_log(m_log), m_groupSize(0), m_executeAsync(NULL), - m_notificationCenter(NULL), m_progressObserver(NULL), + m_log("Algorithm"), g_log(m_log), m_groupSize(0), m_executeAsync(nullptr), + m_notificationCenter(nullptr), m_progressObserver(nullptr), m_isInitialized(false), m_isExecuted(false), m_isChildAlgorithm(false), m_recordHistoryForChild(false), m_alwaysStoreInADS(false), m_runningAsync(false), m_running(false), m_rethrow(false), @@ -212,7 +212,7 @@ const std::vector<std::string> Algorithm::categories() const { const DeprecatedAlgorithm *depo = dynamic_cast<const DeprecatedAlgorithm *>(this); - if (depo != NULL) { + if (depo != nullptr) { res.push_back("Deprecated"); } return res; @@ -441,7 +441,7 @@ bool Algorithm::execute() { AlgorithmManager::Instance().notifyAlgorithmStarting(this->getAlgorithmID()); { DeprecatedAlgorithm *depo = dynamic_cast<DeprecatedAlgorithm *>(this); - if (depo != NULL) + if (depo != nullptr) getLogger().error(depo->deprecationMsg(this)); } // Start by freeing up any memory available. diff --git a/Framework/API/src/AlgorithmProxy.cpp b/Framework/API/src/AlgorithmProxy.cpp index 7ea45e33594..2c1df96eef7 100644 --- a/Framework/API/src/AlgorithmProxy.cpp +++ b/Framework/API/src/AlgorithmProxy.cpp @@ -317,7 +317,7 @@ const std::vector<std::string> AlgorithmProxy::categories() const { const DeprecatedAlgorithm *depo = dynamic_cast<const DeprecatedAlgorithm *>(this); - if (depo != NULL) { + if (depo != nullptr) { res.push_back("Deprecated"); } return res; diff --git a/Framework/API/src/ChopperModel.cpp b/Framework/API/src/ChopperModel.cpp index c6feabf88bb..d2347e791d5 100644 --- a/Framework/API/src/ChopperModel.cpp +++ b/Framework/API/src/ChopperModel.cpp @@ -18,7 +18,7 @@ const char *JITTER = "JitterSigma"; /// Default constructor required by the factory ChopperModel::ChopperModel() - : m_exptRun(NULL), m_angularSpeed(0.0), m_angularSpeedLog(), + : m_exptRun(nullptr), m_angularSpeed(0.0), m_angularSpeedLog(), m_jitterSigma(0.0), m_pulseVariance(0.0) {} /** diff --git a/Framework/API/src/CompositeFunction.cpp b/Framework/API/src/CompositeFunction.cpp index 9a9086bda83..4d2a10d762c 100644 --- a/Framework/API/src/CompositeFunction.cpp +++ b/Framework/API/src/CompositeFunction.cpp @@ -73,7 +73,7 @@ std::string CompositeFunction::asString() const { } for (size_t i = 0; i < nFunctions(); i++) { IFunction_sptr fun = getFunction(i); - bool isComp = boost::dynamic_pointer_cast<CompositeFunction>(fun) != 0; + bool isComp = boost::dynamic_pointer_cast<CompositeFunction>(fun) != nullptr; if (isComp) ostr << '('; ostr << fun->asString(); diff --git a/Framework/API/src/ConstraintFactory.cpp b/Framework/API/src/ConstraintFactory.cpp index 8500cc000b9..69184b86f97 100644 --- a/Framework/API/src/ConstraintFactory.cpp +++ b/Framework/API/src/ConstraintFactory.cpp @@ -43,7 +43,7 @@ IConstraint *ConstraintFactoryImpl::createInitialized(IFunction *fun, IConstraint *ConstraintFactoryImpl::createInitialized(IFunction *fun, const Expression &expr, bool isDefault) const { - IConstraint *c = 0; + IConstraint *c = nullptr; if (expr.name() == "==") { c = createUnwrapped("BoundaryConstraint"); } else { diff --git a/Framework/API/src/DeprecatedAlgorithm.cpp b/Framework/API/src/DeprecatedAlgorithm.cpp index 804e2e0ca5c..3d50a0712e7 100644 --- a/Framework/API/src/DeprecatedAlgorithm.cpp +++ b/Framework/API/src/DeprecatedAlgorithm.cpp @@ -52,7 +52,7 @@ void DeprecatedAlgorithm::deprecatedDate(const std::string &date) { /// This merely prints the deprecation error for people to see. const std::string DeprecatedAlgorithm::deprecationMsg(const IAlgorithm *algo) { std::stringstream msg; - if (algo != NULL) + if (algo != nullptr) msg << algo->name() << " is "; msg << "deprecated"; diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp index 90a35d1f73f..2c6d88ff0b8 100644 --- a/Framework/API/src/ExperimentInfo.cpp +++ b/Framework/API/src/ExperimentInfo.cpp @@ -1076,7 +1076,7 @@ void ExperimentInfo::setInstumentFromXML(const std::string &nxFilename, instr = InstrumentDataService::Instance().retrieve(instrumentNameMangled); } else { // Really create the instrument - instr = parser.parseXML(NULL); + instr = parser.parseXML(nullptr); // Add to data service for later retrieval InstrumentDataService::Instance().add(instrumentNameMangled, instr); } @@ -1148,7 +1148,7 @@ void ExperimentInfo::readParameterMap(const std::string ¶meterStr) { // if( comp_name == prev_name ) continue; this blocks reading in different // parameters of the same component. RNT // prev_name = comp_name; - const Geometry::IComponent *comp = NULL; + const Geometry::IComponent *comp = nullptr; if (comp_name.find("detID:") != std::string::npos) { int detID = atoi(comp_name.substr(6).c_str()); comp = instr->getDetector(detID).get(); @@ -1194,7 +1194,7 @@ void ExperimentInfo::populateWithParameter( ParameterValue paramValue(paramInfo, runData); // Defines implicit conversion operator - const std::string *pDescription = NULL; + const std::string *pDescription = nullptr; if (!paramInfo.m_description.empty()) pDescription = ¶mInfo.m_description; diff --git a/Framework/API/src/FrameworkManager.cpp b/Framework/API/src/FrameworkManager.cpp index 21c71df5584..fbdb3fa4113 100644 --- a/Framework/API/src/FrameworkManager.cpp +++ b/Framework/API/src/FrameworkManager.cpp @@ -175,7 +175,7 @@ void FrameworkManagerImpl::setGlobalLocaleToAscii() { /// Silence NeXus output void FrameworkManagerImpl::disableNexusOutput() { - NXMSetError(NULL, NexusErrorFunction); + NXMSetError(nullptr, NexusErrorFunction); } /** diff --git a/Framework/API/src/FunctionDomain1D.cpp b/Framework/API/src/FunctionDomain1D.cpp index bf466655d6a..24a79f08b4b 100644 --- a/Framework/API/src/FunctionDomain1D.cpp +++ b/Framework/API/src/FunctionDomain1D.cpp @@ -21,7 +21,7 @@ std::vector<double> FunctionDomain1D::toVector() const { */ FunctionDomain1DVector::FunctionDomain1DVector( const std::vector<double> &xvalues) - : FunctionDomain1D(NULL, 0) { + : FunctionDomain1D(nullptr, 0) { if (xvalues.empty()) { throw std::invalid_argument("FunctionDomain1D cannot have zero size."); } @@ -37,7 +37,7 @@ FunctionDomain1DVector::FunctionDomain1DVector( FunctionDomain1DVector::FunctionDomain1DVector( std::vector<double>::const_iterator from, std::vector<double>::const_iterator to) - : FunctionDomain1D(NULL, 0) { + : FunctionDomain1D(nullptr, 0) { if (from == to) { throw std::invalid_argument("FunctionDomain1D cannot have zero size."); } @@ -56,7 +56,7 @@ FunctionDomain1DVector::FunctionDomain1DVector( FunctionDomain1DVector::FunctionDomain1DVector(const double startX, const double endX, const size_t n) - : FunctionDomain1D(NULL, 0) { + : FunctionDomain1D(nullptr, 0) { if (n == 0) { throw std::invalid_argument("FunctionDomain1D cannot have zero size."); } @@ -77,7 +77,7 @@ FunctionDomain1DVector::FunctionDomain1DVector(const double startX, * @param x :: The argument value. */ FunctionDomain1DVector::FunctionDomain1DVector(const double x) - : FunctionDomain1D(NULL, 0) { + : FunctionDomain1D(nullptr, 0) { m_X.resize(1); m_X[0] = x; resetData(&m_X[0], m_X.size()); @@ -89,7 +89,7 @@ FunctionDomain1DVector::FunctionDomain1DVector(const double x) */ FunctionDomain1DVector::FunctionDomain1DVector( const FunctionDomain1DVector &right) - : FunctionDomain1D(NULL, 0) { + : FunctionDomain1D(nullptr, 0) { *this = right; } diff --git a/Framework/API/src/FunctionDomainMD.cpp b/Framework/API/src/FunctionDomainMD.cpp index 736ae431169..55f26e7bcc0 100644 --- a/Framework/API/src/FunctionDomainMD.cpp +++ b/Framework/API/src/FunctionDomainMD.cpp @@ -58,7 +58,7 @@ const IMDIterator *FunctionDomainMD::getNextIterator() const { ++m_currentIndex; if (!m_iterator->next() || m_currentIndex >= m_size) { m_currentIndex = m_size; - return NULL; + return nullptr; } return m_iterator; } diff --git a/Framework/API/src/IFunction.cpp b/Framework/API/src/IFunction.cpp index e4ae61a0176..040dd4e8a19 100644 --- a/Framework/API/src/IFunction.cpp +++ b/Framework/API/src/IFunction.cpp @@ -46,7 +46,7 @@ IFunction::~IFunction() { m_attrs.clear(); if (m_handler) { delete m_handler; - m_handler = NULL; + m_handler = nullptr; } } @@ -737,7 +737,7 @@ void IFunction::setMatrixWorkspace( // update value IFunctionWithLocation *testWithLocation = dynamic_cast<IFunctionWithLocation *>(this); - if (testWithLocation == NULL || + if (testWithLocation == nullptr || (fitParam.getLookUpTable().containData() == false && fitParam.getFormula().compare("") == 0)) { setParameter(i, fitParam.getValue()); @@ -930,7 +930,7 @@ void IFunction::convertValue(std::vector<double> &values, // Get l1, l2 and theta (see also RemoveBins.calculateDetectorPosition()) Instrument_const_sptr instrument = ws->getInstrument(); Geometry::IComponent_const_sptr sample = instrument->getSample(); - if (sample == NULL) { + if (sample == nullptr) { g_log.error() << "No sample defined instrument. Cannot convert units for function\n" << "Ignore convertion."; diff --git a/Framework/API/src/IFunctionMD.cpp b/Framework/API/src/IFunctionMD.cpp index 6eaacaedfe1..3e39f22c226 100644 --- a/Framework/API/src/IFunctionMD.cpp +++ b/Framework/API/src/IFunctionMD.cpp @@ -90,7 +90,7 @@ void IFunctionMD::evaluateFunction(const FunctionDomainMD &domain, FunctionValues &values) const { domain.reset(); size_t i = 0; - for (const IMDIterator *r = domain.getNextIterator(); r != NULL; + for (const IMDIterator *r = domain.getNextIterator(); r != nullptr; r = domain.getNextIterator()) { this->reportProgress("Evaluating function for box " + boost::lexical_cast<std::string>(i + 1)); diff --git a/Framework/API/src/ImplicitFunctionParameterParserFactory.cpp b/Framework/API/src/ImplicitFunctionParameterParserFactory.cpp index 532499f57ee..ff7dc950f7b 100644 --- a/Framework/API/src/ImplicitFunctionParameterParserFactory.cpp +++ b/Framework/API/src/ImplicitFunctionParameterParserFactory.cpp @@ -27,8 +27,8 @@ ImplicitFunctionParameterParser *ImplicitFunctionParameterParserFactoryImpl:: } Poco::AutoPtr<Poco::XML::NodeList> parameters = parametersElement->getElementsByTagName("Parameter"); - ImplicitFunctionParameterParser *paramParser = NULL; - ImplicitFunctionParameterParser *nextParser = NULL; + ImplicitFunctionParameterParser *paramParser = nullptr; + ImplicitFunctionParameterParser *nextParser = nullptr; for (unsigned long i = 0; i < parameters->length(); i++) { Poco::XML::Element *parameter = dynamic_cast<Poco::XML::Element *>(parameters->item(i)); @@ -37,7 +37,7 @@ ImplicitFunctionParameterParser *ImplicitFunctionParameterParserFactoryImpl:: "Parser"; // Append parser to the name. Fixed convention ImplicitFunctionParameterParser *childParamParser = this->createUnwrapped(paramParserName); - if (paramParser != NULL) { + if (paramParser != nullptr) { nextParser->setSuccessorParser(childParamParser); } else { paramParser = childParamParser; diff --git a/Framework/API/src/ImplicitFunctionParserFactory.cpp b/Framework/API/src/ImplicitFunctionParserFactory.cpp index dda66ddd85c..e00c3724224 100644 --- a/Framework/API/src/ImplicitFunctionParserFactory.cpp +++ b/Framework/API/src/ImplicitFunctionParserFactory.cpp @@ -44,7 +44,7 @@ ImplicitFunctionParserFactoryImpl::createImplicitFunctionParserFromXML( Poco::AutoPtr<Poco::XML::NodeList> childFunctions = functionElement->getElementsByTagName("Function"); - ImplicitFunctionParser *childParser = NULL; + ImplicitFunctionParser *childParser = nullptr; for (unsigned long i = 0; i < childFunctions->length(); i++) { Poco::XML::Node *childFunctionNode = childFunctions->item(i); diff --git a/Framework/API/src/LogManager.cpp b/Framework/API/src/LogManager.cpp index 82055f4c7de..d716b6b8d28 100644 --- a/Framework/API/src/LogManager.cpp +++ b/Framework/API/src/LogManager.cpp @@ -158,7 +158,7 @@ void LogManager::splitByTime(TimeSplitterType &splitter, std::vector<LogManager *> outputs) const { // Make a vector of managers for the splitter. Fun! const size_t n = outputs.size(); - std::vector<PropertyManager *> output_managers(outputs.size(), NULL); + std::vector<PropertyManager *> output_managers(outputs.size(), nullptr); for (size_t i = 0; i < n; i++) { if (outputs[i]) { output_managers[i] = &(outputs[i]->m_manager); diff --git a/Framework/API/src/MDGeometry.cpp b/Framework/API/src/MDGeometry.cpp index 237af54c7e8..945cfde3c57 100644 --- a/Framework/API/src/MDGeometry.cpp +++ b/Framework/API/src/MDGeometry.cpp @@ -382,8 +382,8 @@ void MDGeometry::transformDimensions(std::vector<double> &scaling, } // Clear the original workspace setOriginalWorkspace(boost::shared_ptr<Workspace>()); - setTransformFromOriginal(NULL); - setTransformToOriginal(NULL); + setTransformFromOriginal(nullptr); + setTransformToOriginal(nullptr); } //--------------------------------------------------------------------------------------------------- diff --git a/Framework/API/src/MatrixWorkspace.cpp b/Framework/API/src/MatrixWorkspace.cpp index 4049ce72f7c..c307fde26f4 100644 --- a/Framework/API/src/MatrixWorkspace.cpp +++ b/Framework/API/src/MatrixWorkspace.cpp @@ -43,7 +43,7 @@ MatrixWorkspace::MatrixWorkspace( m_isCommonBinsFlagSet(false), m_isCommonBinsFlag(false), m_masks(), m_indexCalculator(), m_nearestNeighboursFactory( - (nnFactory == NULL) ? new NearestNeighboursFactory : nnFactory), + (nnFactory == nullptr) ? new NearestNeighboursFactory : nnFactory), m_nearestNeighbours() {} MatrixWorkspace::MatrixWorkspace(const MatrixWorkspace &other) @@ -797,7 +797,7 @@ double MatrixWorkspace::detectorSignedTwoTheta( Geometry::IComponent_const_sptr source = instrument->getSource(); Geometry::IComponent_const_sptr sample = instrument->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { throw Kernel::Exception::InstrumentDefinitionError( "Instrument not sufficiently defined: failed to get source and/or " "sample"); @@ -827,7 +827,7 @@ double MatrixWorkspace::detectorTwoTheta(Geometry::IDetector_const_sptr det) const { Geometry::IComponent_const_sptr source = getInstrument()->getSource(); Geometry::IComponent_const_sptr sample = getInstrument()->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { throw Kernel::Exception::InstrumentDefinitionError( "Instrument not sufficiently defined: failed to get source and/or " "sample"); @@ -1277,7 +1277,7 @@ class MWDimension : public Mantid::Geometry::IMDDimension { public: MWDimension(const Axis *axis, const std::string &dimensionId) : m_axis(*axis), m_dimensionId(dimensionId), - m_haveEdges(dynamic_cast<const BinEdgeAxis *>(&m_axis) != NULL), + m_haveEdges(dynamic_cast<const BinEdgeAxis *>(&m_axis) != nullptr), m_frame(new Geometry::GeneralFrame(m_axis.unit()->label(), m_axis.unit()->label())) {} @@ -1445,7 +1445,7 @@ MatrixWorkspace::getDimension(size_t index) const { boost::shared_ptr<const Mantid::Geometry::IMDDimension> MatrixWorkspace::getDimensionWithId(std::string id) const { int nAxes = this->axes(); - IMDDimension *dim = NULL; + IMDDimension *dim = nullptr; for (int i = 0; i < nAxes; i++) { Axis *xAxis = this->getAxis(i); const std::string &knownId = getDimensionIdFromAxis(i); @@ -1454,7 +1454,7 @@ MatrixWorkspace::getDimensionWithId(std::string id) const { break; } } - if (NULL == dim) { + if (nullptr == dim) { std::string message = "Cannot find id : " + id; throw std::overflow_error(message); } diff --git a/Framework/API/src/MatrixWorkspaceMDIterator.cpp b/Framework/API/src/MatrixWorkspaceMDIterator.cpp index bf818a20ec1..1ba8ded483a 100644 --- a/Framework/API/src/MatrixWorkspaceMDIterator.cpp +++ b/Framework/API/src/MatrixWorkspaceMDIterator.cpp @@ -264,7 +264,7 @@ signal_t MatrixWorkspaceMDIterator::getInnerError(size_t /*index*/) const { bool MatrixWorkspaceMDIterator::getIsMasked() const { Mantid::Geometry::IDetector_const_sptr det = m_ws->getDetector(m_workspaceIndex); - if (det != NULL) { + if (det != nullptr) { return det->isMasked(); } else { return true; // TODO. Check whether it's better to return true or false diff --git a/Framework/API/src/ParamFunction.cpp b/Framework/API/src/ParamFunction.cpp index 26ac60318a5..a98e32dbc5f 100644 --- a/Framework/API/src/ParamFunction.cpp +++ b/Framework/API/src/ParamFunction.cpp @@ -368,7 +368,7 @@ ParameterTie *ParamFunction::getTie(size_t i) const { if (it != m_ties.cend()) { return *it; } - return NULL; + return nullptr; } /** Remove all ties @@ -415,7 +415,7 @@ IConstraint *ParamFunction::getConstraint(size_t i) const { if (it != m_constraints.cend()) { return *it; } - return NULL; + return nullptr; } /** Remove a constraint diff --git a/Framework/API/src/Progress.cpp b/Framework/API/src/Progress.cpp index 41160c529c4..a995432ca22 100644 --- a/Framework/API/src/Progress.cpp +++ b/Framework/API/src/Progress.cpp @@ -10,7 +10,7 @@ namespace API { /** * Default constructor */ -Progress::Progress() : ProgressBase(0.0, 0.0, 0), m_alg(NULL) {} +Progress::Progress() : ProgressBase(0.0, 0.0, 0), m_alg(nullptr) {} /** Creates a Progress instance @param alg :: Algorithm reporting its progress diff --git a/Framework/API/src/PropertyNexus.cpp b/Framework/API/src/PropertyNexus.cpp index 02083b55ab5..5add80e6c06 100644 --- a/Framework/API/src/PropertyNexus.cpp +++ b/Framework/API/src/PropertyNexus.cpp @@ -151,7 +151,7 @@ Property *loadProperty(::NeXus::File *file, const std::string &group) { } file->openData("value"); - Property *retVal = NULL; + Property *retVal = nullptr; switch (file->getInfo().type) { case ::NeXus::FLOAT32: retVal = makeProperty<float>(file, group, times); @@ -181,7 +181,7 @@ Property *loadProperty(::NeXus::File *file, const std::string &group) { case ::NeXus::INT8: case ::NeXus::INT16: case ::NeXus::UINT16: - retVal = NULL; + retVal = nullptr; break; } diff --git a/Framework/API/src/Sample.cpp b/Framework/API/src/Sample.cpp index 6f0aba1134f..be462d6074e 100644 --- a/Framework/API/src/Sample.cpp +++ b/Framework/API/src/Sample.cpp @@ -23,7 +23,7 @@ using Geometry::ShapeFactory; * Default constructor. Required for cow_ptr. */ Sample::Sample() - : m_name(), m_shape(), m_environment(), m_lattice(NULL), + : m_name(), m_shape(), m_environment(), m_lattice(nullptr), m_crystalStructure(), m_samples(), m_geom_id(0), m_thick(0.0), m_height(0.0), m_width(0.0) {} @@ -33,7 +33,7 @@ Sample::Sample() */ Sample::Sample(const Sample ©) : m_name(copy.m_name), m_shape(copy.m_shape), - m_environment(copy.m_environment), m_lattice(NULL), m_crystalStructure(), + m_environment(copy.m_environment), m_lattice(nullptr), m_crystalStructure(), m_samples(copy.m_samples), m_geom_id(copy.m_geom_id), m_thick(copy.m_thick), m_height(copy.m_height), m_width(copy.m_width) { if (copy.m_lattice) @@ -64,12 +64,12 @@ Sample &Sample::operator=(const Sample &rhs) { m_thick = rhs.m_thick; m_height = rhs.m_height; m_width = rhs.m_width; - if (m_lattice != NULL) + if (m_lattice != nullptr) delete m_lattice; if (rhs.m_lattice) m_lattice = new OrientedLattice(rhs.getOrientedLattice()); else - m_lattice = NULL; + m_lattice = nullptr; m_crystalStructure.reset(); if (rhs.hasCrystalStructure()) { @@ -162,17 +162,17 @@ OrientedLattice &Sample::getOrientedLattice() { * @param latt :: A pointer to a OrientedLattice. */ void Sample::setOrientedLattice(OrientedLattice *latt) { - if (m_lattice != NULL) { + if (m_lattice != nullptr) { delete m_lattice; } - if (latt != NULL) + if (latt != nullptr) m_lattice = new OrientedLattice(*latt); else - m_lattice = NULL; + m_lattice = nullptr; } /** @return true if the sample has an OrientedLattice */ -bool Sample::hasOrientedLattice() const { return (m_lattice != NULL); } +bool Sample::hasOrientedLattice() const { return (m_lattice != nullptr); } const Geometry::CrystalStructure &Sample::getCrystalStructure() const { if (!hasCrystalStructure()) { @@ -397,7 +397,7 @@ int Sample::loadNexus(::NeXus::File *file, const std::string &group) { void Sample::clearOrientedLattice() { if (m_lattice) { delete m_lattice; - m_lattice = NULL; + m_lattice = nullptr; } } } diff --git a/Framework/API/src/SpectrumDetectorMapping.cpp b/Framework/API/src/SpectrumDetectorMapping.cpp index 11f9825e4a2..e54a293581e 100644 --- a/Framework/API/src/SpectrumDetectorMapping.cpp +++ b/Framework/API/src/SpectrumDetectorMapping.cpp @@ -54,7 +54,7 @@ SpectrumDetectorMapping::SpectrumDetectorMapping( const specid_t *const spectrumNumbers, const detid_t *const detectorIDs, size_t arrayLengths) : m_indexIsSpecNo(true) { - if (spectrumNumbers == NULL || detectorIDs == NULL) { + if (spectrumNumbers == nullptr || detectorIDs == nullptr) { throw std::invalid_argument( "SpectrumDetectorMapping: Null array pointer passed"); } diff --git a/Framework/Algorithms/src/AbsorptionCorrection.cpp b/Framework/Algorithms/src/AbsorptionCorrection.cpp index 4a3a74820a6..d04f005297f 100644 --- a/Framework/Algorithms/src/AbsorptionCorrection.cpp +++ b/Framework/Algorithms/src/AbsorptionCorrection.cpp @@ -21,7 +21,7 @@ using namespace API; using namespace Mantid::PhysicalConstants; AbsorptionCorrection::AbsorptionCorrection() - : API::Algorithm(), m_inputWS(), m_sampleObject(NULL), m_L1s(), + : API::Algorithm(), m_inputWS(), m_sampleObject(nullptr), m_L1s(), m_elementVolumes(), m_elementPositions(), m_numVolumeElements(0), m_sampleVolume(0.0), m_refAtten(0.0), m_scattering(0), n_lambda(0), m_xStep(0), m_emode(0), m_lambdaFixed(0.), EXPONENTIAL() {} diff --git a/Framework/Algorithms/src/AddNote.cpp b/Framework/Algorithms/src/AddNote.cpp index 83ab5c6e2b0..0f045b233da 100644 --- a/Framework/Algorithms/src/AddNote.cpp +++ b/Framework/Algorithms/src/AddNote.cpp @@ -21,7 +21,7 @@ namespace { */ void createOrUpdateValue(API::Run &run, const std::string &name, const std::string &time, const std::string &value) { - TimeSeriesProperty<std::string> *timeSeries(NULL); + TimeSeriesProperty<std::string> *timeSeries(nullptr); if (run.hasProperty(name)) { timeSeries = dynamic_cast<TimeSeriesProperty<std::string> *>(run.getLogData(name)); diff --git a/Framework/Algorithms/src/AddTimeSeriesLog.cpp b/Framework/Algorithms/src/AddTimeSeriesLog.cpp index b4477cd5341..1d163d466fd 100644 --- a/Framework/Algorithms/src/AddTimeSeriesLog.cpp +++ b/Framework/Algorithms/src/AddTimeSeriesLog.cpp @@ -23,7 +23,7 @@ namespace { template <typename T> void createOrUpdateValue(API::Run &run, const std::string &name, const std::string &time, const T value) { - TimeSeriesProperty<T> *timeSeries(NULL); + TimeSeriesProperty<T> *timeSeries(nullptr); if (run.hasProperty(name)) { timeSeries = dynamic_cast<TimeSeriesProperty<T> *>(run.getLogData(name)); if (!timeSeries) diff --git a/Framework/Algorithms/src/AlignDetectors.cpp b/Framework/Algorithms/src/AlignDetectors.cpp index f1a04f8758f..61afe41a6c9 100644 --- a/Framework/Algorithms/src/AlignDetectors.cpp +++ b/Framework/Algorithms/src/AlignDetectors.cpp @@ -156,7 +156,7 @@ const std::string AlignDetectors::summary() const { /// (Empty) Constructor AlignDetectors::AlignDetectors() : m_numberOfSpectra(0) { - this->tofToDmap = NULL; + this->tofToDmap = nullptr; } /// Destructor @@ -300,7 +300,7 @@ void AlignDetectors::exec() { // Check if its an event workspace EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventW != NULL) { + if (eventW != nullptr) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/ApplyCalibration.cpp b/Framework/Algorithms/src/ApplyCalibration.cpp index fef0660d135..416dd29a4ef 100644 --- a/Framework/Algorithms/src/ApplyCalibration.cpp +++ b/Framework/Algorithms/src/ApplyCalibration.cpp @@ -23,7 +23,7 @@ using Geometry::IDetector_sptr; using Geometry::IComponent_const_sptr; /// Empty default constructor -ApplyCalibration::ApplyCalibration() : Algorithm(), m_pmap(NULL) {} +ApplyCalibration::ApplyCalibration() : Algorithm(), m_pmap(nullptr) {} /// Initialisation method. void ApplyCalibration::init() { @@ -68,7 +68,7 @@ void ApplyCalibration::exec() { setDetectorPosition(instrument, detID[i], detPos[i], false); } // Ensure pointer is only valid for execution - m_pmap = NULL; + m_pmap = nullptr; } /** diff --git a/Framework/Algorithms/src/BinaryOperation.cpp b/Framework/Algorithms/src/BinaryOperation.cpp index 51766562c49..826df55543a 100644 --- a/Framework/Algorithms/src/BinaryOperation.cpp +++ b/Framework/Algorithms/src/BinaryOperation.cpp @@ -28,7 +28,7 @@ BinaryOperation::BinaryOperation() m_matchXSize(false), m_flipSides(false), m_keepEventWorkspace(false), m_useHistogramForRhsEventWorkspace(false), m_do2D_even_for_SingleColumn_on_rhs(false), m_indicesToMask(), - m_progress(NULL) {} + m_progress(nullptr) {} BinaryOperation::~BinaryOperation() { if (m_progress) diff --git a/Framework/Algorithms/src/ChangeBinOffset.cpp b/Framework/Algorithms/src/ChangeBinOffset.cpp index be5db1d67f6..4b27f8138e7 100644 --- a/Framework/Algorithms/src/ChangeBinOffset.cpp +++ b/Framework/Algorithms/src/ChangeBinOffset.cpp @@ -19,7 +19,7 @@ DECLARE_ALGORITHM(ChangeBinOffset) * Default constructor */ ChangeBinOffset::ChangeBinOffset() - : API::Algorithm(), m_progress(NULL), offset(0.), wi_min(0), wi_max(0) {} + : API::Algorithm(), m_progress(nullptr), offset(0.), wi_min(0), wi_max(0) {} /** * Destructor @@ -92,7 +92,7 @@ void ChangeBinOffset::exec() { // Check if its an event workspace EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputW); - if (eventWS != NULL) { + if (eventWS != nullptr) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/ChangeTimeZero.cpp b/Framework/Algorithms/src/ChangeTimeZero.cpp index 78a8651b507..3c444f183db 100644 --- a/Framework/Algorithms/src/ChangeTimeZero.cpp +++ b/Framework/Algorithms/src/ChangeTimeZero.cpp @@ -248,7 +248,7 @@ DateAndTime ChangeTimeZero::getStartTimeFromWorkspace(API::MatrixWorkspace_sptr ws) const { auto run = ws->run(); // Check for the first good frame in the log - Mantid::Kernel::TimeSeriesProperty<double> *goodFrame = NULL; + Mantid::Kernel::TimeSeriesProperty<double> *goodFrame = nullptr; try { goodFrame = run.getTimeSeriesProperty<double>("proton_charge"); } catch (std::invalid_argument) { diff --git a/Framework/Algorithms/src/CompareWorkspaces.cpp b/Framework/Algorithms/src/CompareWorkspaces.cpp index 1d3cfad7606..146cd6aab54 100644 --- a/Framework/Algorithms/src/CompareWorkspaces.cpp +++ b/Framework/Algorithms/src/CompareWorkspaces.cpp @@ -28,7 +28,7 @@ DECLARE_ALGORITHM(CompareWorkspaces) /** Constructor */ CompareWorkspaces::CompareWorkspaces() - : API::Algorithm(), m_Result(false), m_Prog(NULL), + : API::Algorithm(), m_Result(false), m_Prog(nullptr), m_ParallelComparison(true) {} //---------------------------------------------------------------------------------------------- @@ -671,8 +671,8 @@ bool CompareWorkspaces::checkAxes(API::MatrixWorkspace_const_sptr ws1, Unit_const_sptr ax1_unit = ax1->unit(); Unit_const_sptr ax2_unit = ax2->unit(); - if ((ax1_unit == NULL && ax2_unit != NULL) || - (ax1_unit != NULL && ax2_unit == NULL) || + if ((ax1_unit == nullptr && ax2_unit != nullptr) || + (ax1_unit != nullptr && ax2_unit == nullptr) || (ax1_unit && ax1_unit->unitID() != ax2_unit->unitID())) { recordMismatch(axis_name + " unit mismatch"); return false; diff --git a/Framework/Algorithms/src/ConvertAxisByFormula.cpp b/Framework/Algorithms/src/ConvertAxisByFormula.cpp index 7ca2d86629a..f2ad68144d4 100644 --- a/Framework/Algorithms/src/ConvertAxisByFormula.cpp +++ b/Framework/Algorithms/src/ConvertAxisByFormula.cpp @@ -107,7 +107,7 @@ void ConvertAxisByFormula::exec() { bool isRefAxis = false; RefAxis *refAxisPtr = dynamic_cast<RefAxis *>(axisPtr); - if (refAxisPtr != NULL) { + if (refAxisPtr != nullptr) { CommonBinsValidator sameBins; if (sameBins.isValid(outputWs) != "") { throw std::invalid_argument("Axes must have common bins for this " diff --git a/Framework/Algorithms/src/ConvertUnits.cpp b/Framework/Algorithms/src/ConvertUnits.cpp index d162fe62b96..f3393c9fcda 100644 --- a/Framework/Algorithms/src/ConvertUnits.cpp +++ b/Framework/Algorithms/src/ConvertUnits.cpp @@ -194,7 +194,7 @@ void ConvertUnits::setupMemberVariables( m_distribution = inputWS->isDistribution() && !inputWS->YUnit().empty(); // Check if its an event workspace m_inputEvents = - (boost::dynamic_pointer_cast<const EventWorkspace>(inputWS) != NULL); + (boost::dynamic_pointer_cast<const EventWorkspace>(inputWS) != nullptr); m_inputUnit = inputWS->getAxis(0)->unit(); const std::string targetUnit = getPropertyValue("Target"); @@ -388,7 +388,7 @@ void ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUnit, // Get the distance between the source and the sample (assume in metres) IComponent_const_sptr source = instrument->getSource(); IComponent_const_sptr sample = instrument->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { throw Exception::InstrumentDefinitionError("Instrument not sufficiently " "defined: failed to get source " "and/or sample"); diff --git a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp index 8e49a1c8b3c..7d4f6bcbe1f 100644 --- a/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp +++ b/Framework/Algorithms/src/ConvertUnitsUsingDetectorTable.cpp @@ -204,7 +204,7 @@ void ConvertUnitsUsingDetectorTable::setupMemberVariables( m_distribution = inputWS->isDistribution() && !inputWS->YUnit().empty(); // Check if its an event workspace m_inputEvents = - (boost::dynamic_pointer_cast<const EventWorkspace>(inputWS) != NULL); + (boost::dynamic_pointer_cast<const EventWorkspace>(inputWS) != nullptr); m_inputUnit = inputWS->getAxis(0)->unit(); const std::string targetUnit = getPropertyValue("Target"); diff --git a/Framework/Algorithms/src/CopyDetectorMapping.cpp b/Framework/Algorithms/src/CopyDetectorMapping.cpp index b66eba51a5a..2696e9ff508 100644 --- a/Framework/Algorithms/src/CopyDetectorMapping.cpp +++ b/Framework/Algorithms/src/CopyDetectorMapping.cpp @@ -48,12 +48,12 @@ std::map<std::string, std::string> CopyDetectorMapping::validateInputs() { // Check that the workspaces actually are MatrixWorkspaces bool validWorkspaces = true; - if (wsToMatch == NULL) { + if (wsToMatch == nullptr) { issues["WorkspaceToMatch"] = "Must be a MatrixWorkspace"; validWorkspaces = false; } - if (wsToRemap == NULL) { + if (wsToRemap == nullptr) { issues["WorkspaceToRemap"] = "Must be a MatrixWorkspace"; validWorkspaces = false; } diff --git a/Framework/Algorithms/src/CopyInstrumentParameters.cpp b/Framework/Algorithms/src/CopyInstrumentParameters.cpp index 61e350ee965..e265674d7d3 100644 --- a/Framework/Algorithms/src/CopyInstrumentParameters.cpp +++ b/Framework/Algorithms/src/CopyInstrumentParameters.cpp @@ -65,7 +65,7 @@ void CopyInstrumentParameters::exec() { for (; it != givParams.end(); it++) { IComponent *oldComponent = it->first; - const Geometry::IComponent *targComp = 0; + const Geometry::IComponent *targComp = nullptr; IDetector *pOldDet = dynamic_cast<IDetector *>(oldComponent); if (pOldDet) { diff --git a/Framework/Algorithms/src/CopySample.cpp b/Framework/Algorithms/src/CopySample.cpp index 3a14ee3bab2..668e3d2198c 100644 --- a/Framework/Algorithms/src/CopySample.cpp +++ b/Framework/Algorithms/src/CopySample.cpp @@ -90,7 +90,7 @@ void CopySample::exec() { // get input sample IMDEventWorkspace_const_sptr inMDWS = boost::dynamic_pointer_cast<const IMDEventWorkspace>(inWS); - if (inMDWS != NULL) // it is an MD workspace + if (inMDWS != nullptr) // it is an MD workspace { int inputSampleNumber = getProperty("MDInputSampleNumber"); if (inputSampleNumber < 0) { @@ -127,7 +127,7 @@ void CopySample::exec() { IMDEventWorkspace_sptr outMDWS = boost::dynamic_pointer_cast<IMDEventWorkspace>(outWS); - if (outMDWS != NULL) { + if (outMDWS != nullptr) { int outputSampleNumber = getProperty("MDOutputSampleNumber"); if ((outputSampleNumber == EMPTY_INT()) || (outputSampleNumber < 0)) // copy to all samples diff --git a/Framework/Algorithms/src/CorrectKiKf.cpp b/Framework/Algorithms/src/CorrectKiKf.cpp index 44c11cb2c03..b09eda7e12b 100644 --- a/Framework/Algorithms/src/CorrectKiKf.cpp +++ b/Framework/Algorithms/src/CorrectKiKf.cpp @@ -67,7 +67,7 @@ void CorrectKiKf::exec() { // Check if it is an event workspace EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventW != NULL) { + if (eventW != nullptr) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/CreateSampleWorkspace.cpp b/Framework/Algorithms/src/CreateSampleWorkspace.cpp index caf599fbcf3..9d606fe2460 100644 --- a/Framework/Algorithms/src/CreateSampleWorkspace.cpp +++ b/Framework/Algorithms/src/CreateSampleWorkspace.cpp @@ -31,7 +31,7 @@ DECLARE_ALGORITHM(CreateSampleWorkspace) //---------------------------------------------------------------------------------------------- /** Constructor */ -CreateSampleWorkspace::CreateSampleWorkspace() : m_randGen(NULL) {} +CreateSampleWorkspace::CreateSampleWorkspace() : m_randGen(nullptr) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -199,7 +199,7 @@ void CreateSampleWorkspace::exec() { if (!m_randGen) { int seedValue = 0; if (isRandom) { - seedValue = static_cast<int>(std::time(0)); + seedValue = static_cast<int>(std::time(nullptr)); } m_randGen = new Kernel::MersenneTwister(seedValue); } diff --git a/Framework/Algorithms/src/CreateWorkspace.cpp b/Framework/Algorithms/src/CreateWorkspace.cpp index 9c76dfc2ed4..de359b0c4c7 100644 --- a/Framework/Algorithms/src/CreateWorkspace.cpp +++ b/Framework/Algorithms/src/CreateWorkspace.cpp @@ -87,7 +87,7 @@ void CreateWorkspace::exec() { const Property *const dataYprop = getProperty("DataY"); const Property *const dataEprop = getProperty("DataE"); - const ArrayProperty<double> *pCheck = NULL; + const ArrayProperty<double> *pCheck = nullptr; pCheck = dynamic_cast<const ArrayProperty<double> *>(dataXprop); if (!pCheck) @@ -210,7 +210,7 @@ void CreateWorkspace::exec() { } } else { const size_t vAxisLength = vAxis.size(); - NumericAxis *newAxis(NULL); + NumericAxis *newAxis(nullptr); if (vAxisLength == static_cast<size_t>(nSpec)) newAxis = new NumericAxis(vAxisLength); // treat as points else if (vAxisLength == static_cast<size_t>(nSpec + 1)) diff --git a/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Framework/Algorithms/src/DetectorDiagnostic.cpp index 35dafe442d1..ae0337802fa 100644 --- a/Framework/Algorithms/src/DetectorDiagnostic.cpp +++ b/Framework/Algorithms/src/DetectorDiagnostic.cpp @@ -629,9 +629,9 @@ DetectorDiagnostic::calculateMedian(const API::MatrixWorkspace_sptr input, bool checkForMask = false; Geometry::Instrument_const_sptr instrument = input->getInstrument(); - if (instrument != NULL) { - checkForMask = ((instrument->getSource() != NULL) && - (instrument->getSample() != NULL)); + if (instrument != nullptr) { + checkForMask = ((instrument->getSource() != nullptr) && + (instrument->getSample() != nullptr)); } PARALLEL_FOR1(input) diff --git a/Framework/Algorithms/src/DetectorEfficiencyCor.cpp b/Framework/Algorithms/src/DetectorEfficiencyCor.cpp index 2cd1a198b89..2c4ac81cce9 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyCor.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyCor.cpp @@ -65,7 +65,7 @@ const std::string THICKNESS_PARAM = "TubeThickness"; // this default constructor calls default constructors and sets other member // data to impossible (flag) values DetectorEfficiencyCor::DetectorEfficiencyCor() - : Algorithm(), m_inputWS(), m_outputWS(), m_paraMap(NULL), m_Ei(-1.0), + : Algorithm(), m_inputWS(), m_outputWS(), m_paraMap(nullptr), m_Ei(-1.0), m_ki(-1.0), m_shapeCache(), m_samplePos(), m_spectraSkipped() { m_shapeCache.clear(); } diff --git a/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp b/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp index 011b562de72..ce73a8be47c 100644 --- a/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp +++ b/Framework/Algorithms/src/DetectorEfficiencyVariation.cpp @@ -211,9 +211,9 @@ int DetectorEfficiencyVariation::doDetectorTests( bool checkForMask = false; Geometry::Instrument_const_sptr instrument = counts1->getInstrument(); - if (instrument != NULL) { - checkForMask = ((instrument->getSource() != NULL) && - (instrument->getSample() != NULL)); + if (instrument != nullptr) { + checkForMask = ((instrument->getSource() != nullptr) && + (instrument->getSample() != nullptr)); } const double deadValue(1.0); diff --git a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp index aff7bb225dd..82d2eb2dcb1 100644 --- a/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp +++ b/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp @@ -418,7 +418,7 @@ void DiffractionEventCalibrateDetectors::exec() { std::cout << tim << " to CreateGroupingWorkspace" << std::endl; const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex; - gsl_multimin_fminimizer *s = NULL; + gsl_multimin_fminimizer *s = nullptr; gsl_vector *ss, *x; gsl_multimin_function minex_func; diff --git a/Framework/Algorithms/src/DiffractionFocussing2.cpp b/Framework/Algorithms/src/DiffractionFocussing2.cpp index 8ba970a8d09..29c14ecf1ef 100644 --- a/Framework/Algorithms/src/DiffractionFocussing2.cpp +++ b/Framework/Algorithms/src/DiffractionFocussing2.cpp @@ -145,7 +145,7 @@ void DiffractionFocussing2::exec() { double eventXMax = 0.; m_eventW = boost::dynamic_pointer_cast<const EventWorkspace>(m_matrixInputW); - if (m_eventW != NULL) { + if (m_eventW != nullptr) { if (getProperty("PreserveEvents")) { // Input workspace is an event workspace. Use the other exec method this->execEvent(); @@ -153,7 +153,7 @@ void DiffractionFocussing2::exec() { return; } else { // get the full d-spacing range - m_eventW->sortAll(DataObjects::TOF_SORT, NULL); + m_eventW->sortAll(DataObjects::TOF_SORT, nullptr); m_matrixInputW->getXMinMax(eventXMin, eventXMax); } } @@ -575,9 +575,9 @@ void DiffractionFocussing2::determineRebinParameters() { // whether or not to bother checking for a mask bool checkForMask = false; Geometry::Instrument_const_sptr instrument = m_matrixInputW->getInstrument(); - if (instrument != NULL) { - checkForMask = ((instrument->getSource() != NULL) && - (instrument->getSample() != NULL)); + if (instrument != nullptr) { + checkForMask = ((instrument->getSource() != nullptr) && + (instrument->getSample() != nullptr)); } groupAtWorkspaceIndex.resize(nHist); @@ -591,7 +591,7 @@ void DiffractionFocussing2::determineRebinParameters() { // the spectrum is the real thing we want to work with const ISpectrum *spec = m_matrixInputW->getSpectrum(wi); - if (spec == NULL) { + if (spec == nullptr) { groupAtWorkspaceIndex[wi] = -1; continue; } diff --git a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp index 17f737ce668..67ef7365381 100644 --- a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp +++ b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp @@ -335,7 +335,7 @@ void ExportTimeSeriesLog::setupEventWorkspace( values[i + start_index])); } // Ensure thread-safety - outEventWS->sortAll(TOF_SORT, NULL); + outEventWS->sortAll(TOF_SORT, nullptr); // Now, create a default X-vector for histogramming, with just 2 bins. Kernel::cow_ptr<MantidVec> axis; diff --git a/Framework/Algorithms/src/ExtractSpectra.cpp b/Framework/Algorithms/src/ExtractSpectra.cpp index b3530855cb3..78be3cf092f 100644 --- a/Framework/Algorithms/src/ExtractSpectra.cpp +++ b/Framework/Algorithms/src/ExtractSpectra.cpp @@ -109,7 +109,7 @@ void ExtractSpectra::exec() { m_inputWorkspace = getProperty("InputWorkspace"); eventW = boost::dynamic_pointer_cast<EventWorkspace>(m_inputWorkspace); - if (eventW != NULL) { + if (eventW != nullptr) { // Input workspace is an event workspace. Use the other exec method this->execEvent(); } else { @@ -134,9 +134,9 @@ void ExtractSpectra::execHistogram() { // If this is a Workspace2D, get the spectra axes for copying in the spectraNo // later - Axis *inAxis1(NULL); - TextAxis *outTxtAxis(NULL); - NumericAxis *outNumAxis(NULL); + Axis *inAxis1(nullptr); + TextAxis *outTxtAxis(nullptr); + NumericAxis *outNumAxis(nullptr); if (m_inputWorkspace->axes() > 1) { inAxis1 = m_inputWorkspace->getAxis(1); auto outAxis1 = outputWorkspace->getAxis(1); @@ -289,8 +289,8 @@ void ExtractSpectra::execEvent() { API::WorkspaceFactory::Instance().create( "EventWorkspace", m_workspaceIndexList.size(), ntcnew, ntcnew - m_histogram)); - eventW->sortAll(TOF_SORT, NULL); - outputWorkspace->sortAll(TOF_SORT, NULL); + eventW->sortAll(TOF_SORT, nullptr); + outputWorkspace->sortAll(TOF_SORT, nullptr); // Copy required stuff from it API::WorkspaceFactory::Instance().initializeFromParent(m_inputWorkspace, outputWorkspace, true); @@ -402,7 +402,7 @@ void ExtractSpectra::checkProperties() { g_log.error("XMin must be less than XMax"); throw std::out_of_range("XMin must be less than XMax"); } - if (m_minX == m_maxX && m_commonBoundaries && eventW == NULL) { + if (m_minX == m_maxX && m_commonBoundaries && eventW == nullptr) { g_log.error("The X range given lies entirely within a single bin"); throw std::out_of_range( "The X range given lies entirely within a single bin"); diff --git a/Framework/Algorithms/src/FilterByLogValue.cpp b/Framework/Algorithms/src/FilterByLogValue.cpp index 8d9c7f05d45..a679717da4d 100644 --- a/Framework/Algorithms/src/FilterByLogValue.cpp +++ b/Framework/Algorithms/src/FilterByLogValue.cpp @@ -93,7 +93,7 @@ std::map<std::string, std::string> FilterByLogValue::validateInputs() { try { ITimeSeriesProperty *log = dynamic_cast<ITimeSeriesProperty *>(inputWS->run().getLogData(logname)); - if (log == NULL) { + if (log == nullptr) { errors["LogName"] = "'" + logname + "' is not a time-series log."; return errors; } diff --git a/Framework/Algorithms/src/FindDetectorsOutsideLimits.cpp b/Framework/Algorithms/src/FindDetectorsOutsideLimits.cpp index b0be5847348..1d263b90ced 100644 --- a/Framework/Algorithms/src/FindDetectorsOutsideLimits.cpp +++ b/Framework/Algorithms/src/FindDetectorsOutsideLimits.cpp @@ -117,9 +117,9 @@ void FindDetectorsOutsideLimits::exec() { bool checkForMask = false; Geometry::Instrument_const_sptr instrument = inputWS->getInstrument(); - if (instrument != NULL) { - checkForMask = ((instrument->getSource() != NULL) && - (instrument->getSample() != NULL)); + if (instrument != nullptr) { + checkForMask = ((instrument->getSource() != nullptr) && + (instrument->getSample() != nullptr)); } int numFailed(0); diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index bd0b90c1e3e..02698ab5908 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -38,7 +38,7 @@ DECLARE_ALGORITHM(FindPeaks) */ FindPeaks::FindPeaks() : API::Algorithm(), m_peakParameterNames(), m_bkgdParameterNames(), - m_bkgdOrder(0), m_outPeakTableWS(), m_progress(NULL), m_dataWS(), + m_bkgdOrder(0), m_outPeakTableWS(), m_progress(nullptr), m_dataWS(), m_inputPeakFWHM(0), m_wsIndex(0), singleSpectrum(false), m_highBackground(false), m_rawPeaksTable(false), m_numTableParams(0), m_centreIndex(1) /* for Gaussian */, m_peakFuncType(""), diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 5c1d9a29caf..b4de3be72d4 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -28,7 +28,7 @@ DECLARE_ALGORITHM(GenerateEventsFilter) GenerateEventsFilter::GenerateEventsFilter() : API::Algorithm(), m_dataWS(), m_splitWS(), m_filterWS(), m_filterInfoWS(), m_startTime(), m_stopTime(), m_runEndTime(), - m_timeUnitConvertFactorToNS(0.), m_dblLog(NULL), m_intLog(NULL), + m_timeUnitConvertFactorToNS(0.), m_dblLog(nullptr), m_intLog(nullptr), m_logAtCentre(false), m_logTimeTolerance(0.), m_forFastLog(false), m_splitters(), m_vecSplitterTime(), m_vecSplitterGroup(), m_useParallel(false), m_vecSplitterTimeSet(), m_vecGroupIndexSet() {} diff --git a/Framework/Algorithms/src/GetAllEi.cpp b/Framework/Algorithms/src/GetAllEi.cpp index 5e6974ff5ec..f86e1cb68d2 100644 --- a/Framework/Algorithms/src/GetAllEi.cpp +++ b/Framework/Algorithms/src/GetAllEi.cpp @@ -26,7 +26,7 @@ GetAllEi::GetAllEi() m_min_Eresolution(0.08), // half maximal resolution for LET m_max_Eresolution(0.5e-3), m_peakEnergyRatio2reject(0.1), m_phase(0), - m_chopper(), m_pFilterLog(NULL) {} + m_chopper(), m_pFilterLog(nullptr) {} /// Initialization method. void GetAllEi::init() { @@ -982,7 +982,7 @@ GetAllEi::getPLogForProperty(const API::MatrixWorkspace_sptr &inputWS, if (boost::iequals(LogName, "Defined in IDF")) { auto AllNames = m_chopper->getStringParameter(propertyName); if (AllNames.size() != 1) - return NULL; + return nullptr; LogName = AllNames[0]; } auto pIProperty = (inputWS->run().getProperty(LogName)); diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index ed6fedd46ee..34fb21dbde5 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -714,7 +714,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset( // Set up GSL minimzer const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex; - gsl_multimin_fminimizer *s = NULL; + gsl_multimin_fminimizer *s = nullptr; gsl_vector *ss, *x; gsl_multimin_function minex_func; diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp index 8c078c51d93..4707d559583 100644 --- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp +++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp @@ -30,7 +30,7 @@ DECLARE_ALGORITHM(GetTimeSeriesLogInformation) */ GetTimeSeriesLogInformation::GetTimeSeriesLogInformation() : API::Algorithm(), m_dataWS(), mRunStartTime(), mFilterT0(), mFilterTf(), - m_intInfoMap(), m_dblInfoMap(), m_log(NULL), m_timeVec(), m_valueVec(), + m_intInfoMap(), m_dblInfoMap(), m_log(nullptr), m_timeVec(), m_valueVec(), m_starttime(), m_endtime(), m_ignoreNegativeTime(false) {} //---------------------------------------------------------------------------------------------- diff --git a/Framework/Algorithms/src/He3TubeEfficiency.cpp b/Framework/Algorithms/src/He3TubeEfficiency.cpp index f1a19dc5a7d..077a4e670d3 100644 --- a/Framework/Algorithms/src/He3TubeEfficiency.cpp +++ b/Framework/Algorithms/src/He3TubeEfficiency.cpp @@ -28,8 +28,8 @@ DECLARE_ALGORITHM(He3TubeEfficiency) /// Default constructor He3TubeEfficiency::He3TubeEfficiency() - : Algorithm(), inputWS(), outputWS(), paraMap(NULL), shapeCache(), - samplePos(), spectraSkipped(), progress(NULL) { + : Algorithm(), inputWS(), outputWS(), paraMap(nullptr), shapeCache(), + samplePos(), spectraSkipped(), progress(nullptr) { this->shapeCache.clear(); } @@ -103,7 +103,7 @@ void He3TubeEfficiency::exec() { // Check if it is an event workspace DataObjects::EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(inputWS); - if (eventW != NULL) { + if (eventW != nullptr) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/InterpolatingRebin.cpp b/Framework/Algorithms/src/InterpolatingRebin.cpp index 76cbdf0b30f..562bb465c7f 100644 --- a/Framework/Algorithms/src/InterpolatingRebin.cpp +++ b/Framework/Algorithms/src/InterpolatingRebin.cpp @@ -135,7 +135,7 @@ void InterpolatingRebin::outputYandEValues( << "Preparing to calculate y-values using splines and estimate errors\n"; // prepare to use GSL functions but don't let them terminate Mantid - gsl_error_handler_t *old_handler = gsl_set_error_handler(NULL); + gsl_error_handler_t *old_handler = gsl_set_error_handler(nullptr); const int histnumber = static_cast<int>(inputW->getNumberHistograms()); Progress prog(this, 0.0, 1.0, histnumber); @@ -298,8 +298,8 @@ void InterpolatingRebin::cubicInterpolation( } // get the GSL to allocate the memory - gsl_interp_accel *acc = NULL; - gsl_spline *spline = NULL; + gsl_interp_accel *acc = nullptr; + gsl_spline *spline = nullptr; try { acc = gsl_interp_accel_alloc(); const size_t nPoints = oldIn2 - oldIn1 + 1; diff --git a/Framework/Algorithms/src/MaskBins.cpp b/Framework/Algorithms/src/MaskBins.cpp index 4596c5ef455..d0a76b00329 100644 --- a/Framework/Algorithms/src/MaskBins.cpp +++ b/Framework/Algorithms/src/MaskBins.cpp @@ -95,7 +95,7 @@ void MaskBins::exec() { EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventW != NULL) { + if (eventW != nullptr) { //------- EventWorkspace --------------------------- this->execEvent(); } else { diff --git a/Framework/Algorithms/src/MedianDetectorTest.cpp b/Framework/Algorithms/src/MedianDetectorTest.cpp index c79c0eb1e07..382d4ec132c 100644 --- a/Framework/Algorithms/src/MedianDetectorTest.cpp +++ b/Framework/Algorithms/src/MedianDetectorTest.cpp @@ -101,7 +101,7 @@ void MedianDetectorTest::exec() { // 0. Correct for solid angle, if desired if (m_solidAngle) { MatrixWorkspace_sptr solidAngle = getSolidAngles(m_minSpec, m_maxSpec); - if (solidAngle != NULL) { + if (solidAngle != nullptr) { countsWS = countsWS / solidAngle; } } @@ -240,9 +240,9 @@ int MedianDetectorTest::maskOutliers( bool checkForMask = false; Geometry::Instrument_const_sptr instrument = countsWS->getInstrument(); - if (instrument != NULL) { - checkForMask = ((instrument->getSource() != NULL) && - (instrument->getSample() != NULL)); + if (instrument != nullptr) { + checkForMask = ((instrument->getSource() != nullptr) && + (instrument->getSample() != nullptr)); } for (size_t i = 0; i < indexmap.size(); ++i) { @@ -308,9 +308,9 @@ int MedianDetectorTest::doDetectorTests( bool checkForMask = false; Geometry::Instrument_const_sptr instrument = countsWS->getInstrument(); - if (instrument != NULL) { - checkForMask = ((instrument->getSource() != NULL) && - (instrument->getSample() != NULL)); + if (instrument != nullptr) { + checkForMask = ((instrument->getSource() != nullptr) && + (instrument->getSample() != nullptr)); } PARALLEL_FOR2(countsWS, maskWS) diff --git a/Framework/Algorithms/src/MergeRuns.cpp b/Framework/Algorithms/src/MergeRuns.cpp index 7c60a8f00e8..4ab97b7d5ea 100644 --- a/Framework/Algorithms/src/MergeRuns.cpp +++ b/Framework/Algorithms/src/MergeRuns.cpp @@ -19,7 +19,7 @@ using namespace DataObjects; /// Default constructor MergeRuns::MergeRuns() - : MultiPeriodGroupAlgorithm(), m_progress(NULL), m_inEventWS(), + : MultiPeriodGroupAlgorithm(), m_progress(nullptr), m_inEventWS(), m_inMatrixWS(), m_tables() {} /// Destructor diff --git a/Framework/Algorithms/src/ModeratorTzero.cpp b/Framework/Algorithms/src/ModeratorTzero.cpp index 9e8fcbf851f..69d2bc0af78 100644 --- a/Framework/Algorithms/src/ModeratorTzero.cpp +++ b/Framework/Algorithms/src/ModeratorTzero.cpp @@ -104,7 +104,7 @@ void ModeratorTzero::exec() { // Run execEvent if eventWorkSpace EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventWS != NULL) { + if (eventWS != nullptr) { execEvent(emode); return; } diff --git a/Framework/Algorithms/src/ModeratorTzeroLinear.cpp b/Framework/Algorithms/src/ModeratorTzeroLinear.cpp index 8e2820e42e8..64a33b43fe8 100644 --- a/Framework/Algorithms/src/ModeratorTzeroLinear.cpp +++ b/Framework/Algorithms/src/ModeratorTzeroLinear.cpp @@ -116,7 +116,7 @@ void ModeratorTzeroLinear::exec() { // Run execEvent if eventWorkSpace EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventWS != NULL) { + if (eventWS != nullptr) { execEvent(); return; } diff --git a/Framework/Algorithms/src/MonteCarloAbsorption.cpp b/Framework/Algorithms/src/MonteCarloAbsorption.cpp index e482d090fbe..9cfc8a3c2b4 100644 --- a/Framework/Algorithms/src/MonteCarloAbsorption.cpp +++ b/Framework/Algorithms/src/MonteCarloAbsorption.cpp @@ -46,7 +46,7 @@ using namespace Kernel; MonteCarloAbsorption::MonteCarloAbsorption() : m_samplePos(), m_sourcePos(), m_numVolumeElements(0), m_blocks(), m_blkHalfX(0.0), m_blkHalfY(0.0), m_blkHalfZ(0.0), m_rngs(0), m_inputWS(), - m_sampleShape(NULL), m_sampleMaterial(NULL), m_container(NULL), + m_sampleShape(nullptr), m_sampleMaterial(nullptr), m_container(nullptr), m_numberOfPoints(0), m_xStepSize(0), m_numberOfEvents(300) {} /** @@ -360,7 +360,7 @@ void MonteCarloAbsorption::retrieveInput() { try { m_container = &(m_inputWS->sample().getEnvironment()); } catch (std::runtime_error &) { - m_container = NULL; + m_container = nullptr; g_log.information() << "No environment has been defined, continuing with only sample.\n"; } diff --git a/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp b/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp index dda243face3..1ce5d84cb6e 100644 --- a/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp +++ b/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp @@ -139,15 +139,15 @@ void MultipleScatteringCylinderAbsorption::exec() { // geometry stuff const int64_t NUM_HIST = static_cast<int64_t>(in_WS->getNumberHistograms()); Instrument_const_sptr instrument = in_WS->getInstrument(); - if (instrument == NULL) + if (instrument == nullptr) throw std::runtime_error( "Failed to find instrument attached to InputWorkspace"); IComponent_const_sptr source = instrument->getSource(); IComponent_const_sptr sample = instrument->getSample(); - if (source == NULL) + if (source == nullptr) throw std::runtime_error( "Failed to find source in the instrument for InputWorkspace"); - if (sample == NULL) + if (sample == nullptr) throw std::runtime_error( "Failed to find sample in the instrument for InputWorkspace"); @@ -181,7 +181,7 @@ void MultipleScatteringCylinderAbsorption::exec() { for (int64_t index = 0; index < NUM_HIST; ++index) { PARALLEL_START_INTERUPT_REGION IDetector_const_sptr det = out_WSevent->getDetector(index); - if (det == NULL) + if (det == nullptr) throw std::runtime_error("Failed to find detector"); if (det->isMasked()) continue; @@ -218,7 +218,7 @@ void MultipleScatteringCylinderAbsorption::exec() { for (int64_t index = 0; index < NUM_HIST; ++index) { IDetector_const_sptr det = in_WS->getDetector(index); - if (det == NULL) + if (det == nullptr) throw std::runtime_error("Failed to find detector"); if (det->isMasked()) continue; diff --git a/Framework/Algorithms/src/NormaliseByDetector.cpp b/Framework/Algorithms/src/NormaliseByDetector.cpp index 888e50ba6c0..4d531c5bc7d 100644 --- a/Framework/Algorithms/src/NormaliseByDetector.cpp +++ b/Framework/Algorithms/src/NormaliseByDetector.cpp @@ -72,7 +72,7 @@ void NormaliseByDetector::init() { const Geometry::FitParameter NormaliseByDetector::tryParseFunctionParameter( Geometry::Parameter_sptr parameter, Geometry::IDetector_const_sptr det) { - if (parameter == NULL) { + if (parameter == nullptr) { std::stringstream stream; stream << det->getName() << " and all of it's parent components, have no " "fitting type parameters. This algorithm " diff --git a/Framework/Algorithms/src/PerformIndexOperations.cpp b/Framework/Algorithms/src/PerformIndexOperations.cpp index b8bdb32c058..a6aca08fa87 100644 --- a/Framework/Algorithms/src/PerformIndexOperations.cpp +++ b/Framework/Algorithms/src/PerformIndexOperations.cpp @@ -152,7 +152,7 @@ typedef std::vector<boost::shared_ptr<CommandParser>> VecCommandParsers; template <typename ProductType> class CommandParserBase : public CommandParser { public: virtual Command *interpret(const std::string &instruction) const { - Command *command = NULL; + Command *command = nullptr; boost::regex ex = getRegex(); if (boost::regex_match(instruction, ex)) { auto indexes = @@ -192,7 +192,7 @@ public: virtual ~AdditionParser() {} virtual Command *interpret(const std::string &instruction) const { - Command *command = NULL; + Command *command = nullptr; boost::regex ex("^\\s*[0-9]+\\s*\\+\\s*[0-9]+\\s*$"); if (boost::regex_match(instruction, ex)) { std::vector<std::string> arguments; @@ -234,7 +234,7 @@ public: virtual ~CropParserIndex() {} virtual Command *interpret(const std::string &instruction) const { - Command *command = NULL; + Command *command = nullptr; boost::regex ex("^\\s*[0-9]+\\s*$"); if (boost::regex_match(instruction, ex)) { int index = -1; diff --git a/Framework/Algorithms/src/Q1D2.cpp b/Framework/Algorithms/src/Q1D2.cpp index a7906aeeb68..2bff5f108be 100644 --- a/Framework/Algorithms/src/Q1D2.cpp +++ b/Framework/Algorithms/src/Q1D2.cpp @@ -112,9 +112,9 @@ void Q1D2::exec() { // FIXME: how to examine the wavePixelAdj? g_log.debug() << "All input workspaces were found to be valid\n"; // normalization as a function of wavelength (i.e. centers of x-value bins) - double const *const binNorms = waveAdj ? &(waveAdj->readY(0)[0]) : NULL; + double const *const binNorms = waveAdj ? &(waveAdj->readY(0)[0]) : nullptr; // error on the wavelength normalization - double const *const binNormEs = waveAdj ? &(waveAdj->readE(0)[0]) : NULL; + double const *const binNormEs = waveAdj ? &(waveAdj->readE(0)[0]) : nullptr; // define the (large number of) data objects that are going to be used in all // iterations of the loop below diff --git a/Framework/Algorithms/src/Rebin.cpp b/Framework/Algorithms/src/Rebin.cpp index 7edf8b2f2b1..a94737ebf52 100644 --- a/Framework/Algorithms/src/Rebin.cpp +++ b/Framework/Algorithms/src/Rebin.cpp @@ -140,7 +140,7 @@ void Rebin::exec() { EventWorkspace_const_sptr eventInputWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventInputWS != NULL) { + if (eventInputWS != nullptr) { //------- EventWorkspace as input ------------------------------------- EventWorkspace_sptr eventOutputWS = boost::dynamic_pointer_cast<EventWorkspace>(outputWS); diff --git a/Framework/Algorithms/src/ReflectometryReductionOne.cpp b/Framework/Algorithms/src/ReflectometryReductionOne.cpp index 9640658dc1d..46d61f39c6c 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOne.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOne.cpp @@ -408,7 +408,7 @@ ReflectometryReductionOne::getSurfaceSampleComponent( sampleComponent = this->getPropertyValue("SampleComponentName"); } auto searchResult = inst->getComponentByName(sampleComponent); - if (searchResult == NULL) { + if (searchResult == nullptr) { throw std::invalid_argument(sampleComponent + " does not exist. Check input properties."); } @@ -435,7 +435,7 @@ ReflectometryReductionOne::getDetectorComponent( } boost::shared_ptr<const IComponent> searchResult = inst->getComponentByName(componentToCorrect); - if (searchResult == NULL) { + if (searchResult == nullptr) { throw std::invalid_argument(componentToCorrect + " does not exist. Check input properties."); } diff --git a/Framework/Algorithms/src/RemoveBackground.cpp b/Framework/Algorithms/src/RemoveBackground.cpp index 54df033197e..53f74caa515 100644 --- a/Framework/Algorithms/src/RemoveBackground.cpp +++ b/Framework/Algorithms/src/RemoveBackground.cpp @@ -159,7 +159,7 @@ void RemoveBackground::exec() { //------------------------------------------------------------------------------------------------------------------------------- /// Constructor BackgroundHelper::BackgroundHelper() - : m_WSUnit(), m_bgWs(), m_wkWS(), m_pgLog(NULL), m_inPlace(true), + : m_WSUnit(), m_bgWs(), m_wkWS(), m_pgLog(nullptr), m_inPlace(true), m_singleValueBackground(false), m_NBg(0), m_dtBg(1), m_ErrSq(0), m_Emode(0), m_L1(0), m_Efix(0), m_Sample(), m_nullifyNegative(false), m_previouslyRemovedBkgMode(false) {} @@ -171,7 +171,7 @@ void BackgroundHelper::deleteUnitsConverters() { for (size_t i = 0; i < m_WSUnit.size(); i++) { if (m_WSUnit[i]) { delete m_WSUnit[i]; - m_WSUnit[i] = NULL; + m_WSUnit[i] = nullptr; } } } @@ -229,7 +229,7 @@ void BackgroundHelper::initialize(const API::MatrixWorkspace_const_sptr &bkgWS, this->deleteUnitsConverters(); // allocate the array of units converters to avoid units reallocation within a // loop - m_WSUnit.assign(nThreads, NULL); + m_WSUnit.assign(nThreads, nullptr); for (int i = 0; i < nThreads; i++) { m_WSUnit[i] = WSUnit->clone(); } diff --git a/Framework/Algorithms/src/RemoveBins.cpp b/Framework/Algorithms/src/RemoveBins.cpp index f759b496a01..f6584854816 100644 --- a/Framework/Algorithms/src/RemoveBins.cpp +++ b/Framework/Algorithms/src/RemoveBins.cpp @@ -273,7 +273,7 @@ void RemoveBins::calculateDetectorPosition(const int &index, double &l1, // Get the distance between the source and the sample (assume in metres) Geometry::IComponent_const_sptr sample = instrument->getSample(); // Check for valid instrument - if (sample == NULL) { + if (sample == nullptr) { throw Exception::InstrumentDefinitionError( "Instrument not sufficiently defined: failed to get sample"); } diff --git a/Framework/Algorithms/src/RemoveLowResTOF.cpp b/Framework/Algorithms/src/RemoveLowResTOF.cpp index c56d99b7c4f..5db25548e07 100644 --- a/Framework/Algorithms/src/RemoveLowResTOF.cpp +++ b/Framework/Algorithms/src/RemoveLowResTOF.cpp @@ -30,7 +30,7 @@ DECLARE_ALGORITHM(RemoveLowResTOF) RemoveLowResTOF::RemoveLowResTOF() : m_inputWS(), m_inputEvWS(), m_DIFCref(0.), m_K(0.), m_instrument(), m_sample(), m_L1(0.), m_Tmin(0.), m_wavelengthMin(0.), - m_numberOfSpectra(0), m_progress(NULL), m_outputLowResTOF(false) {} + m_numberOfSpectra(0), m_progress(nullptr), m_outputLowResTOF(false) {} /// Destructor RemoveLowResTOF::~RemoveLowResTOF() { delete m_progress; } @@ -120,7 +120,7 @@ void RemoveLowResTOF::exec() { // go off and do the event version if appropriate m_inputEvWS = boost::dynamic_pointer_cast<const EventWorkspace>(m_inputWS); - if (m_inputEvWS != NULL) { + if (m_inputEvWS != nullptr) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/ResampleX.cpp b/Framework/Algorithms/src/ResampleX.cpp index 1b0aff6ccb6..c9515604861 100644 --- a/Framework/Algorithms/src/ResampleX.cpp +++ b/Framework/Algorithms/src/ResampleX.cpp @@ -130,7 +130,7 @@ string determineXMinMax(MatrixWorkspace_sptr inputWS, vector<double> &xmins, double xmax_wksp = inputWS->getXMax(); EventWorkspace_const_sptr inputEventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (inputEventWS != NULL) { + if (inputEventWS != nullptr) { xmin_wksp = inputEventWS->getTofMin(); xmax_wksp = inputEventWS->getTofMax(); } @@ -318,7 +318,7 @@ void ResampleX::exec() { // start doing actual work EventWorkspace_const_sptr inputEventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (inputEventWS != NULL) { + if (inputEventWS != nullptr) { if (m_preserveEvents) { EventWorkspace_sptr outputEventWS = boost::dynamic_pointer_cast<EventWorkspace>(outputWS); diff --git a/Framework/Algorithms/src/ResetNegatives.cpp b/Framework/Algorithms/src/ResetNegatives.cpp index 8e3d93ed905..6768b5499cf 100644 --- a/Framework/Algorithms/src/ResetNegatives.cpp +++ b/Framework/Algorithms/src/ResetNegatives.cpp @@ -94,7 +94,7 @@ void ResetNegatives::exec() { DataObjects::EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(inputWS); if (eventWS) - eventWS->sortAll(DataObjects::TOF_SORT, NULL); + eventWS->sortAll(DataObjects::TOF_SORT, nullptr); Progress prog(this, .1, 1., 2 * nHist); diff --git a/Framework/Algorithms/src/ScaleX.cpp b/Framework/Algorithms/src/ScaleX.cpp index d0ea8c9c6f4..43493c31972 100644 --- a/Framework/Algorithms/src/ScaleX.cpp +++ b/Framework/Algorithms/src/ScaleX.cpp @@ -20,7 +20,7 @@ DECLARE_ALGORITHM(ScaleX) * Default constructor */ ScaleX::ScaleX() - : API::Algorithm(), m_progress(NULL), m_algFactor(1.0), m_parname(), + : API::Algorithm(), m_progress(nullptr), m_algFactor(1.0), m_parname(), m_combine(false), m_binOp(), m_wi_min(-1), m_wi_max(-1) {} /** @@ -114,7 +114,7 @@ void ScaleX::exec() { // Check if its an event workspace EventWorkspace_const_sptr eventWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputW); - if (eventWS != NULL) { + if (eventWS != nullptr) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/Segfault.cpp b/Framework/Algorithms/src/Segfault.cpp index 2479120f24d..a77f085911b 100644 --- a/Framework/Algorithms/src/Segfault.cpp +++ b/Framework/Algorithms/src/Segfault.cpp @@ -49,7 +49,7 @@ void Segfault::exec() { if (!dryrun) { // NULL pointer dereference - int *ptr = NULL; + int *ptr = nullptr; *ptr = 1; } } diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index 63d82f54b68..f3131eaf879 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -40,7 +40,7 @@ SmoothNeighbours::SmoothNeighbours() : API::Algorithm(), AdjX(0), AdjY(0), Edge(0), Radius(0.), nNeighbours(0), WeightedSum(new NullWeighting), PreserveEvents(false), expandSumAllPixels(false), outWI(0), inWS(), m_neighbours(), - m_prog(NULL) {} + m_prog(nullptr) {} /** Initialisation method. * @@ -810,7 +810,7 @@ void SmoothNeighbours::execEvent(Mantid::DataObjects::EventWorkspace_sptr ws) { // Copy geometry over. API::WorkspaceFactory::Instance().initializeFromParent(ws, outWS, false); // Ensure thread-safety - outWS->sortAll(TOF_SORT, NULL); + outWS->sortAll(TOF_SORT, nullptr); this->setProperty("OutputWorkspace", boost::dynamic_pointer_cast<MatrixWorkspace>(outWS)); diff --git a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp index dde76efc181..75d17fc0eb4 100644 --- a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp +++ b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp @@ -135,7 +135,7 @@ SpecularReflectionAlgorithm::getSurfaceSampleComponent( sampleComponent = this->getPropertyValue("SampleComponentName"); } auto searchResult = inst->getComponentByName(sampleComponent); - if (searchResult == NULL) { + if (searchResult == nullptr) { throw std::invalid_argument(sampleComponent + " does not exist. Check input properties."); } @@ -188,7 +188,7 @@ SpecularReflectionAlgorithm::getDetectorComponent( componentToCorrect = this->getPropertyValue("DetectorComponentName"); } searchResult = inst->getComponentByName(componentToCorrect); - if (searchResult == NULL) { + if (searchResult == nullptr) { throw std::invalid_argument(componentToCorrect + " does not exist. Check input properties."); } diff --git a/Framework/Algorithms/src/SphericalAbsorption.cpp b/Framework/Algorithms/src/SphericalAbsorption.cpp index e8cacb05c90..12ac3bf0368 100644 --- a/Framework/Algorithms/src/SphericalAbsorption.cpp +++ b/Framework/Algorithms/src/SphericalAbsorption.cpp @@ -27,7 +27,7 @@ using namespace API; using namespace DataObjects; SphericalAbsorption::SphericalAbsorption() - : API::Algorithm(), m_inputWS(), m_sampleObject(NULL), m_beamDirection(), + : API::Algorithm(), m_inputWS(), m_sampleObject(nullptr), m_beamDirection(), m_L1s(), m_elementVolumes(), m_elementPositions(), m_numVolumeElements(0), m_sampleVolume(0.), m_refAtten(0.0), m_scattering(0.), n_lambda(0), x_step(0), m_emode(0), m_lambdaFixed(0.) {} diff --git a/Framework/Algorithms/src/SumEventsByLogValue.cpp b/Framework/Algorithms/src/SumEventsByLogValue.cpp index 48f47cff4a6..fac299d0356 100644 --- a/Framework/Algorithms/src/SumEventsByLogValue.cpp +++ b/Framework/Algorithms/src/SumEventsByLogValue.cpp @@ -74,7 +74,7 @@ std::map<std::string, std::string> SumEventsByLogValue::validateInputs() { try { ITimeSeriesProperty *log = dynamic_cast<ITimeSeriesProperty *>( m_inputWorkspace->run().getLogData(m_logName)); - if (log == NULL) { + if (log == nullptr) { errors["LogName"] = "'" + m_logName + "' is not a time-series log."; return errors; } @@ -105,7 +105,7 @@ void SumEventsByLogValue::exec() { m_binningParams = getProperty("OutputBinning"); // Binning parameters must be provided for floating point logs if (m_binningParams.empty()) { - if (intLog != NULL) { + if (intLog != nullptr) { createTableOutput(intLog); } else { throw std::invalid_argument( @@ -113,9 +113,9 @@ void SumEventsByLogValue::exec() { } } else // Binning parameters have been given { - if (intLog != NULL) { + if (intLog != nullptr) { createBinnedOutput(intLog); - } else if (dblLog != NULL) { + } else if (dblLog != nullptr) { createBinnedOutput(dblLog); } // else if ( dynamic_cast<const TimeSeriesProperty<std::string>*>(log) != @@ -189,13 +189,13 @@ void SumEventsByLogValue::createTableOutput( // value auto protonChgCol = outputWorkspace->addColumn("double", "proton_charge"); // Get hold of the proton charge log for later - const TimeSeriesProperty<double> *protonChargeLog = NULL; + const TimeSeriesProperty<double> *protonChargeLog = nullptr; try { protonChargeLog = m_inputWorkspace->run().getTimeSeriesProperty<double>("proton_charge"); // Set back to NULL if the log is empty or bad things will happen later if (protonChargeLog->realSize() == 0) - protonChargeLog = NULL; + protonChargeLog = nullptr; } catch (std::exception &) { // Log and carry on if not found. Column will be left empty. g_log.warning("proton_charge log not found in workspace."); @@ -357,7 +357,7 @@ SumEventsByLogValue::getNumberSeriesLogs() { // Try to cast to an ITimeSeriesProperty auto tsp = dynamic_cast<const ITimeSeriesProperty *>(*log); // Move on to the next one if this is not a TSP - if (tsp == NULL) + if (tsp == nullptr) continue; // Don't keep ones with only one entry // if ( tsp->realSize() < 2 ) continue; diff --git a/Framework/Algorithms/src/Transpose.cpp b/Framework/Algorithms/src/Transpose.cpp index 194f41ee9e0..1bd4831ac27 100644 --- a/Framework/Algorithms/src/Transpose.cpp +++ b/Framework/Algorithms/src/Transpose.cpp @@ -104,7 +104,7 @@ API::MatrixWorkspace_sptr Transpose::createOutputWorkspace( // Create a new numeric axis for Y the same length as the old X array // Values come from input X - API::NumericAxis *newYAxis(NULL); + API::NumericAxis *newYAxis(nullptr); if (inputWorkspace->isHistogramData()) { newYAxis = new API::BinEdgeAxis(inX); } else { diff --git a/Framework/Algorithms/src/UnaryOperation.cpp b/Framework/Algorithms/src/UnaryOperation.cpp index b0949638a66..b980175642d 100644 --- a/Framework/Algorithms/src/UnaryOperation.cpp +++ b/Framework/Algorithms/src/UnaryOperation.cpp @@ -42,7 +42,7 @@ void UnaryOperation::exec() { // Check if it is an event workspace EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const EventWorkspace>(in_work); - if ((eventW != NULL) && !(this->useHistogram)) { + if ((eventW != nullptr) && !(this->useHistogram)) { this->execEvent(); return; } diff --git a/Framework/Algorithms/src/UnwrapMonitor.cpp b/Framework/Algorithms/src/UnwrapMonitor.cpp index 75f157e303c..6a30adf50ff 100644 --- a/Framework/Algorithms/src/UnwrapMonitor.cpp +++ b/Framework/Algorithms/src/UnwrapMonitor.cpp @@ -22,13 +22,13 @@ using namespace API; /// Default constructor UnwrapMonitor::UnwrapMonitor() : m_conversionConstant(0.), m_inputWS(), m_LRef(0.), m_Tmin(0.), m_Tmax(0.), - m_XSize(0), m_progress(NULL) {} + m_XSize(0), m_progress(nullptr) {} /// Destructor UnwrapMonitor::~UnwrapMonitor() { if (m_progress) delete m_progress; - m_progress = NULL; + m_progress = nullptr; } /// Initialisation method diff --git a/Framework/Algorithms/src/UnwrapSNS.cpp b/Framework/Algorithms/src/UnwrapSNS.cpp index 0c9a7eb7777..bcb2ef38741 100644 --- a/Framework/Algorithms/src/UnwrapSNS.cpp +++ b/Framework/Algorithms/src/UnwrapSNS.cpp @@ -31,13 +31,13 @@ using std::size_t; UnwrapSNS::UnwrapSNS() : m_conversionConstant(0.), m_inputWS(), m_inputEvWS(), m_LRef(0.), m_L1(0.), m_Tmin(0.), m_Tmax(0.), m_frameWidth(0.), m_numberOfSpectra(0), - m_XSize(0), m_progress(NULL) {} + m_XSize(0), m_progress(nullptr) {} /// Destructor UnwrapSNS::~UnwrapSNS() { if (m_progress) delete m_progress; - m_progress = NULL; + m_progress = nullptr; } /// Algorithm's name for identification overriding a virtual method @@ -123,7 +123,7 @@ void UnwrapSNS::exec() { // go off and do the event version if appropriate m_inputEvWS = boost::dynamic_pointer_cast<const EventWorkspace>(m_inputWS); - if ((m_inputEvWS != NULL)) // && ! this->getProperty("ForceHist")) // TODO + if ((m_inputEvWS != nullptr)) // && ! this->getProperty("ForceHist")) // TODO // remove ForceHist option { this->execEvent(); @@ -333,7 +333,7 @@ void UnwrapSNS::getTofRangeData(const bool isEvent) { double dataTmin; double dataTmax; if (isEvent) { - m_inputEvWS->sortAll(DataObjects::TOF_SORT, NULL); + m_inputEvWS->sortAll(DataObjects::TOF_SORT, nullptr); m_inputEvWS->getEventXMinMax(dataTmin, dataTmax); } else { m_inputWS->getXMinMax(dataTmin, dataTmax); diff --git a/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp b/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp index 4703eb91d2f..d5d5b261d04 100644 --- a/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp +++ b/Framework/Algorithms/src/WeightedMeanOfWorkspace.cpp @@ -60,7 +60,7 @@ void WeightedMeanOfWorkspace::exec() { // Check if it is an event workspace EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventW != NULL) { + if (eventW != nullptr) { throw std::runtime_error( "WeightedMeanOfWorkspace cannot handle EventWorkspaces!"); } diff --git a/Framework/Algorithms/src/WorkspaceJoiners.cpp b/Framework/Algorithms/src/WorkspaceJoiners.cpp index 33ffe0654df..baaac9dde5d 100644 --- a/Framework/Algorithms/src/WorkspaceJoiners.cpp +++ b/Framework/Algorithms/src/WorkspaceJoiners.cpp @@ -12,7 +12,7 @@ using namespace DataObjects; /** Constructor */ -WorkspaceJoiners::WorkspaceJoiners() : Algorithm(), m_progress(NULL) {} +WorkspaceJoiners::WorkspaceJoiners() : Algorithm(), m_progress(nullptr) {} /** Destructor */ diff --git a/Framework/Crystal/src/AnvredCorrection.cpp b/Framework/Crystal/src/AnvredCorrection.cpp index 7fb3e10acdb..9d95da93731 100644 --- a/Framework/Crystal/src/AnvredCorrection.cpp +++ b/Framework/Crystal/src/AnvredCorrection.cpp @@ -146,8 +146,8 @@ void AnvredCorrection::exec() { eventW = boost::dynamic_pointer_cast<EventWorkspace>(m_inputWS); if (eventW) - eventW->sortAll(TOF_SORT, NULL); - if ((getProperty("PreserveEvents")) && (eventW != NULL) && + eventW->sortAll(TOF_SORT, nullptr); + if ((getProperty("PreserveEvents")) && (eventW != nullptr) && !m_returnTransmissionOnly) { // Input workspace is an event workspace. Use the other exec method this->execEvent(); @@ -272,7 +272,7 @@ void AnvredCorrection::execEvent() { correctionFactors = boost::dynamic_pointer_cast<EventWorkspace>( API::WorkspaceFactory::Instance().create("EventWorkspace", numHists, 2, 1)); - correctionFactors->sortAll(TOF_SORT, NULL); + correctionFactors->sortAll(TOF_SORT, nullptr); // Copy required stuff from it API::WorkspaceFactory::Instance().initializeFromParent( m_inputWS, correctionFactors, true); diff --git a/Framework/Crystal/src/CentroidPeaks.cpp b/Framework/Crystal/src/CentroidPeaks.cpp index 875cfecb80e..214983eb992 100644 --- a/Framework/Crystal/src/CentroidPeaks.cpp +++ b/Framework/Crystal/src/CentroidPeaks.cpp @@ -339,7 +339,7 @@ void CentroidPeaks::exec() { eventW = boost::dynamic_pointer_cast<const EventWorkspace>(inWS); if (eventW) { - eventW->sortAll(TOF_SORT, NULL); + eventW->sortAll(TOF_SORT, nullptr); this->integrateEvent(); } else { this->integrate(); diff --git a/Framework/Crystal/src/ConnectedComponentLabeling.cpp b/Framework/Crystal/src/ConnectedComponentLabeling.cpp index aa183dc399a..6a82a40ce41 100644 --- a/Framework/Crystal/src/ConnectedComponentLabeling.cpp +++ b/Framework/Crystal/src/ConnectedComponentLabeling.cpp @@ -368,7 +368,7 @@ ClusterMap ConnectedComponentLabeling::calculateDisjointTree( clusterMap = clusterRegister.clusters(neighbourElements); } else { - API::IMDIterator *iterator = ws->createIterator(NULL); + API::IMDIterator *iterator = ws->createIterator(nullptr); VecEdgeIndexPair edgeIndexPair; // This should never get filled in a single // threaded situation. size_t endLabelId = doConnectedComponentLabeling( diff --git a/Framework/Crystal/src/FilterPeaks.cpp b/Framework/Crystal/src/FilterPeaks.cpp index 374e0812b72..558c44ae472 100644 --- a/Framework/Crystal/src/FilterPeaks.cpp +++ b/Framework/Crystal/src/FilterPeaks.cpp @@ -94,7 +94,7 @@ void FilterPeaks::exec() { filteredWS->copyExperimentInfoFrom(inputWS.get()); const std::string FilterVariable = getProperty("FilterVariable"); - double (*filterFunction)(const Mantid::Geometry::IPeak &) = 0; + double (*filterFunction)(const Mantid::Geometry::IPeak &) = nullptr; if (FilterVariable == "h+k+l") filterFunction = &HKLSum; else if (FilterVariable == "h^2+k^2+l^2") diff --git a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp index 8f8e0f8e594..b5fa039b39c 100644 --- a/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp +++ b/Framework/Crystal/src/GoniometerAnglesFromPhiRotation.cpp @@ -199,7 +199,7 @@ void GoniometerAnglesFromPhiRotation::exec() { PeaksWorkspace_sptr Peakss = getProperty("PeaksWorkspace2"); if (!Run1HasOrientedLattice) - PeaksRun1->mutableSample().setOrientedLattice(NULL); + PeaksRun1->mutableSample().setOrientedLattice(nullptr); double dphi = (double)getProperty("Phi2") - (double)getProperty("Run1Phi"); Kernel::Matrix<double> Gon22(3, 3, true); diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index 92558503c80..d64676ab04a 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -188,7 +188,7 @@ void IntegratePeakTimeSlices::init() { void IntegratePeakTimeSlices::exec() { time_t seconds1; - seconds1 = time(NULL); + seconds1 = time(nullptr); double dQ = getProperty("PeakQspan"); @@ -630,7 +630,7 @@ void IntegratePeakTimeSlices::exec() { setProperty("SigmaIntensity", SQRT(TotVariance)); time_t seconds2; - seconds2 = time(NULL); + seconds2 = time(nullptr); double dif = difftime(seconds2, seconds1); g_log.debug() << "Finished Integr peak number " << indx << " in " << dif << " seconds" << std::endl; diff --git a/Framework/Crystal/src/LoadHKL.cpp b/Framework/Crystal/src/LoadHKL.cpp index f58e8609a83..28606a89686 100644 --- a/Framework/Crystal/src/LoadHKL.cpp +++ b/Framework/Crystal/src/LoadHKL.cpp @@ -59,7 +59,7 @@ void LoadHKL::exec() { // DN, TWOTH, DSP)) // HKL is flipped by -1 due to different q convention in ISAW vs mantid. Instrument_sptr inst(new Geometry::Instrument); - Detector *detector = new Detector("det1", -1, 0); + Detector *detector = new Detector("det1", -1, nullptr); detector->setPos(0.0, 0.0, 0.0); inst->add(detector); // This takes care of deletion inst->markAsDetector(detector); diff --git a/Framework/Crystal/src/LoadIsawPeaks.cpp b/Framework/Crystal/src/LoadIsawPeaks.cpp index 839acbadf6f..0987169c2f7 100644 --- a/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -373,23 +373,23 @@ DataObjects::Peak LoadIsawPeaks::readPeak(PeaksWorkspace_sptr outWS, seqNum = atoi(getWord(in, false).c_str()); - h = strtod(getWord(in, false).c_str(), 0); - k = strtod(getWord(in, false).c_str(), 0); - l = strtod(getWord(in, false).c_str(), 0); - - col = strtod(getWord(in, false).c_str(), 0); - row = strtod(getWord(in, false).c_str(), 0); - strtod(getWord(in, false).c_str(), 0); // chan - strtod(getWord(in, false).c_str(), 0); // L2 - strtod(getWord(in, false).c_str(), 0); // ScatAng - - strtod(getWord(in, false).c_str(), 0); // Az - wl = strtod(getWord(in, false).c_str(), 0); - strtod(getWord(in, false).c_str(), 0); // D - IPK = strtod(getWord(in, false).c_str(), 0); - - Inti = strtod(getWord(in, false).c_str(), 0); - SigI = strtod(getWord(in, false).c_str(), 0); + h = strtod(getWord(in, false).c_str(), nullptr); + k = strtod(getWord(in, false).c_str(), nullptr); + l = strtod(getWord(in, false).c_str(), nullptr); + + col = strtod(getWord(in, false).c_str(), nullptr); + row = strtod(getWord(in, false).c_str(), nullptr); + strtod(getWord(in, false).c_str(), nullptr); // chan + strtod(getWord(in, false).c_str(), nullptr); // L2 + strtod(getWord(in, false).c_str(), nullptr); // ScatAng + + strtod(getWord(in, false).c_str(), nullptr); // Az + wl = strtod(getWord(in, false).c_str(), nullptr); + strtod(getWord(in, false).c_str(), nullptr); // D + IPK = strtod(getWord(in, false).c_str(), nullptr); + + Inti = strtod(getWord(in, false).c_str(), nullptr); + SigI = strtod(getWord(in, false).c_str(), nullptr); static_cast<void>(atoi(getWord(in, false).c_str())); // iReflag // Finish the line and get the first word of next line @@ -486,11 +486,11 @@ std::string LoadIsawPeaks::readPeakBlockHeader(std::string lastStr, run = atoi(getWord(in, false).c_str()); detName = atoi(getWord(in, false).c_str()); - chi = strtod(getWord(in, false).c_str(), 0); - phi = strtod(getWord(in, false).c_str(), 0); + chi = strtod(getWord(in, false).c_str(), nullptr); + phi = strtod(getWord(in, false).c_str(), nullptr); - omega = strtod(getWord(in, false).c_str(), 0); - monCount = strtod(getWord(in, false).c_str(), 0); + omega = strtod(getWord(in, false).c_str(), nullptr); + monCount = strtod(getWord(in, false).c_str(), nullptr); readToEndOfLine(in, true); return getWord(in, false); diff --git a/Framework/Crystal/src/LoadIsawUB.cpp b/Framework/Crystal/src/LoadIsawUB.cpp index a4521d204b6..e3679a360f9 100644 --- a/Framework/Crystal/src/LoadIsawUB.cpp +++ b/Framework/Crystal/src/LoadIsawUB.cpp @@ -57,7 +57,7 @@ void LoadIsawUB::exec() { ExperimentInfo_sptr ws; IMDEventWorkspace_sptr MDWS = boost::dynamic_pointer_cast<IMDEventWorkspace>(ws1); - if (MDWS != NULL) { + if (MDWS != nullptr) { ws = MDWS->getExperimentInfo(0); } else { ws = boost::dynamic_pointer_cast<ExperimentInfo>(ws1); @@ -126,7 +126,7 @@ void LoadIsawUB::exec() { ws->mutableSample().setOrientedLattice(latt); // Save it to every experiment info in MD workspaces - if ((MDWS != NULL) && (MDWS->getNumExperimentInfo() > 1)) { + if ((MDWS != nullptr) && (MDWS->getNumExperimentInfo() > 1)) { for (uint16_t i = 1; i < MDWS->getNumExperimentInfo(); i++) { ws = MDWS->getExperimentInfo(i); ws->mutableSample().setOrientedLattice(latt); diff --git a/Framework/Crystal/src/OptimizeExtinctionParameters.cpp b/Framework/Crystal/src/OptimizeExtinctionParameters.cpp index f5231395207..44c9e7b4a85 100644 --- a/Framework/Crystal/src/OptimizeExtinctionParameters.cpp +++ b/Framework/Crystal/src/OptimizeExtinctionParameters.cpp @@ -119,7 +119,7 @@ void OptimizeExtinctionParameters::exec() { par[3] = strwi.str(); const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex; - gsl_multimin_fminimizer *s = NULL; + gsl_multimin_fminimizer *s = nullptr; gsl_vector *ss, *x; gsl_multimin_function minex_func; diff --git a/Framework/Crystal/src/PeakIntegration.cpp b/Framework/Crystal/src/PeakIntegration.cpp index 07ab9a5b913..f0b5c7a4d2d 100644 --- a/Framework/Crystal/src/PeakIntegration.cpp +++ b/Framework/Crystal/src/PeakIntegration.cpp @@ -94,7 +94,7 @@ void PeakIntegration::exec() { EventWorkspace_const_sptr inWS = boost::dynamic_pointer_cast<const EventWorkspace>(inputW); if (inWS) { - inWS->sortAll(TOF_SORT, NULL); + inWS->sortAll(TOF_SORT, nullptr); } // Get some stuff from the input workspace diff --git a/Framework/Crystal/src/SaveIsawUB.cpp b/Framework/Crystal/src/SaveIsawUB.cpp index d9b2f4b3545..7e79a5c1a9d 100644 --- a/Framework/Crystal/src/SaveIsawUB.cpp +++ b/Framework/Crystal/src/SaveIsawUB.cpp @@ -93,7 +93,7 @@ void SaveIsawUB::exec() { ExperimentInfo_sptr ws; IMDEventWorkspace_sptr MDWS = boost::dynamic_pointer_cast<IMDEventWorkspace>(ws1); - if (MDWS != NULL) { + if (MDWS != nullptr) { ws = MDWS->getExperimentInfo(0); } else { ws = boost::dynamic_pointer_cast<ExperimentInfo>(ws1); diff --git a/Framework/Crystal/src/SetUB.cpp b/Framework/Crystal/src/SetUB.cpp index 3303c2f5d32..e4bb51e9678 100644 --- a/Framework/Crystal/src/SetUB.cpp +++ b/Framework/Crystal/src/SetUB.cpp @@ -124,7 +124,7 @@ void SetUB::exec() { // Sample copy; IMDEventWorkspace_sptr mdws = boost::dynamic_pointer_cast<IMDEventWorkspace>(ws); - if (mdws != NULL) { + if (mdws != nullptr) { int sampleNumber = getProperty("MDSampleNumber"); if ((sampleNumber == EMPTY_INT()) || (sampleNumber < 0)) // copy to all samples diff --git a/Framework/Crystal/src/SortPeaksWorkspace.cpp b/Framework/Crystal/src/SortPeaksWorkspace.cpp index 61f7d502290..c8047e7245a 100644 --- a/Framework/Crystal/src/SortPeaksWorkspace.cpp +++ b/Framework/Crystal/src/SortPeaksWorkspace.cpp @@ -59,9 +59,9 @@ void SortPeaksWorkspace::init() { PeaksWorkspace_sptr SortPeaksWorkspace::tryFetchOutputWorkspace() const { IPeaksWorkspace_sptr temp = getProperty("OutputWorkspace"); PeaksWorkspace_sptr outputWS; - if (temp != NULL) { + if (temp != nullptr) { outputWS = boost::dynamic_pointer_cast<PeaksWorkspace>(temp); - if (outputWS == NULL) { + if (outputWS == nullptr) { throw std::invalid_argument("OutputWorkspace is not a PeaksWorkspace."); } } @@ -72,7 +72,7 @@ PeaksWorkspace_sptr SortPeaksWorkspace::tryFetchInputWorkspace() const { IPeaksWorkspace_sptr temp = getProperty("InputWorkspace"); PeaksWorkspace_sptr inputWS = boost::dynamic_pointer_cast<PeaksWorkspace>(temp); - if (inputWS == NULL) { + if (inputWS == nullptr) { throw std::invalid_argument("InputWorkspace is not a PeaksWorkspace."); } return inputWS; diff --git a/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp index 2586dd49c2a..a47307980ff 100644 --- a/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateGammaBackground.cpp @@ -54,7 +54,7 @@ CalculateGammaBackground::CalculateGammaBackground() : Algorithm(), m_inputWS(), m_indices(), m_profileFunction(), m_npeaks(0), m_reversed(), m_samplePos(), m_l1(0.0), m_foilRadius(0.0), m_foilUpMin(0.0), m_foilUpMax(0.0), m_foils0(), m_foils1(), - m_backgroundWS(), m_correctedWS(), m_progress(NULL) {} + m_backgroundWS(), m_correctedWS(), m_progress(nullptr) {} /// Destructor CalculateGammaBackground::~CalculateGammaBackground() { diff --git a/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp index fe23d129f2d..1d2015159b2 100644 --- a/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp +++ b/Framework/CurveFitting/src/Algorithms/CalculateMSVesuvio.cpp @@ -51,13 +51,13 @@ DECLARE_ALGORITHM(CalculateMSVesuvio) /// Constructor CalculateMSVesuvio::CalculateMSVesuvio() - : Algorithm(), m_randgen(NULL), m_acrossIdx(0), m_upIdx(1), m_beamIdx(3), + : Algorithm(), m_randgen(nullptr), m_acrossIdx(0), m_upIdx(1), m_beamIdx(3), m_beamDir(), m_srcR2(0.0), m_halfSampleHeight(0.0), - m_halfSampleWidth(0.0), m_halfSampleThick(0.0), m_sampleShape(NULL), - m_sampleProps(NULL), m_detHeight(-1.0), m_detWidth(-1.0), + m_halfSampleWidth(0.0), m_halfSampleThick(0.0), m_sampleShape(nullptr), + m_sampleProps(nullptr), m_detHeight(-1.0), m_detWidth(-1.0), m_detThick(-1.0), m_tmin(-1.0), m_tmax(-1.0), m_delt(-1.0), m_foilRes(-1.0), m_nscatters(0), m_nruns(0), m_nevents(0), - m_progress(NULL), m_inputWS() {} + m_progress(nullptr), m_inputWS() {} /// Destructor CalculateMSVesuvio::~CalculateMSVesuvio() { diff --git a/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp index 860d527201a..99cba60f9ec 100644 --- a/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp +++ b/Framework/CurveFitting/src/Algorithms/ConvolveWorkspaces.cpp @@ -17,7 +17,7 @@ namespace Algorithms { DECLARE_ALGORITHM(ConvolveWorkspaces) /// Constructor -ConvolveWorkspaces::ConvolveWorkspaces() : API::Algorithm(), prog(NULL) {} +ConvolveWorkspaces::ConvolveWorkspaces() : API::Algorithm(), prog(nullptr) {} /// Virtual destructor ConvolveWorkspaces::~ConvolveWorkspaces() { delete prog; } diff --git a/Framework/CurveFitting/src/Algorithms/Fit1D.cpp b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp index 3e5187b44c4..5dc297bf0f9 100644 --- a/Framework/CurveFitting/src/Algorithms/Fit1D.cpp +++ b/Framework/CurveFitting/src/Algorithms/Fit1D.cpp @@ -35,7 +35,7 @@ using API::Jacobian; class JacobianImpl : public Jacobian { public: /// Default constructor - JacobianImpl() : Jacobian(), m_J(NULL){}; + JacobianImpl() : Jacobian(), m_J(nullptr){}; /// The index map std::map<int, int> m_map; @@ -315,7 +315,7 @@ void Fit1D::exec() { // check if derivative defined in derived class bool isDerivDefined = true; - gsl_matrix *M = NULL; + gsl_matrix *M = nullptr; try { const std::vector<double> inTest(m_parameterNames.size(), 1.0); std::vector<double> outTest(m_parameterNames.size()); @@ -491,7 +491,7 @@ void Fit1D::exec() { // set-up remaining GSL machinery for least squared const gsl_multifit_fdfsolver_type *T = gsl_multifit_fdfsolver_lmsder; - gsl_multifit_fdfsolver *s = NULL; + gsl_multifit_fdfsolver *s = nullptr; if (isDerivDefined) { s = gsl_multifit_fdfsolver_alloc(T, l_data.n, l_data.p); gsl_multifit_fdfsolver_set(s, &f, initFuncArg); @@ -501,8 +501,8 @@ void Fit1D::exec() { const gsl_multimin_fminimizer_type *simplexType = gsl_multimin_fminimizer_nmsimplex; - gsl_multimin_fminimizer *simplexMinimizer = NULL; - gsl_vector *simplexStepSize = NULL; + gsl_multimin_fminimizer *simplexMinimizer = nullptr; + gsl_vector *simplexStepSize = nullptr; if (!isDerivDefined) { simplexMinimizer = gsl_multimin_fminimizer_alloc(simplexType, l_data.p); simplexStepSize = gsl_vector_alloc(l_data.p); @@ -589,7 +589,7 @@ void Fit1D::exec() { if (!output.empty()) { // calculate covariance matrix if derivatives available - gsl_matrix *covar(NULL); + gsl_matrix *covar(nullptr); std::vector<double> standardDeviations; std::vector<double> sdExtended; if (isDerivDefined) { @@ -751,8 +751,8 @@ void Fit1D::exec() { * @param fixed :: A list of comma separated names of the fixed parameters. */ FitData::FitData(Fit1D *fit, const std::string &fixed) - : n(0), X(NULL), Y(NULL), sigmaData(NULL), fit1D(fit), - forSimplexLSwrap(NULL), parameters(NULL) { + : n(0), X(nullptr), Y(nullptr), sigmaData(nullptr), fit1D(fit), + forSimplexLSwrap(nullptr), parameters(nullptr) { typedef boost::tokenizer<boost::char_separator<char>> tokenizer; boost::char_separator<char> sep(","); boost::tokenizer<boost::char_separator<char>> names(fixed, sep); diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 91212a986ea..4db7cffda5d 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -1449,7 +1449,7 @@ void LeBailFit::createOutputDataWorkspace() { // 4. Set axis m_outputWS->getAxis(0)->setUnit("TOF"); - API::TextAxis *tAxis = 0; + API::TextAxis *tAxis = nullptr; tAxis = new API::TextAxis(nspec); tAxis->setLabel(0, "Data"); tAxis->setLabel(1, "Calc"); diff --git a/Framework/CurveFitting/src/FitMW.cpp b/Framework/CurveFitting/src/FitMW.cpp index bbe2dac42bb..e659155e45f 100644 --- a/Framework/CurveFitting/src/FitMW.cpp +++ b/Framework/CurveFitting/src/FitMW.cpp @@ -86,7 +86,7 @@ FitMW::FitMW(Kernel::IPropertyManager *fit, * @param domainType :: Type of the domain: Simple, Sequential, or Parallel. */ FitMW::FitMW(FitMW::DomainType domainType) - : API::IDomainCreator(NULL, std::vector<std::string>(), domainType), + : API::IDomainCreator(nullptr, std::vector<std::string>(), domainType), m_workspaceIndex(-1), m_startX(EMPTY_DBL()), m_endX(EMPTY_DBL()), m_maxSize(10), m_normalise(false), m_startIndex(0) {} diff --git a/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp index 5f54e75d6d7..116bb1829f7 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/DerivMinimizer.cpp @@ -79,7 +79,7 @@ void DerivMinimizer::fundfun(const gsl_vector *x, void *params, double *f, /// Constructor DerivMinimizer::DerivMinimizer() - : m_gslSolver(NULL), m_x(NULL), m_stopGradient(1e-3), m_stepSize(0.1), + : m_gslSolver(nullptr), m_x(nullptr), m_stopGradient(1e-3), m_stepSize(0.1), m_tolerance(0.0001) { initGSLMMin(); } @@ -90,24 +90,24 @@ DerivMinimizer::DerivMinimizer() * @param tolerance :: Tolerance. */ DerivMinimizer::DerivMinimizer(const double stepSize, const double tolerance) - : m_gslSolver(NULL), m_x(NULL), m_stopGradient(1e-3), m_stepSize(stepSize), + : m_gslSolver(nullptr), m_x(nullptr), m_stopGradient(1e-3), m_stepSize(stepSize), m_tolerance(tolerance) { initGSLMMin(); } void DerivMinimizer::initGSLMMin() { - m_gslMultiminContainer.f = NULL; - m_gslMultiminContainer.df = NULL; - m_gslMultiminContainer.fdf = NULL; + m_gslMultiminContainer.f = nullptr; + m_gslMultiminContainer.df = nullptr; + m_gslMultiminContainer.fdf = nullptr; m_gslMultiminContainer.n = 0; - m_gslMultiminContainer.params = NULL; + m_gslMultiminContainer.params = nullptr; } /** * Destructor. */ DerivMinimizer::~DerivMinimizer() { - if (m_gslSolver != NULL) { + if (m_gslSolver != nullptr) { gsl_multimin_fdfminimizer_free(m_gslSolver); gsl_vector_free(m_x); } @@ -147,7 +147,7 @@ void DerivMinimizer::initialize(API::ICostFunction_sptr function, * @return :: true to continue, false to stop. */ bool DerivMinimizer::iterate(size_t) { - if (m_gslSolver == NULL) { + if (m_gslSolver == nullptr) { throw std::runtime_error("Minimizer " + this->name() + " was not initialized."); } diff --git a/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp index df84cfc9f62..11d283e4b35 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/LevenbergMarquardtMinimizer.cpp @@ -27,7 +27,7 @@ DECLARE_FUNCMINIMIZER(LevenbergMarquardtMinimizer, Levenberg-Marquardt) // clang-format on LevenbergMarquardtMinimizer::LevenbergMarquardtMinimizer() - : m_data(NULL), gslContainer(), m_gslSolver(NULL), m_function(), + : m_data(nullptr), gslContainer(), m_gslSolver(nullptr), m_function(), m_absError(1e-4), m_relError(1e-4) { declareProperty("AbsError", m_absError, "Absolute error allowed for " "parameters - a stopping parameter " diff --git a/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp index e9399ae13f1..351b553e85a 100644 --- a/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp +++ b/Framework/CurveFitting/src/FuncMinimizers/SimplexMinimizer.cpp @@ -42,11 +42,11 @@ double SimplexMinimizer::fun(const gsl_vector *x, void *params) { } SimplexMinimizer::SimplexMinimizer(const double epsabs) - : m_epsabs(epsabs), m_costFunction(), m_size(1.0), m_simplexStepSize(NULL), - m_startGuess(NULL), m_gslSolver(NULL) { - gslContainer.f = NULL; + : m_epsabs(epsabs), m_costFunction(), m_size(1.0), m_simplexStepSize(nullptr), + m_startGuess(nullptr), m_gslSolver(nullptr) { + gslContainer.f = nullptr; gslContainer.n = -1; - gslContainer.params = NULL; + gslContainer.params = nullptr; } void SimplexMinimizer::initialize(API::ICostFunction_sptr function, size_t) { diff --git a/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp b/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp index 67cf46775e3..d34c4b8cbcf 100644 --- a/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp +++ b/Framework/CurveFitting/src/FunctionDomain1DSpectrumCreator.cpp @@ -11,7 +11,7 @@ using namespace API; * Default Constructor. */ FunctionDomain1DSpectrumCreator::FunctionDomain1DSpectrumCreator() - : IDomainCreator(NULL, std::vector<std::string>(), + : IDomainCreator(nullptr, std::vector<std::string>(), FunctionDomain1DSpectrumCreator::Simple), m_matrixWorkspace(), m_workspaceIndex(0), m_workspaceIndexIsSet(false) {} diff --git a/Framework/CurveFitting/src/Functions/BivariateNormal.cpp b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp index 59918f5e1e5..97da28e6100 100644 --- a/Framework/CurveFitting/src/Functions/BivariateNormal.cpp +++ b/Framework/CurveFitting/src/Functions/BivariateNormal.cpp @@ -56,7 +56,7 @@ BivariateNormal::BivariateNormal() : API::ParamFunction(), CalcVxx(false), CalcVyy(false), CalcVxy(false), NCells(0), CalcVariances(false), mIx(0.0), mx(0.0), mIy(0.0), my(0.0), SIxx(0.0), SIyy(0.0), SIxy(0.0), Sxx(0.0), Syy(0.0), Sxy(0.0), TotI(0.0), - TotN(0.0), Varx0(-1.0), Vary0(-1.0), expVals(NULL), uu(0.0), + TotN(0.0), Varx0(-1.0), Vary0(-1.0), expVals(nullptr), uu(0.0), coefNorm(0.0), expCoeffx2(0.0), expCoeffy2(0.0), expCoeffxy(0.0) { LastParams[IVXX] = -1; Varx0 = -1; @@ -471,7 +471,7 @@ double BivariateNormal::initCommon() { // CommonsOK = false; - if (getConstraint(0) == NULL) { + if (getConstraint(0) == nullptr) { addConstraint((new BoundaryConstraint(this, "Background", 0, Attrib[S_int] / Attrib[S_1]))); @@ -482,20 +482,20 @@ double BivariateNormal::initCommon() { if (maxIntensity < 100) maxIntensity = 100; - if (getConstraint(1) == NULL) { + if (getConstraint(1) == nullptr) { addConstraint(new BoundaryConstraint(this, "Intensity", 0, maxIntensity)); } double minMeany = MinY * .9 + .1 * MaxY; double maxMeany = MinY * .1 + .9 * MaxY; - if (getConstraint(3) == NULL) { + if (getConstraint(3) == nullptr) { addConstraint(new BoundaryConstraint(this, "Mrow", minMeany, maxMeany)); } double minMeanx = MinX * .9 + .1 * MaxX; double maxMeanx = MinX * .1 + .9 * MaxX; - if (getConstraint(2) == NULL) { + if (getConstraint(2) == nullptr) { addConstraint(new BoundaryConstraint(this, "Mcol", minMeanx, maxMeanx)); } @@ -508,7 +508,7 @@ double BivariateNormal::initCommon() { << Attrib[S_1] << ")/(" << (Attrib[S_int]) << "-Background*" << (Attrib[S_1]) << ")"; - if (getTie(IVYY) == NULL) { + if (getTie(IVYY) == nullptr) { tie("SSrow", ssyy.str()); CalcVxx = true; } @@ -519,7 +519,7 @@ double BivariateNormal::initCommon() { << Attrib[S_1] << ")/(" << (Attrib[S_int]) << "-Background*" << (Attrib[S_1]) << ")"; - if (getTie(IVXX) == NULL) { + if (getTie(IVXX) == nullptr) { tie("SScol", ssxx.str()); CalcVyy = true; } @@ -530,7 +530,7 @@ double BivariateNormal::initCommon() { << Attrib[S_1] << ")/(" << (Attrib[S_int]) << "-Background*" << (Attrib[S_1]) << ")"; - if (getTie(IVXY) == NULL) { + if (getTie(IVXY) == nullptr) { tie("SSrc", ssxy.str()); CalcVxy = true; } diff --git a/Framework/CurveFitting/src/Functions/Convolution.cpp b/Framework/CurveFitting/src/Functions/Convolution.cpp index 3040b82b33a..0042fb41cef 100644 --- a/Framework/CurveFitting/src/Functions/Convolution.cpp +++ b/Framework/CurveFitting/src/Functions/Convolution.cpp @@ -301,7 +301,7 @@ size_t Convolution::addFunction(IFunction_sptr f) { } CompositeFunction_sptr cf = boost::dynamic_pointer_cast<CompositeFunction>(f1); - if (cf == 0) { + if (cf == nullptr) { cf = boost::dynamic_pointer_cast<CompositeFunction>( API::FunctionFactory::Instance().createFunction("CompositeFunction")); removeFunction(1); diff --git a/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp index 519f78976bd..bb1900006b2 100644 --- a/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp +++ b/Framework/CurveFitting/src/Functions/IkedaCarpenterPV.cpp @@ -144,7 +144,7 @@ void IkedaCarpenterPV::calWavelengthAtEachDataPoint(const double *xValues, API::MatrixWorkspace_const_sptr mws = getMatrixWorkspace(); Instrument_const_sptr instrument = mws->getInstrument(); Geometry::IComponent_const_sptr sample = instrument->getSample(); - if (sample != NULL) { + if (sample != nullptr) { convertValue(m_waveLength, wavelength, mws, m_workspaceIndex); } else { g_log.warning() diff --git a/Framework/CurveFitting/src/Functions/Voigt.cpp b/Framework/CurveFitting/src/Functions/Voigt.cpp index 73ce3f49f99..b040d0f95f0 100644 --- a/Framework/CurveFitting/src/Functions/Voigt.cpp +++ b/Framework/CurveFitting/src/Functions/Voigt.cpp @@ -54,7 +54,7 @@ void Voigt::declareParameters() { */ void Voigt::functionLocal(double *out, const double *xValues, const size_t nData) const { - calculateFunctionAndDerivative(xValues, nData, out, NULL); + calculateFunctionAndDerivative(xValues, nData, out, nullptr); } /** @@ -66,7 +66,7 @@ void Voigt::functionLocal(double *out, const double *xValues, */ void Voigt::functionDerivLocal(API::Jacobian *out, const double *xValues, const size_t nData) { - calculateFunctionAndDerivative(xValues, nData, NULL, out); + calculateFunctionAndDerivative(xValues, nData, nullptr, out); } /** diff --git a/Framework/CurveFitting/src/GSLMatrix.cpp b/Framework/CurveFitting/src/GSLMatrix.cpp index 0e1b8954716..b502c185c67 100644 --- a/Framework/CurveFitting/src/GSLMatrix.cpp +++ b/Framework/CurveFitting/src/GSLMatrix.cpp @@ -8,7 +8,7 @@ namespace Mantid { namespace CurveFitting { /// Constructor -GSLMatrix::GSLMatrix() : m_matrix(NULL) {} +GSLMatrix::GSLMatrix() : m_matrix(nullptr) {} /// Constructor /// @param nx :: First dimension /// @param ny :: Second dimension @@ -52,13 +52,13 @@ GSLMatrix::GSLMatrix(const Kernel::Matrix<double> &M) { /// Create this matrix from a product of two other matrices /// @param mult2 :: Matrix multiplication helper object. -GSLMatrix::GSLMatrix(const GSLMatrixMult2 &mult2) : m_matrix(NULL) { +GSLMatrix::GSLMatrix(const GSLMatrixMult2 &mult2) : m_matrix(nullptr) { *this = mult2; } /// Create this matrix from a product of three other matrices /// @param mult3 :: Matrix multiplication helper object. -GSLMatrix::GSLMatrix(const GSLMatrixMult3 &mult3) : m_matrix(NULL) { +GSLMatrix::GSLMatrix(const GSLMatrixMult3 &mult3) : m_matrix(nullptr) { *this = mult3; } @@ -77,7 +77,7 @@ GSLMatrix &GSLMatrix::operator=(const GSLMatrix &M) { } /// Is matrix empty -bool GSLMatrix::isEmpty() const { return m_matrix == NULL; } +bool GSLMatrix::isEmpty() const { return m_matrix == nullptr; } /// Resize the matrix /// @param nx :: New first dimension diff --git a/Framework/CurveFitting/src/IFittingAlgorithm.cpp b/Framework/CurveFitting/src/IFittingAlgorithm.cpp index 4984b1edc74..6f9ddf437c2 100644 --- a/Framework/CurveFitting/src/IFittingAlgorithm.cpp +++ b/Framework/CurveFitting/src/IFittingAlgorithm.cpp @@ -27,7 +27,7 @@ IDomainCreator *createDomainCreator(const IFunction *fun, const Workspace *ws, IPropertyManager *manager, IDomainCreator::DomainType domainType) { - IDomainCreator *creator = NULL; + IDomainCreator *creator = nullptr; // ILatticeFunction requires API::LatticeDomain. if (dynamic_cast<const ILatticeFunction *>(fun)) { diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index b0842ee648f..9af2254bf4c 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -201,8 +201,8 @@ static string generateMappingfileName(EventWorkspace_sptr &wksp) { /** Constructor */ FilterEventsByLogValuePreNexus::FilterEventsByLogValuePreNexus() - : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), m_prog(NULL), - m_protonChargeTot(0), m_detid_max(0), m_eventFile(NULL), m_numEvents(0), + : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), m_prog(nullptr), + m_protonChargeTot(0), m_detid_max(0), m_eventFile(nullptr), m_numEvents(0), m_numPulses(0), m_numPixel(0), m_numGoodEvents(0), m_numErrorEvents(0), m_numBadEvents(0), m_numWrongdetidEvents(0), m_numIgnoredEvents(0), m_firstEvent(0), m_maxNumEvents(0), m_usingMappingFile(false), diff --git a/Framework/DataHandling/src/FindDetectorsPar.cpp b/Framework/DataHandling/src/FindDetectorsPar.cpp index 54a55db2173..ff4a4a88501 100644 --- a/Framework/DataHandling/src/FindDetectorsPar.cpp +++ b/Framework/DataHandling/src/FindDetectorsPar.cpp @@ -67,7 +67,7 @@ void FindDetectorsPar::exec() { // Get the input workspace const MatrixWorkspace_sptr inputWS = this->getProperty("InputWorkspace"); - if (inputWS.get() == NULL) { + if (inputWS.get() == nullptr) { throw(Kernel::Exception::NotFoundError( "can not obtain InoputWorkspace for the algorithm to work", "")); } diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 5fb850d4c53..aef71f842b3 100644 --- a/Framework/DataHandling/src/GroupDetectors2.cpp +++ b/Framework/DataHandling/src/GroupDetectors2.cpp @@ -106,7 +106,7 @@ void GroupDetectors2::exec() { const bool preserveEvents = getProperty("PreserveEvents"); EventWorkspace_const_sptr eventW = boost::dynamic_pointer_cast<const EventWorkspace>(inputWS); - if (eventW != NULL && preserveEvents) { + if (eventW != nullptr && preserveEvents) { this->execEvent(); return; } diff --git a/Framework/DataHandling/src/ISISRunLogs.cpp b/Framework/DataHandling/src/ISISRunLogs.cpp index 5502c31b438..477b03bcc40 100644 --- a/Framework/DataHandling/src/ISISRunLogs.cpp +++ b/Framework/DataHandling/src/ISISRunLogs.cpp @@ -35,7 +35,7 @@ ISISRunLogs::ISISRunLogs(const API::Run &icpRun, const int totalNumPeriods) } // If it does not exist then pass in a NULL log to indicate that period 1 // should be assumed - m_logParser.reset(new LogParser(NULL)); + m_logParser.reset(new LogParser(nullptr)); } /** @@ -53,8 +53,8 @@ void ISISRunLogs::addStatusLog(API::Run &exptRun) { */ void ISISRunLogs::addPeriodLogs(const int period, API::Run &exptRun) { auto periodLog = m_logParser->createPeriodLog(period); - LogFilter *logFilter(NULL); - const TimeSeriesProperty<bool> *maskProp(NULL); + LogFilter *logFilter(nullptr); + const TimeSeriesProperty<bool> *maskProp(nullptr); try { auto runningLog = exptRun.getTimeSeriesProperty<bool>(LogParser::statusLogName()); diff --git a/Framework/DataHandling/src/LoadANSTOHelper.cpp b/Framework/DataHandling/src/LoadANSTOHelper.cpp index 17d5c6f83bc..47f7b8ca9ba 100644 --- a/Framework/DataHandling/src/LoadANSTOHelper.cpp +++ b/Framework/DataHandling/src/LoadANSTOHelper.cpp @@ -148,7 +148,7 @@ FastReadOnlyFile::FastReadOnlyFile(const char *filename) { } FastReadOnlyFile::~FastReadOnlyFile() { fclose(m_handle); - m_handle = NULL; + m_handle = nullptr; } void *FastReadOnlyFile::handle() const { return m_handle; } bool FastReadOnlyFile::read(void *buffer, uint32_t size) { @@ -156,7 +156,7 @@ bool FastReadOnlyFile::read(void *buffer, uint32_t size) { } bool FastReadOnlyFile::seek(int64_t offset, int whence, int64_t *newPosition) { return (0 == fseek(m_handle, offset, whence)) && - ((newPosition == NULL) || + ((newPosition == nullptr) || (0 <= (*newPosition = (int64_t)ftell(m_handle)))); } #endif @@ -179,7 +179,7 @@ File::File(const std::string &path) : m_good(true), m_file(path.c_str()), m_selected((size_t)-1), m_position(0), m_size(0), m_bufferPosition(0), m_bufferAvailable(0) { - m_good = m_file.handle() != NULL; + m_good = m_file.handle() != nullptr; while (m_good) { EntryHeader header; int64_t position; diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index 284ed879bc6..9d4d109d4c0 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -28,7 +28,7 @@ using namespace API; LoadAscii2::LoadAscii2() : m_columnSep(), m_separatorIndex(), m_comment(), m_baseCols(0), m_specNo(0), m_lastBins(0), m_curBins(0), m_spectraStart(), - m_spectrumIDcount(0), m_lineNo(0), m_spectra(), m_curSpectra(NULL) {} + m_spectrumIDcount(0), m_lineNo(0), m_spectra(), m_curSpectra(nullptr) {} /** * Return the confidence with with this algorithm can load the file diff --git a/Framework/DataHandling/src/LoadBBY.cpp b/Framework/DataHandling/src/LoadBBY.cpp index fb62c22096f..f0812399d95 100644 --- a/Framework/DataHandling/src/LoadBBY.cpp +++ b/Framework/DataHandling/src/LoadBBY.cpp @@ -247,7 +247,7 @@ void LoadBBY::exec() { // load events size_t numberHistograms = eventWS->getNumberHistograms(); - std::vector<EventVector_pt> eventVectors(numberHistograms, NULL); + std::vector<EventVector_pt> eventVectors(numberHistograms, nullptr); std::vector<size_t> eventCounts(numberHistograms, 0); // phase correction diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 083ce280b05..749f29fbba6 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -34,7 +34,7 @@ DECLARE_ALGORITHM(LoadDetectorsGroupingFile) /** Constructor */ LoadDetectorsGroupingFile::LoadDetectorsGroupingFile() - : m_groupWS(), m_instrument(), m_pDoc(NULL), m_pRootElem(NULL), + : m_groupWS(), m_instrument(), m_pDoc(nullptr), m_pRootElem(nullptr), m_groupComponentsMap(), m_groupDetectorsMap(), m_groupSpectraMap() {} //---------------------------------------------------------------------------------------------- @@ -408,7 +408,7 @@ void LoadDetectorsGroupingFile::generateNoInstrumentGroupWorkspace() { LoadGroupXMLFile::LoadGroupXMLFile() : m_instrumentName(""), m_userGiveInstrument(false), m_date(""), m_userGiveDate(false), m_description(""), m_userGiveDescription(false), - m_pDoc(NULL), m_pRootElem(NULL), m_groupComponentsMap(), + m_pDoc(nullptr), m_pRootElem(nullptr), m_groupComponentsMap(), m_groupDetectorsMap(), m_groupSpectraMap(), m_startGroupID(1), m_groupNamesMap() {} diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index f20accc92a9..d1f07ac1936 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -111,7 +111,7 @@ BankPulseTimes::BankPulseTimes(::NeXus::File &file, * Handles a zero-sized vector */ BankPulseTimes::BankPulseTimes(const std::vector<Kernel::DateAndTime> ×) { numPulses = times.size(); - pulseTimes = NULL; + pulseTimes = nullptr; if (numPulses == 0) return; pulseTimes = new DateAndTime[numPulses]; @@ -485,8 +485,8 @@ public: // m_loadError(false), prog(prog), scheduler(scheduler), m_loadError(false), m_oldNexusFileNames(oldNeXusFileNames), m_loadStart(), m_loadSize(), - m_event_id(NULL), m_event_time_of_flight(NULL), m_have_weight(false), - m_event_weight(NULL), m_framePeriodNumbers(framePeriodNumbers) { + m_event_id(nullptr), m_event_time_of_flight(nullptr), m_have_weight(false), + m_event_weight(nullptr), m_framePeriodNumbers(framePeriodNumbers) { setMutex(ioMutex); m_cost = static_cast<double>(numEvents); m_min_id = std::numeric_limits<uint32_t>::max(); @@ -802,9 +802,9 @@ public: m_loadSize.resize(1, 0); // Data arrays - m_event_id = NULL; - m_event_time_of_flight = NULL; - m_event_weight = NULL; + m_event_id = nullptr; + m_event_time_of_flight = nullptr; + m_event_weight = nullptr; m_loadError = false; m_have_weight = alg->m_haveWeights; @@ -1020,7 +1020,7 @@ LoadEventNexus::LoadEventNexus() compressTolerance(0), eventVectors(), m_eventVectorMutex(), eventid_max(0), pixelID_to_wi_vector(), pixelID_to_wi_offset(), m_bankPulseTimes(), m_allBanksPulseTimes(), m_top_entry_name(), - m_file(NULL), splitProcessing(false), m_haveWeights(false), + m_file(nullptr), splitProcessing(false), m_haveWeights(false), weightedEventVectors(), m_instrument_loaded_correctly(false), loadlogs(false), m_logs_loaded_correctly(false), event_id_is_spec(false) { } @@ -1394,7 +1394,7 @@ void LoadEventNexus::makeMapToEventLists(std::vector<std::vector<T>> &vectors) { // possible spectrum number eventid_max = maxSpecNo; for (size_t i = 0; i < vectors.size(); ++i) { - vectors[i].resize(maxSpecNo + 1, NULL); + vectors[i].resize(maxSpecNo + 1, nullptr); } for (size_t period = 0; period < m_ws->nPeriods(); ++period) { for (size_t i = 0; i < m_ws->getNumberHistograms(); ++i) { @@ -1414,7 +1414,7 @@ void LoadEventNexus::makeMapToEventLists(std::vector<std::vector<T>> &vectors) { // Make an array where index = pixel ID // Set the value to NULL by default for (size_t i = 0; i < vectors.size(); ++i) { - vectors[i].resize(eventid_max + 1, NULL); + vectors[i].resize(eventid_max + 1, nullptr); } for (size_t j = size_t(pixelID_to_wi_offset); @@ -1660,7 +1660,7 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, nPeriods, periodLog); // This is how many workspaces we are going to make. // Make sure you have a non-NULL m_allBanksPulseTimes - if (m_allBanksPulseTimes == NULL) { + if (m_allBanksPulseTimes == nullptr) { std::vector<DateAndTime> temp; // m_allBanksPulseTimes = new BankPulseTimes(temp); m_allBanksPulseTimes = boost::make_shared<BankPulseTimes>(temp); diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 7b70a3a3ab6..98753da0b9b 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -77,10 +77,10 @@ static const double TOF_CONVERSION = .1; static const double CURRENT_CONVERSION = 1.e-6 / 3600.; LoadEventPreNexus::LoadEventPreNexus() - : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), prog(NULL), + : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), prog(nullptr), spectra_list(), pulsetimes(), event_indices(), proton_charge(), proton_charge_tot(0), pixel_to_wkspindex(), pixelmap(), detid_max(), - eventfile(NULL), num_events(0), num_pulses(0), numpixel(0), + eventfile(nullptr), num_events(0), num_pulses(0), numpixel(0), num_good_events(0), num_error_events(0), num_ignored_events(0), first_event(0), max_events(0), using_mapping_file(false), loadOnlySomeSpectra(false), spectraLoadMap(), longest_tof(0), diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index af47f471d31..4a9c0c3e9c9 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -223,10 +223,10 @@ int LoadEventPreNexus2::confidence(Kernel::FileDescriptor &descriptor) const { /** Constructor */ LoadEventPreNexus2::LoadEventPreNexus2() - : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), prog(NULL), + : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), prog(nullptr), spectra_list(), pulsetimes(), event_indices(), proton_charge(), proton_charge_tot(0), pixel_to_wkspindex(), pixelmap(), detid_max(), - eventfile(NULL), num_events(0), num_pulses(0), numpixel(0), + eventfile(nullptr), num_events(0), num_pulses(0), numpixel(0), num_good_events(0), num_error_events(0), num_bad_events(0), num_wrongdetid_events(0), num_ignored_events(0), first_event(0), max_events(0), using_mapping_file(false), loadOnlySomeSpectra(false), diff --git a/Framework/DataHandling/src/LoadGSS.cpp b/Framework/DataHandling/src/LoadGSS.cpp index d9b527d4be4..72155de7858 100644 --- a/Framework/DataHandling/src/LoadGSS.cpp +++ b/Framework/DataHandling/src/LoadGSS.cpp @@ -107,7 +107,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, std::vector<double> vecX, vecY, vecE; // progress - Progress *prog = NULL; + Progress *prog = nullptr; // Parameters for reading file char currentLine[256]; @@ -145,7 +145,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, while (!input.eof() && input.getline(currentLine, 256)) { // Initialize progress after NSpec is imported - if (nSpec != 0 && prog == NULL) { + if (nSpec != 0 && prog == nullptr) { prog = new Progress(this, 0.0, 1.0, nSpec); } @@ -232,7 +232,7 @@ API::MatrixWorkspace_sptr LoadGSS::loadGSASFile(const std::string &filename, vecY.clear(); vecE.clear(); - if (prog != NULL) + if (prog != nullptr) prog->report(); } diff --git a/Framework/DataHandling/src/LoadHelper.cpp b/Framework/DataHandling/src/LoadHelper.cpp index 0e7ccc4553e..9384d4eae2e 100644 --- a/Framework/DataHandling/src/LoadHelper.cpp +++ b/Framework/DataHandling/src/LoadHelper.cpp @@ -378,7 +378,7 @@ void LoadHelper::recurseAndAddNexusFieldsToWsRun(NXhandle nxfileID, } // test on nxdata type NXfree(&dataBuffer); - dataBuffer = NULL; + dataBuffer = nullptr; } // if (parent_class == "NXData" || parent_class == "NXMonitor") else diff --git a/Framework/DataHandling/src/LoadILL.cpp b/Framework/DataHandling/src/LoadILL.cpp index 93fc3cba522..4b3223fa384 100644 --- a/Framework/DataHandling/src/LoadILL.cpp +++ b/Framework/DataHandling/src/LoadILL.cpp @@ -171,7 +171,7 @@ int LoadILL::getEPPFromVanadium(const std::string &filenameVanadium, MatrixWorkspace_sptr vanaWS) { int calculatedDetectorElasticPeakPosition = -1; - if (vanaWS != NULL) { + if (vanaWS != nullptr) { // Check if it has been store on the run object for this workspace if (vanaWS->run().hasProperty("EPP")) { diff --git a/Framework/DataHandling/src/LoadISISNexus2.cpp b/Framework/DataHandling/src/LoadISISNexus2.cpp index c93baf6a8f6..ff238d1af84 100644 --- a/Framework/DataHandling/src/LoadISISNexus2.cpp +++ b/Framework/DataHandling/src/LoadISISNexus2.cpp @@ -52,7 +52,7 @@ LoadISISNexus2::LoadISISNexus2() m_monBlockInfo(), m_loadBlockInfo(), m_have_detector(false), m_load_selected_spectra(false), m_specInd2specNum_map(), m_spec2det_map(), m_entrynumber(0), m_tof_data(), m_proton_charge(0.), m_spec(), - m_spec_end(NULL), m_monitors(), m_logCreator(), m_progress(), + m_spec_end(nullptr), m_monitors(), m_logCreator(), m_progress(), m_cppFile() {} /** diff --git a/Framework/DataHandling/src/LoadInstrumentFromRaw.cpp b/Framework/DataHandling/src/LoadInstrumentFromRaw.cpp index a51c6696c8c..38c9985e9c3 100644 --- a/Framework/DataHandling/src/LoadInstrumentFromRaw.cpp +++ b/Framework/DataHandling/src/LoadInstrumentFromRaw.cpp @@ -55,7 +55,7 @@ void LoadInstrumentFromRaw::exec() { const MatrixWorkspace_sptr localWorkspace = getProperty("Workspace"); // open raw file - ISISRAW iraw(NULL); + ISISRAW iraw(nullptr); if (iraw.readFromFile(m_filename.c_str(), false) != 0) { g_log.error("Unable to open file " + m_filename); throw Exception::FileError("Unable to open File:", m_filename); diff --git a/Framework/DataHandling/src/LoadIsawDetCal.cpp b/Framework/DataHandling/src/LoadIsawDetCal.cpp index 6d1fe37a67a..1fdb0066681 100644 --- a/Framework/DataHandling/src/LoadIsawDetCal.cpp +++ b/Framework/DataHandling/src/LoadIsawDetCal.cpp @@ -412,7 +412,7 @@ void LoadIsawDetCal::center(double x, double y, double z, std::string detname, Instrument_sptr inst = getCheckInst(ws); IComponent_const_sptr comp = inst->getComponentByName(detname); - if (comp == 0) { + if (comp == nullptr) { std::ostringstream mess; mess << "Component with name " << detname << " was not found."; g_log.error(mess.str()); diff --git a/Framework/DataHandling/src/LoadLog.cpp b/Framework/DataHandling/src/LoadLog.cpp index dceaa8cbe11..aa1f1a2a582 100644 --- a/Framework/DataHandling/src/LoadLog.cpp +++ b/Framework/DataHandling/src/LoadLog.cpp @@ -195,8 +195,8 @@ void LoadLog::loadThreeColumnLogFile(std::ifstream &logFileStream, std::string logFileName, API::Run &run) { std::string str; std::string propname; - Mantid::Kernel::TimeSeriesProperty<double> *logd = 0; - Mantid::Kernel::TimeSeriesProperty<std::string> *logs = 0; + Mantid::Kernel::TimeSeriesProperty<double> *logd = nullptr; + Mantid::Kernel::TimeSeriesProperty<std::string> *logs = nullptr; std::map<std::string, Kernel::TimeSeriesProperty<double> *> dMap; std::map<std::string, Kernel::TimeSeriesProperty<std::string> *> sMap; typedef std::pair<std::string, Kernel::TimeSeriesProperty<double> *> dpair; diff --git a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp index 34df470e1b8..fdf3e3c2aa7 100644 --- a/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp +++ b/Framework/DataHandling/src/LoadLogsForSNSPulsedMagnet.cpp @@ -26,7 +26,7 @@ using namespace Mantid::API; LoadLogsForSNSPulsedMagnet::LoadLogsForSNSPulsedMagnet() : m_delaytimefilename(""), m_pulseidfilename(""), m_delayfileinoldformat(false), m_numpulses(0), m_numchoppers(0), - m_delaytimes(NULL), m_pulseidseconds(), m_pulseidnanoseconds(), WS() {} + m_delaytimes(nullptr), m_pulseidseconds(), m_pulseidnanoseconds(), WS() {} //---------------------------------------------------------------------------------------------- /** Destructor diff --git a/Framework/DataHandling/src/LoadMask.cpp b/Framework/DataHandling/src/LoadMask.cpp index 60b3f96cbe0..2f1cb21d26b 100644 --- a/Framework/DataHandling/src/LoadMask.cpp +++ b/Framework/DataHandling/src/LoadMask.cpp @@ -45,7 +45,7 @@ DECLARE_ALGORITHM(LoadMask) /** Constructor */ LoadMask::LoadMask() - : m_maskWS(), m_instrumentPropValue(""), m_pDoc(NULL), m_pRootElem(NULL), + : m_maskWS(), m_instrumentPropValue(""), m_pDoc(nullptr), m_pRootElem(nullptr), m_defaultToUse(true) {} //---------------------------------------------------------------------------------------------- @@ -60,8 +60,8 @@ LoadMask::~LoadMask() { // actually cause a double free corruption, as // Poco::DOM::Document::documentElement() does not require a // release(). So just to be explicit that they're gone: - m_pDoc = NULL; - m_pRootElem = NULL; + m_pDoc = nullptr; + m_pRootElem = nullptr; } /// Initialise the properties diff --git a/Framework/DataHandling/src/LoadMcStas.cpp b/Framework/DataHandling/src/LoadMcStas.cpp index 3b16dd7d066..233a47ce300 100644 --- a/Framework/DataHandling/src/LoadMcStas.cpp +++ b/Framework/DataHandling/src/LoadMcStas.cpp @@ -203,7 +203,7 @@ void LoadMcStas::readEventData( InstrumentDataService::Instance().retrieve(instrumentNameMangled); } else { // Really create the instrument - instrument = parser.parseXML(NULL); + instrument = parser.parseXML(nullptr); // Add to data service for later retrieval InstrumentDataService::Instance().add(instrumentNameMangled, instrument); } diff --git a/Framework/DataHandling/src/LoadMuonNexus2.cpp b/Framework/DataHandling/src/LoadMuonNexus2.cpp index abf0bd22c28..f484cf090e4 100644 --- a/Framework/DataHandling/src/LoadMuonNexus2.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus2.cpp @@ -297,7 +297,7 @@ void LoadMuonNexus2::loadData(const Mantid::NeXus::NXInt &counts, X.assign(timeBins.begin(), timeBins.end()); int nBins = 0; - int *data = NULL; + int *data = nullptr; if (counts.rank() == 3) { nBins = counts.dim2(); diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 6df5f9622fe..0c2f5b5db19 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -431,7 +431,7 @@ void LoadNexusLogs::loadSELog( // value_log - A time series entry. This can contain a corrupt value entry // so if it does use the value one // value - A single value float entry - Kernel::Property *logValue(NULL); + Kernel::Property *logValue(nullptr); std::map<std::string, std::string> entries = file.getEntries(); if (entries.find("value_log") != entries.end()) { try { diff --git a/Framework/DataHandling/src/LoadNexusMonitors2.cpp b/Framework/DataHandling/src/LoadNexusMonitors2.cpp index 8b835b0ad98..1ec8bf099b4 100644 --- a/Framework/DataHandling/src/LoadNexusMonitors2.cpp +++ b/Framework/DataHandling/src/LoadNexusMonitors2.cpp @@ -581,7 +581,7 @@ void LoadNexusMonitors2::runLoadLogs(const std::string filename, **/ bool LoadNexusMonitors2::canOpenAsNeXus(const std::string &fname) { bool res = true; - ::NeXus::File *f = NULL; + ::NeXus::File *f = nullptr; try { f = new ::NeXus::File(fname); if (f) diff --git a/Framework/DataHandling/src/LoadNexusProcessed.cpp b/Framework/DataHandling/src/LoadNexusProcessed.cpp index d468ab64ca8..a1cd54d73ea 100644 --- a/Framework/DataHandling/src/LoadNexusProcessed.cpp +++ b/Framework/DataHandling/src/LoadNexusProcessed.cpp @@ -193,7 +193,7 @@ bool isMultiPeriodFile(int nWorkspaceEntries, Workspace_sptr sampleWS, LoadNexusProcessed::LoadNexusProcessed() : m_shared_bins(false), m_xbins(), m_axis1vals(), m_list(false), m_interval(false), m_spec_min(0), m_spec_max(Mantid::EMPTY_INT()), - m_spec_list(), m_filtered_spec_idxs(), m_cppFile(NULL) {} + m_spec_list(), m_filtered_spec_idxs(), m_cppFile(nullptr) {} /// Delete NexusFileIO in destructor LoadNexusProcessed::~LoadNexusProcessed() { delete m_cppFile; } @@ -1844,11 +1844,11 @@ void LoadNexusProcessed::loadBlock(NXDataSetTyped<double> &data, double *data_end = data_start + nchannels; double *err_start = errors(); double *err_end = err_start + nchannels; - double *farea_start = NULL; - double *farea_end = NULL; + double *farea_start = nullptr; + double *farea_end = nullptr; const int64_t nxbins(m_xbins->size()); - double *xErrors_start = NULL; - double *xErrors_end = NULL; + double *xErrors_start = nullptr; + double *xErrors_end = nullptr; RebinnedOutput_sptr rb_workspace; if (hasFArea) { farea.load(static_cast<int>(blocksize), static_cast<int>(hist)); @@ -1921,11 +1921,11 @@ void LoadNexusProcessed::loadBlock(NXDataSetTyped<double> &data, double *data_end = data_start + nchannels; double *err_start = errors(); double *err_end = err_start + nchannels; - double *farea_start = NULL; - double *farea_end = NULL; + double *farea_start = nullptr; + double *farea_end = nullptr; const int64_t nxbins(m_xbins->size()); - double *xErrors_start = NULL; - double *xErrors_end = NULL; + double *xErrors_start = nullptr; + double *xErrors_end = nullptr; RebinnedOutput_sptr rb_workspace; if (hasFArea) { farea.load(static_cast<int>(blocksize), static_cast<int>(hist)); @@ -1999,10 +1999,10 @@ void LoadNexusProcessed::loadBlock(NXDataSetTyped<double> &data, errors.load(static_cast<int>(blocksize), static_cast<int>(hist)); double *err_start = errors(); double *err_end = err_start + nchannels; - double *farea_start = NULL; - double *farea_end = NULL; - double *xErrors_start = NULL; - double *xErrors_end = NULL; + double *farea_start = nullptr; + double *farea_end = nullptr; + double *xErrors_start = nullptr; + double *xErrors_end = nullptr; RebinnedOutput_sptr rb_workspace; if (hasFArea) { farea.load(static_cast<int>(blocksize), static_cast<int>(hist)); diff --git a/Framework/DataHandling/src/LoadRaw/isisraw.cpp b/Framework/DataHandling/src/LoadRaw/isisraw.cpp index b46931a5449..ac3a73ec1f4 100644 --- a/Framework/DataHandling/src/LoadRaw/isisraw.cpp +++ b/Framework/DataHandling/src/LoadRaw/isisraw.cpp @@ -8,7 +8,7 @@ #define FAILURE 1 /// stuff -ISISRAW::ISISRAW() : m_crpt(0), dat1(0) { +ISISRAW::ISISRAW() : m_crpt(nullptr), dat1(nullptr) { int i, j; // section 1 frmt_ver_no = 2; // format version number VER1 (=2) @@ -135,11 +135,11 @@ int ISISRAW::addItems() { /// stuff ISISRAW::ISISRAW(ISISCRPT_STRUCT *crpt) : m_crpt(crpt), frmt_ver_no(0), data_format(0), ver2(0), r_number(0), - ver3(0), i_det(0), i_mon(0), i_use(0), mdet(0), monp(0), spec(0), delt(0), - len2(0), code(0), tthe(0), ut(0), ver4(0), ver5(0), crat(0), modn(0), - mpos(0), timr(0), udet(0), ver6(0), t_ntrg(0), t_nfpp(0), t_nper(0), - t_nsp1(0), t_ntc1(0), t_pre1(0), t_tcb1(0), ver7(0), u_dat(0), ver8(0), - ddes(0), dat1(0) { + ver3(0), i_det(0), i_mon(0), i_use(0), mdet(nullptr), monp(nullptr), spec(nullptr), delt(nullptr), + len2(nullptr), code(nullptr), tthe(nullptr), ut(nullptr), ver4(0), ver5(0), crat(nullptr), modn(nullptr), + mpos(nullptr), timr(nullptr), udet(nullptr), ver6(0), t_ntrg(0), t_nfpp(0), t_nper(0), + t_nsp1(0), t_ntc1(0), t_pre1(0), t_tcb1(nullptr), ver7(0), u_dat(nullptr), ver8(0), + ddes(nullptr), dat1(nullptr) { memset(r_title, ' ', sizeof(r_title)); memset(i_inst, ' ', sizeof(i_inst)); for (int i = 0; i < 256; i++) { @@ -148,10 +148,10 @@ ISISRAW::ISISRAW(ISISCRPT_STRUCT *crpt) memset(t_tcm1, 0, sizeof(t_tcm1)); // time channel mode memset(t_tcp1, 0, sizeof(t_tcp1)); // time channel parameters e_nse = 0; - e_seblock = 0; + e_seblock = nullptr; u_len = 0; logsect.nlines = 0; - logsect.lines = 0; + logsect.lines = nullptr; addItems(); updateFromCRPT(); } @@ -160,11 +160,11 @@ ISISRAW::ISISRAW(ISISCRPT_STRUCT *crpt) /// stuff ISISRAW::ISISRAW(ISISCRPT_STRUCT *crpt, bool doUpdateFromCRPT) : m_crpt(crpt), frmt_ver_no(0), data_format(0), ver2(0), r_number(0), - ver3(0), i_det(0), i_mon(0), i_use(0), mdet(0), monp(0), spec(0), delt(0), - len2(0), code(0), tthe(0), ut(0), ver4(0), ver5(0), crat(0), modn(0), - mpos(0), timr(0), udet(0), ver6(0), t_ntrg(0), t_nfpp(0), t_nper(0), - t_nsp1(0), t_ntc1(0), t_pre1(0), t_tcb1(0), ver7(0), u_dat(0), ver8(0), - ddes(0), dat1(0) { + ver3(0), i_det(0), i_mon(0), i_use(0), mdet(nullptr), monp(nullptr), spec(nullptr), delt(nullptr), + len2(nullptr), code(nullptr), tthe(nullptr), ut(nullptr), ver4(0), ver5(0), crat(nullptr), modn(nullptr), + mpos(nullptr), timr(nullptr), udet(nullptr), ver6(0), t_ntrg(0), t_nfpp(0), t_nper(0), + t_nsp1(0), t_ntc1(0), t_pre1(0), t_tcb1(nullptr), ver7(0), u_dat(nullptr), ver8(0), + ddes(nullptr), dat1(nullptr) { memset(r_title, ' ', sizeof(r_title)); memset(i_inst, ' ', sizeof(i_inst)); for (int i = 0; i < 256; i++) { @@ -173,10 +173,10 @@ ISISRAW::ISISRAW(ISISCRPT_STRUCT *crpt, bool doUpdateFromCRPT) memset(t_tcm1, 0, sizeof(t_tcm1)); // time channel mode memset(t_tcp1, 0, sizeof(t_tcp1)); // time channel parameters e_nse = 0; - e_seblock = 0; + e_seblock = nullptr; u_len = 0; logsect.nlines = 0; - logsect.lines = 0; + logsect.lines = nullptr; addItems(); if (doUpdateFromCRPT) { updateFromCRPT(); @@ -186,7 +186,7 @@ ISISRAW::ISISRAW(ISISCRPT_STRUCT *crpt, bool doUpdateFromCRPT) // update from bound CRPT /// stuff int ISISRAW::updateFromCRPT() { - if (m_crpt == NULL) { + if (m_crpt == nullptr) { return 0; } #ifndef REAL_CRPT @@ -479,7 +479,7 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) { auto outbuff = new char[outbuff_size]; if (!read_data) { ndes = ndata = 0; - dat1 = NULL; + dat1 = nullptr; // seek to position right after the data if we want to read the log if (from_file) { ndes = t_nper * (t_nsp1 + 1); @@ -706,7 +706,7 @@ int ISISRAW::ioRAW(FILE *file, LOG_LINE *s, int len, bool from_file) { /// stuff int ISISRAW::ioRAW(FILE *file, char *s, int len, bool from_file) { - if ((len <= 0) || (s == 0)) { + if ((len <= 0) || (s == nullptr)) { return 0; } @@ -723,7 +723,7 @@ int ISISRAW::ioRAW(FILE *file, char *s, int len, bool from_file) { /// stuff int ISISRAW::ioRAW(FILE *file, int *s, int len, bool from_file) { - if ((len <= 0) || (s == 0)) { + if ((len <= 0) || (s == nullptr)) { return 0; } @@ -740,7 +740,7 @@ int ISISRAW::ioRAW(FILE *file, int *s, int len, bool from_file) { /// stuff int ISISRAW::ioRAW(FILE *file, uint32_t *s, int len, bool from_file) { - if ((len <= 0) || (s == 0)) { + if ((len <= 0) || (s == nullptr)) { return 0; } @@ -757,7 +757,7 @@ int ISISRAW::ioRAW(FILE *file, uint32_t *s, int len, bool from_file) { /// stuff int ISISRAW::ioRAW(FILE *file, float *s, int len, bool from_file) { int errcode = 0; - if ((len <= 0) || (s == 0)) { + if ((len <= 0) || (s == nullptr)) { return 0; } @@ -781,10 +781,10 @@ int ISISRAW::ioRAW(FILE *file, char **s, int len, bool from_file) { *s = new char[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -798,10 +798,10 @@ int ISISRAW::ioRAW(FILE *file, int **s, int len, bool from_file) { *s = new int[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -815,10 +815,10 @@ int ISISRAW::ioRAW(FILE *file, uint32_t **s, int len, bool from_file) { *s = new uint32_t[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -832,10 +832,10 @@ int ISISRAW::ioRAW(FILE *file, float **s, int len, bool from_file) { *s = new float[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -849,10 +849,10 @@ int ISISRAW::ioRAW(FILE *file, SE_STRUCT **s, int len, bool from_file) { *s = new SE_STRUCT[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -866,10 +866,10 @@ int ISISRAW::ioRAW(FILE *file, DDES_STRUCT **s, int len, bool from_file) { *s = new DDES_STRUCT[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -883,10 +883,10 @@ int ISISRAW::ioRAW(FILE *file, LOG_LINE **s, int len, bool from_file) { *s = new LOG_LINE[len]; ioRAW(file, *s, len, from_file); } else { - *s = 0; + *s = nullptr; } } else { - if (*s != 0) { + if (*s != nullptr) { ioRAW(file, *s, len, from_file); } } @@ -914,7 +914,7 @@ int ISISRAW::vmstime(char *timbuf, int len, time_t time_value) { * get time in VMS format 01-JAN-1970 00:00:00 */ size_t i, n; - struct tm *tmstruct = NULL; + struct tm *tmstruct = nullptr; #ifdef MS_VISUAL_STUDIO errno_t err = localtime_s(tmstruct, &time_value); if (err) { @@ -940,7 +940,7 @@ int ISISRAW::readFromFile(const char *filename, bool read_data) { #else //_WIN32 FILE *input_file = fopen(filename, "rb"); #endif //_WIN32 - if (input_file != NULL) { + if (input_file != nullptr) { ioRAW(input_file, true, read_data); fclose(input_file); return 0; diff --git a/Framework/DataHandling/src/LoadRaw/isisraw2.cpp b/Framework/DataHandling/src/LoadRaw/isisraw2.cpp index 331b26bb1f8..319e354692c 100644 --- a/Framework/DataHandling/src/LoadRaw/isisraw2.cpp +++ b/Framework/DataHandling/src/LoadRaw/isisraw2.cpp @@ -15,7 +15,7 @@ Mantid::Kernel::Logger g_log("ISISRAW2"); /// No arg Constructor ISISRAW2::ISISRAW2() - : ISISRAW(NULL, false), ndes(0), outbuff(0), m_bufferSize(0) { + : ISISRAW(nullptr, false), ndes(0), outbuff(nullptr), m_bufferSize(0) { // Determine the size of the output buffer to create from the config service. g_log.debug() << "Determining ioRaw buffer size\n"; if (Mantid::Kernel::ConfigService::Instance().getValue( diff --git a/Framework/DataHandling/src/LoadRawHelper.cpp b/Framework/DataHandling/src/LoadRawHelper.cpp index 398eee8c2c7..5be2e5d90a4 100644 --- a/Framework/DataHandling/src/LoadRawHelper.cpp +++ b/Framework/DataHandling/src/LoadRawHelper.cpp @@ -87,7 +87,7 @@ void LoadRawHelper::init() { */ FILE *LoadRawHelper::openRawFile(const std::string &fileName) { FILE *file = fopen(fileName.c_str(), "rb"); - if (file == NULL) { + if (file == nullptr) { g_log.error("Unable to open file " + fileName); throw Exception::FileError("Unable to open File:", fileName); } @@ -762,7 +762,7 @@ void LoadRawHelper::createPeriodLogs( */ void LoadRawHelper::loadRunParameters(API::MatrixWorkspace_sptr localWorkspace, ISISRAW *const rawFile) const { - ISISRAW *localISISRaw(NULL); + ISISRAW *localISISRaw(nullptr); if (!rawFile) { localISISRaw = isisRaw.get(); } else { diff --git a/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp b/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp index 6becc35c3df..768a6e9b7c7 100644 --- a/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp +++ b/Framework/DataHandling/src/LoadSampleDetailsFromRaw.cpp @@ -40,7 +40,7 @@ void LoadSampleDetailsFromRaw::exec() { std::string filename = getPropertyValue("Filename"); FILE *file = fopen(filename.c_str(), "rb"); - if (file == NULL) { + if (file == nullptr) { g_log.error("Unable to open file " + filename); throw Exception::FileError("Unable to open File:", filename); } diff --git a/Framework/DataHandling/src/MoveInstrumentComponent.cpp b/Framework/DataHandling/src/MoveInstrumentComponent.cpp index 4ae8f75ac54..2cc06e7c88e 100644 --- a/Framework/DataHandling/src/MoveInstrumentComponent.cpp +++ b/Framework/DataHandling/src/MoveInstrumentComponent.cpp @@ -68,7 +68,7 @@ void MoveInstrumentComponent::exec() { // Find the component to move if (DetID != -1) { comp = inst->getDetector(DetID); - if (comp == 0) { + if (comp == nullptr) { std::ostringstream mess; mess << "Detector with ID " << DetID << " was not found."; g_log.error(mess.str()); @@ -76,7 +76,7 @@ void MoveInstrumentComponent::exec() { } } else if (!ComponentName.empty()) { comp = inst->getComponentByName(ComponentName); - if (comp == 0) { + if (comp == nullptr) { std::ostringstream mess; mess << "Component with name " << ComponentName << " was not found."; g_log.error(mess.str()); diff --git a/Framework/DataHandling/src/ProcessDasNexusLog.cpp b/Framework/DataHandling/src/ProcessDasNexusLog.cpp index bf766508f08..13d55cb17ad 100644 --- a/Framework/DataHandling/src/ProcessDasNexusLog.cpp +++ b/Framework/DataHandling/src/ProcessDasNexusLog.cpp @@ -63,7 +63,7 @@ void ProcessDasNexusLog::exec() { // 2. Check Input // 1. Get log - Kernel::Property *log(NULL); + Kernel::Property *log(nullptr); try { log = inWS->run().getProperty(inlogname); } catch (Exception::NotFoundError &) { diff --git a/Framework/DataHandling/src/RotateInstrumentComponent.cpp b/Framework/DataHandling/src/RotateInstrumentComponent.cpp index adf61ef3c06..53dd25c73db 100644 --- a/Framework/DataHandling/src/RotateInstrumentComponent.cpp +++ b/Framework/DataHandling/src/RotateInstrumentComponent.cpp @@ -93,7 +93,7 @@ void RotateInstrumentComponent::exec() { // Find the component to move if (DetID != -1) { comp = inst->getDetector(DetID); - if (comp == 0) { + if (comp == nullptr) { std::ostringstream mess; mess << "Detector with ID " << DetID << " was not found."; g_log.error(mess.str()); @@ -101,7 +101,7 @@ void RotateInstrumentComponent::exec() { } } else if (!ComponentName.empty()) { comp = inst->getComponentByName(ComponentName); - if (comp == 0) { + if (comp == nullptr) { std::ostringstream mess; mess << "Component with name " << ComponentName << " was not found."; g_log.error(mess.str()); diff --git a/Framework/DataHandling/src/SaveFocusedXYE.cpp b/Framework/DataHandling/src/SaveFocusedXYE.cpp index f6b917b15e2..d8e40b30886 100644 --- a/Framework/DataHandling/src/SaveFocusedXYE.cpp +++ b/Framework/DataHandling/src/SaveFocusedXYE.cpp @@ -308,7 +308,7 @@ void SaveFocusedXYE::getFocusedPos(Mantid::API::MatrixWorkspace_const_sptr wksp, const size_t spectrum, double &l1, double &l2, double &tth) { Geometry::Instrument_const_sptr instrument = wksp->getInstrument(); - if (instrument == NULL) { + if (instrument == nullptr) { l1 = 0.; l2 = 0.; tth = 0.; @@ -316,7 +316,7 @@ void SaveFocusedXYE::getFocusedPos(Mantid::API::MatrixWorkspace_const_sptr wksp, } Geometry::IComponent_const_sptr source = instrument->getSource(); Geometry::IComponent_const_sptr sample = instrument->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { l1 = 0.; l2 = 0.; tth = 0.; diff --git a/Framework/DataHandling/src/SaveGSS.cpp b/Framework/DataHandling/src/SaveGSS.cpp index 28b217eb934..fd155fabf05 100644 --- a/Framework/DataHandling/src/SaveGSS.cpp +++ b/Framework/DataHandling/src/SaveGSS.cpp @@ -99,7 +99,7 @@ void SaveGSS::init() { void getFocusedPos(MatrixWorkspace_const_sptr wksp, const int spectrum, double &l1, double &l2, double &tth, double &difc) { Geometry::Instrument_const_sptr instrument = wksp->getInstrument(); - if (instrument == NULL) { + if (instrument == nullptr) { l1 = 0.; l2 = 0.; tth = 0.; @@ -107,7 +107,7 @@ void getFocusedPos(MatrixWorkspace_const_sptr wksp, const int spectrum, } Geometry::IComponent_const_sptr source = instrument->getSource(); Geometry::IComponent_const_sptr sample = instrument->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { l1 = 0.; l2 = 0.; tth = 0.; @@ -206,7 +206,7 @@ void SaveGSS::writeGSASFile(const std::string &outfilename, bool append, Geometry::IComponent_const_sptr source; Geometry::IComponent_const_sptr sample; bool has_instrument = false; - if (instrument != NULL) { + if (instrument != nullptr) { source = instrument->getSource(); sample = instrument->getSample(); if (source && sample) @@ -379,7 +379,7 @@ void writeLogValue(std::ostream &os, const Run &runinfo, Kernel::Property *prop = runinfo.getProperty(name); // Return without a valid pointer to property - if (prop == NULL) { + if (prop == nullptr) { os << defValue; return; } @@ -430,7 +430,7 @@ void SaveGSS::writeHeaders(const std::string &format, std::stringstream &os, // the instrument parameter file if (runinfo.hasProperty("iparm_file")) { Kernel::Property *prop = runinfo.getProperty("iparm_file"); - if (prop != NULL && (!prop->value().empty())) { + if (prop != nullptr && (!prop->value().empty())) { std::stringstream line; line << "#Instrument parameter file: " << prop->value(); os << std::setw(80) << std::left << line.str() << "\n"; diff --git a/Framework/DataHandling/src/SaveISISNexus.cpp b/Framework/DataHandling/src/SaveISISNexus.cpp index 727565fad93..a58603e8da4 100644 --- a/Framework/DataHandling/src/SaveISISNexus.cpp +++ b/Framework/DataHandling/src/SaveISISNexus.cpp @@ -100,7 +100,7 @@ void SaveISISNexus::exec() { m_isisRaw = new ISISRAW2; rawFile = fopen(inputFilename.c_str(), "rb"); - if (rawFile == NULL) { + if (rawFile == nullptr) { throw Exception::FileError("Cannot open file ", inputFilename); } m_isisRaw->ioRAW(rawFile, true); diff --git a/Framework/DataHandling/src/SaveNexusProcessed.cpp b/Framework/DataHandling/src/SaveNexusProcessed.cpp index b1cce74d4f6..29f58d9ddc6 100644 --- a/Framework/DataHandling/src/SaveNexusProcessed.cpp +++ b/Framework/DataHandling/src/SaveNexusProcessed.cpp @@ -384,10 +384,10 @@ void SaveNexusProcessed::execEvent(Mantid::NeXus::NexusFileIO *nexusFile, // Initialize all the arrays int64_t num = index; - double *tofs = NULL; - float *weights = NULL; - float *errorSquareds = NULL; - int64_t *pulsetimes = NULL; + double *tofs = nullptr; + float *weights = nullptr; + float *errorSquareds = nullptr; + int64_t *pulsetimes = nullptr; // overall event type. EventType type = m_eventWorkspace->getEventType(); diff --git a/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp b/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp index 08ad02866b4..aa8b9685036 100644 --- a/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp +++ b/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp @@ -93,7 +93,7 @@ int SaveToSNSHistogramNexus::add_path(const char *path) { int SaveToSNSHistogramNexus::remove_path(const char *path) { char *tstr; tstr = strrchr(current_path, '/'); - if (tstr != NULL && !strcmp(path, tstr + 1)) { + if (tstr != nullptr && !strcmp(path, tstr + 1)) { *tstr = '\0'; } else { printf("path error\n"); @@ -277,7 +277,7 @@ int SaveToSNSHistogramNexus::WriteOutDataOrErrors( new float[slabDimensions[0] * slabDimensions[1] * slabDimensions[2]]; // Only allocate an array for errors if it is needed - float *errors = NULL; + float *errors = nullptr; if (doBoth) errors = new float[slabDimensions[0] * slabDimensions[1] * slabDimensions[2]]; diff --git a/Framework/DataHandling/src/SetScalingPSD.cpp b/Framework/DataHandling/src/SetScalingPSD.cpp index bc5384007eb..806bbed2217 100644 --- a/Framework/DataHandling/src/SetScalingPSD.cpp +++ b/Framework/DataHandling/src/SetScalingPSD.cpp @@ -340,7 +340,7 @@ void SetScalingPSD::getDetPositionsFromRaw(std::string rawfile, (void)rawfile; // Avoid compiler warning // open raw file - ISISRAW iraw(NULL); + ISISRAW iraw(nullptr); if (iraw.readFromFile(m_filename.c_str(), false) != 0) { g_log.error("Unable to open file " + m_filename); throw Exception::FileError("Unable to open File:", m_filename); diff --git a/Framework/DataObjects/src/AffineMatrixParameter.cpp b/Framework/DataObjects/src/AffineMatrixParameter.cpp index 6c1a42ea72f..f520c6fdf2f 100644 --- a/Framework/DataObjects/src/AffineMatrixParameter.cpp +++ b/Framework/DataObjects/src/AffineMatrixParameter.cpp @@ -30,11 +30,11 @@ AffineMatrixParameter::AffineMatrixParameter(size_t outD, size_t inD) AffineMatrixParameter::~AffineMatrixParameter() { // delete array of pointers to rows delete[] m_rawMatrix; - m_rawMatrix = NULL; + m_rawMatrix = nullptr; // delete large mem block holding the matrix delete[] m_rawMem; - m_rawMem = NULL; + m_rawMem = nullptr; } //---------------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/src/BoxControllerNeXusIO.cpp b/Framework/DataObjects/src/BoxControllerNeXusIO.cpp index a922c6b631f..f1386cad652 100644 --- a/Framework/DataObjects/src/BoxControllerNeXusIO.cpp +++ b/Framework/DataObjects/src/BoxControllerNeXusIO.cpp @@ -24,7 +24,7 @@ std::string BoxControllerNeXusIO::g_DBDataName("free_space_blocks"); @param bc shared pointer to the box controller which uses this IO operations */ BoxControllerNeXusIO::BoxControllerNeXusIO(API::BoxController *const bc) - : m_File(NULL), m_ReadOnly(true), m_dataChunk(DATA_CHUNK), m_bc(bc), + : m_File(nullptr), m_ReadOnly(true), m_dataChunk(DATA_CHUNK), m_bc(bc), m_BlockStart(2, 0), m_BlockSize(2, 0), m_CoordSize(sizeof(coord_t)), m_EventType(FatEvent), m_EventsVersion("1.0"), m_ReadConversion(noConversion) { @@ -487,7 +487,7 @@ void BoxControllerNeXusIO::closeFile() { m_File->close(); // close NeXus file delete m_File; - m_File = NULL; + m_File = nullptr; } } } diff --git a/Framework/DataObjects/src/CoordTransformAffine.cpp b/Framework/DataObjects/src/CoordTransformAffine.cpp index 4041da78739..de51591b167 100644 --- a/Framework/DataObjects/src/CoordTransformAffine.cpp +++ b/Framework/DataObjects/src/CoordTransformAffine.cpp @@ -27,7 +27,7 @@ namespace DataObjects { */ CoordTransformAffine::CoordTransformAffine(const size_t inD, const size_t outD) : CoordTransform(inD, outD), m_affineMatrix(outD + 1, inD + 1), - m_rawMatrix(NULL), m_rawMemory(NULL) { + m_rawMatrix(nullptr), m_rawMemory(nullptr) { m_affineMatrix.identityMatrix(); // Allocate the raw matrix @@ -49,11 +49,11 @@ CoordTransformAffine::CoordTransformAffine(const size_t inD, const size_t outD) CoordTransformAffine::~CoordTransformAffine() { // delete array of pointers to rows delete[] m_rawMatrix; - m_rawMatrix = NULL; + m_rawMatrix = nullptr; // delete large mem block holding the matrix delete[] m_rawMemory; - m_rawMemory = NULL; + m_rawMemory = nullptr; } //---------------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/src/EventList.cpp b/Framework/DataObjects/src/EventList.cpp index da0f6969ab5..18f5ba3e916 100644 --- a/Framework/DataObjects/src/EventList.cpp +++ b/Framework/DataObjects/src/EventList.cpp @@ -123,7 +123,7 @@ bool compareEventPulseTimeTOF(const TofEvent &e1, const TofEvent &e2) { /// Constructor (empty) EventList::EventList() - : eventType(TOF), order(UNSORTED), mru(NULL), m_lockedMRU(false) {} + : eventType(TOF), order(UNSORTED), mru(nullptr), m_lockedMRU(false) {} /** Constructor with a MRU list * @param mru :: pointer to the MRU of the parent EventWorkspace @@ -144,7 +144,7 @@ EventList::EventList(const EventList &rhs) /** Constructor, taking a vector of events. * @param events :: Vector of TofEvent's */ EventList::EventList(const std::vector<TofEvent> &events) - : mru(NULL), m_lockedMRU(false) { + : mru(nullptr), m_lockedMRU(false) { this->events.assign(events.begin(), events.end()); this->eventType = TOF; this->order = UNSORTED; @@ -153,7 +153,7 @@ EventList::EventList(const std::vector<TofEvent> &events) /** Constructor, taking a vector of events. * @param events :: Vector of WeightedEvent's */ EventList::EventList(const std::vector<WeightedEvent> &events) - : mru(NULL), m_lockedMRU(false) { + : mru(nullptr), m_lockedMRU(false) { this->weightedEvents.assign(events.begin(), events.end()); this->eventType = WEIGHTED; this->order = UNSORTED; @@ -162,7 +162,7 @@ EventList::EventList(const std::vector<WeightedEvent> &events) /** Constructor, taking a vector of events. * @param events :: Vector of WeightedEventNoTime's */ EventList::EventList(const std::vector<WeightedEventNoTime> &events) - : mru(NULL), m_lockedMRU(false) { + : mru(nullptr), m_lockedMRU(false) { this->weightedEventsNoTime.assign(events.begin(), events.end()); this->eventType = WEIGHTED_NOTIME; this->order = UNSORTED; @@ -1542,7 +1542,7 @@ const MantidVec &EventList::constDataY() const { MantidVecWithMarker *yData; yData = mru->findY(thread, this->m_specNo); - if (yData == NULL) { + if (yData == nullptr) { // Create the MRU object yData = new MantidVecWithMarker(this->m_specNo, this->m_lockedMRU); @@ -1584,7 +1584,7 @@ const MantidVec &EventList::constDataE() const { MantidVecWithMarker *eData; eData = mru->findE(thread, this->m_specNo); - if (eData == NULL) { + if (eData == nullptr) { // Create the MRU object eData = new MantidVecWithMarker(this->m_specNo, this->m_lockedMRU); diff --git a/Framework/DataObjects/src/EventWorkspace.cpp b/Framework/DataObjects/src/EventWorkspace.cpp index 9a8d68f4f2e..609868e8adf 100644 --- a/Framework/DataObjects/src/EventWorkspace.cpp +++ b/Framework/DataObjects/src/EventWorkspace.cpp @@ -81,7 +81,7 @@ void EventWorkspace::init(const std::size_t &NVectors, } // Initialize the data m_noVectors = NVectors; - data.resize(m_noVectors, NULL); + data.resize(m_noVectors, nullptr); // Make sure SOMETHING exists for all initialized spots. for (size_t i = 0; i < m_noVectors; i++) data[i] = new EventList(mru, specid_t(i)); @@ -884,7 +884,7 @@ EventSortType EventWorkspace::getSortType() const { void EventWorkspace::sortAll(EventSortType sortType, Mantid::API::Progress *prog) const { if (this->getSortType() == sortType) { - if (prog != NULL) { + if (prog != nullptr) { prog->reportIncrement(this->data.size()); } return; diff --git a/Framework/DataObjects/src/EventWorkspaceMRU.cpp b/Framework/DataObjects/src/EventWorkspaceMRU.cpp index 76ca4af7db5..2d7a5dafc58 100644 --- a/Framework/DataObjects/src/EventWorkspaceMRU.cpp +++ b/Framework/DataObjects/src/EventWorkspaceMRU.cpp @@ -43,7 +43,7 @@ EventWorkspaceMRU::~EventWorkspaceMRU() { void EventWorkspaceMRU::ensureEnoughBuffersE(size_t thread_num) const { Mutex::ScopedLock _lock(m_changeMruListsMutexE); if (m_bufferedDataE.size() <= thread_num) { - m_bufferedDataE.resize(thread_num + 1, NULL); + m_bufferedDataE.resize(thread_num + 1, nullptr); for (size_t i = 0; i < m_bufferedDataE.size(); i++) { if (!m_bufferedDataE[i]) m_bufferedDataE[i] = @@ -59,7 +59,7 @@ void EventWorkspaceMRU::ensureEnoughBuffersE(size_t thread_num) const { void EventWorkspaceMRU::ensureEnoughBuffersY(size_t thread_num) const { Mutex::ScopedLock _lock(m_changeMruListsMutexY); if (m_bufferedDataY.size() <= thread_num) { - m_bufferedDataY.resize(thread_num + 1, NULL); + m_bufferedDataY.resize(thread_num + 1, nullptr); for (size_t i = 0; i < m_bufferedDataY.size(); i++) { if (!m_bufferedDataY[i]) m_bufferedDataY[i] = diff --git a/Framework/DataObjects/src/MDBoxFlatTree.cpp b/Framework/DataObjects/src/MDBoxFlatTree.cpp index 119a9e829f5..6d419c9937b 100644 --- a/Framework/DataObjects/src/MDBoxFlatTree.cpp +++ b/Framework/DataObjects/src/MDBoxFlatTree.cpp @@ -505,7 +505,7 @@ uint64_t MDBoxFlatTree::restoreBoxTree(std::vector<API::IMDNode *> &Boxes, bool BoxStructureOnly) { size_t numBoxes = this->getNBoxes(); - Boxes.assign(numBoxes, NULL); + Boxes.assign(numBoxes, nullptr); uint64_t totalNumEvents(0); m_nDim = static_cast<int>(bc->getNDims()); @@ -529,7 +529,7 @@ uint64_t MDBoxFlatTree::restoreBoxTree(std::vector<API::IMDNode *> &Boxes, if (box_type == 0) continue; - API::IMDNode *ibox = NULL; + API::IMDNode *ibox = nullptr; // Extents of the box, as a vector std::vector<Mantid::Geometry::MDDimensionExtents<coord_t>> extentsVector( diff --git a/Framework/DataObjects/src/MDEventFactory.cpp b/Framework/DataObjects/src/MDEventFactory.cpp index 21fce921ffa..d487fd9bb9f 100644 --- a/Framework/DataObjects/src/MDEventFactory.cpp +++ b/Framework/DataObjects/src/MDEventFactory.cpp @@ -254,11 +254,11 @@ API::IMDNode *MDEventFactory::createBox( /// static vector, conaining the pointers to the functions creating MD boxes std::vector<MDEventFactory::fpCreateBox> MDEventFactory::boxCreatorFP( MDEventFactory::NumBoxTypes *(MDEventFactory::MAX_MD_DIMENSIONS_NUM + 1), - NULL); + nullptr); // static vector, conaining the pointers to the functions creating MD Workspaces std::vector<MDEventFactory::fpCreateMDWS> MDEventFactory::wsCreatorFP(MDEventFactory::MAX_MD_DIMENSIONS_NUM + 1, - NULL); + nullptr); //########### Teplate methaprogrammed CODE SOURCE start: //------------------------------------- diff --git a/Framework/DataObjects/src/MDHistoWorkspace.cpp b/Framework/DataObjects/src/MDHistoWorkspace.cpp index 15b6e08e450..11948bda58b 100644 --- a/Framework/DataObjects/src/MDHistoWorkspace.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspace.cpp @@ -62,7 +62,7 @@ MDHistoWorkspace::MDHistoWorkspace( MDHistoWorkspace::MDHistoWorkspace( std::vector<Mantid::Geometry::MDHistoDimension_sptr> &dimensions, Mantid::API::MDNormalization displayNormalization) - : IMDHistoWorkspace(), numDimensions(0), m_numEvents(NULL), + : IMDHistoWorkspace(), numDimensions(0), m_numEvents(nullptr), m_nEventsContributed(std::numeric_limits<uint64_t>::quiet_NaN()), m_coordSystem(None), m_displayNormalization(displayNormalization) { this->init(dimensions); @@ -77,7 +77,7 @@ MDHistoWorkspace::MDHistoWorkspace( MDHistoWorkspace::MDHistoWorkspace( std::vector<Mantid::Geometry::IMDDimension_sptr> &dimensions, Mantid::API::MDNormalization displayNormalization) - : IMDHistoWorkspace(), numDimensions(0), m_numEvents(NULL), + : IMDHistoWorkspace(), numDimensions(0), m_numEvents(nullptr), m_nEventsContributed(std::numeric_limits<uint64_t>::quiet_NaN()), m_coordSystem(None), m_displayNormalization(displayNormalization) { this->init(dimensions); @@ -1214,7 +1214,7 @@ Does not perform any clearing. Multiple calls are compounded. */ void MDHistoWorkspace::setMDMasking( Mantid::Geometry::MDImplicitFunction *maskingRegion) { - if (maskingRegion != NULL) { + if (maskingRegion != nullptr) { for (size_t i = 0; i < this->getNPoints(); ++i) { // If the function masks the point, then mask it, otherwise leave it as it // is. diff --git a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp index 9f8016d0feb..34b37f28863 100644 --- a/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp @@ -155,7 +155,7 @@ void MDHistoWorkspaceIterator::init( Mantid::Geometry::MDImplicitFunction *function, size_t beginPos, size_t endPos) { m_ws = workspace; - if (m_ws == NULL) + if (m_ws == nullptr) throw std::invalid_argument( "MDHistoWorkspaceIterator::ctor(): NULL workspace given."); @@ -245,7 +245,7 @@ MDHistoWorkspaceIterator::~MDHistoWorkspaceIterator() { if (m_function) delete m_function; - m_function = NULL; + m_function = nullptr; } //---------------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/src/Peak.cpp b/Framework/DataObjects/src/Peak.cpp index 412f64c1397..b955505d33e 100644 --- a/Framework/DataObjects/src/Peak.cpp +++ b/Framework/DataObjects/src/Peak.cpp @@ -341,12 +341,12 @@ void Peak::setInstrument(Geometry::Instrument_const_sptr inst) { // Cache some positions const Geometry::IComponent_const_sptr sourceObj = m_inst->getSource(); - if (sourceObj == NULL) + if (sourceObj == nullptr) throw Exception::InstrumentDefinitionError("Peak::setInstrument(): Failed " "to get source component from " "instrument"); const Geometry::IComponent_const_sptr sampleObj = m_inst->getSample(); - if (sampleObj == NULL) + if (sampleObj == nullptr) throw Exception::InstrumentDefinitionError("Peak::setInstrument(): Failed " "to get sample component from " "instrument"); @@ -940,7 +940,7 @@ accessing its position. Throws if null. */ Mantid::Kernel::V3D Peak::getDetectorPosition() const { auto det = getDetector(); - if (det == NULL) { + if (det == nullptr) { throw Mantid::Kernel::Exception::NullPointerException("Peak", "Detector"); } return getDetector()->getPos(); diff --git a/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp b/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp index ffc4bd4b9a6..6c1d1782d00 100644 --- a/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp +++ b/Framework/DataObjects/src/PeakShapeEllipsoidFactory.cpp @@ -29,7 +29,7 @@ Mantid::Geometry::PeakShape * PeakShapeEllipsoidFactory::create(const std::string &source) const { Json::Reader reader; Json::Value root; - Mantid::Geometry::PeakShape *product = NULL; + Mantid::Geometry::PeakShape *product = nullptr; if (reader.parse(source, root)) { const std::string shape = root["shape"].asString(); if (shape == PeakShapeEllipsoid::ellipsoidShapeName()) { diff --git a/Framework/DataObjects/src/PeakShapeSphericalFactory.cpp b/Framework/DataObjects/src/PeakShapeSphericalFactory.cpp index a7a17ce2a26..970cea2322c 100644 --- a/Framework/DataObjects/src/PeakShapeSphericalFactory.cpp +++ b/Framework/DataObjects/src/PeakShapeSphericalFactory.cpp @@ -28,7 +28,7 @@ Mantid::Geometry::PeakShape * PeakShapeSphericalFactory::create(const std::string &source) const { Json::Reader reader; Json::Value root; - Mantid::Geometry::PeakShape *product = NULL; + Mantid::Geometry::PeakShape *product = nullptr; if (reader.parse(source, root)) { const std::string shape = root["shape"].asString(); if (shape == PeakShapeSpherical::sphereShapeName()) { diff --git a/Framework/DataObjects/src/ReflectometryTransform.cpp b/Framework/DataObjects/src/ReflectometryTransform.cpp index ce6bbb034ef..950126961cf 100644 --- a/Framework/DataObjects/src/ReflectometryTransform.cpp +++ b/Framework/DataObjects/src/ReflectometryTransform.cpp @@ -313,7 +313,7 @@ Mantid::API::IMDEventWorkspace_sptr ReflectometryTransform::executeMD( centers)); } } - ws->splitAllIfNeeded(NULL); + ws->splitAllIfNeeded(nullptr); ws->refreshCache(); return ws; } diff --git a/Framework/Geometry/src/ComponentParser.cpp b/Framework/Geometry/src/ComponentParser.cpp index 61e808d2ba8..ca5e689aa66 100644 --- a/Framework/Geometry/src/ComponentParser.cpp +++ b/Framework/Geometry/src/ComponentParser.cpp @@ -20,7 +20,7 @@ Component *ComponentParser::getComponent() { if (m_current.size() > 0) return m_current[0]; else - return NULL; + return nullptr; } void ComponentParser::characters(const Poco::XML::XMLChar ch[], int start, @@ -35,7 +35,7 @@ void ComponentParser::startElement(const Poco::XML::XMLString &, const Poco::XML::XMLString &, const Poco::XML::Attributes &attr) { // Find the parent of this new component. - Component *current = NULL; + Component *current = nullptr; if (!m_current.empty()) current = m_current.back(); @@ -45,7 +45,7 @@ void ComponentParser::startElement(const Poco::XML::XMLString &, // Find the name in the attributes std::string name = attr.getValue("", "name"); - Component *newComp = NULL; + Component *newComp = nullptr; if (localName == "Component") newComp = new Component(name, current); else { @@ -66,7 +66,7 @@ void ComponentParser::startElement(const Poco::XML::XMLString &, void ComponentParser::endElement(const Poco::XML::XMLString &, const Poco::XML::XMLString &localName, const Poco::XML::XMLString &) { - Component *current = NULL; + Component *current = nullptr; if (!m_current.empty()) current = m_current.back(); diff --git a/Framework/Geometry/src/IObjComponent.cpp b/Framework/Geometry/src/IObjComponent.cpp index ff0837baf77..a922c367caf 100644 --- a/Framework/Geometry/src/IObjComponent.cpp +++ b/Framework/Geometry/src/IObjComponent.cpp @@ -20,7 +20,7 @@ IObjComponent::IObjComponent(GeometryHandler *the_handler) { // Looking to get rid of the first of these constructors in due course (and // probably add others) IObjComponent::~IObjComponent() { - if (handle != NULL) + if (handle != nullptr) delete handle; } @@ -30,7 +30,7 @@ IObjComponent::~IObjComponent() { * the calling function. */ void IObjComponent::setGeometryHandler(GeometryHandler *h) { - if (h == NULL) + if (h == nullptr) return; this->handle = h; } diff --git a/Framework/Geometry/src/Instrument.cpp b/Framework/Geometry/src/Instrument.cpp index adecb4b35ad..c9415942c81 100644 --- a/Framework/Geometry/src/Instrument.cpp +++ b/Framework/Geometry/src/Instrument.cpp @@ -19,15 +19,15 @@ Kernel::Logger g_log("Instrument"); /// Default constructor Instrument::Instrument() - : CompAssembly(), m_detectorCache(), m_sourceCache(0), - m_chopperPoints(new std::vector<const ObjComponent *>), m_sampleCache(0), + : CompAssembly(), m_detectorCache(), m_sourceCache(nullptr), + m_chopperPoints(new std::vector<const ObjComponent *>), m_sampleCache(nullptr), m_defaultView("3D"), m_defaultViewAxis("Z+"), m_referenceFrame(new ReferenceFrame) {} /// Constructor with name Instrument::Instrument(const std::string &name) - : CompAssembly(name), m_detectorCache(), m_sourceCache(0), - m_chopperPoints(new std::vector<const ObjComponent *>), m_sampleCache(0), + : CompAssembly(name), m_detectorCache(), m_sourceCache(nullptr), + m_chopperPoints(new std::vector<const ObjComponent *>), m_sampleCache(nullptr), m_defaultView("3D"), m_defaultViewAxis("Z+"), m_referenceFrame(new ReferenceFrame) {} @@ -50,9 +50,9 @@ Instrument::Instrument(const boost::shared_ptr<const Instrument> instr, * in indirect instruments. */ Instrument::Instrument(const Instrument &instr) - : CompAssembly(instr), m_sourceCache(NULL), + : CompAssembly(instr), m_sourceCache(nullptr), m_chopperPoints(new std::vector<const ObjComponent *>), - m_sampleCache(NULL), /* Should only be temporarily null */ + m_sampleCache(nullptr), /* Should only be temporarily null */ m_logfileCache(instr.m_logfileCache), m_logfileUnit(instr.m_logfileUnit), m_monitorCache(instr.m_monitorCache), m_defaultView(instr.m_defaultView), m_defaultViewAxis(instr.m_defaultViewAxis), m_instr(), @@ -483,7 +483,7 @@ IDetector_const_sptr Instrument::getDetector(const detid_t &detector_id) const { const IDetector *Instrument::getBaseDetector(const detid_t &detector_id) const { auto it = m_instr->m_detectorCache.find(detector_id); if (it == m_instr->m_detectorCache.end()) { - return NULL; + return nullptr; } return it->second.get(); } @@ -495,7 +495,7 @@ bool Instrument::isMonitor(const detid_t &detector_id) const { return false; // This is the detector const Detector *det = dynamic_cast<const Detector *>(it->second.get()); - if (det == NULL) + if (det == nullptr) return false; return det->isMonitor(); } @@ -527,7 +527,7 @@ bool Instrument::isDetectorMasked(const detid_t &detector_id) const { return false; // This is the detector const Detector *det = dynamic_cast<const Detector *>(it->second.get()); - if (det == NULL) + if (det == nullptr) return false; // Access the parameter map directly. Parameter_sptr maskedParam = m_map->get(det, "masked"); @@ -976,7 +976,7 @@ void Instrument::getInstrumentParameters(double &l1, Kernel::V3D &beamline, Kernel::V3D &samplePos) const { // Get some positions const IComponent_const_sptr sourceObj = this->getSource(); - if (sourceObj == NULL) { + if (sourceObj == nullptr) { throw Exception::InstrumentDefinitionError( "Failed to get source component from instrument"); } diff --git a/Framework/Geometry/src/Instrument/CompAssembly.cpp b/Framework/Geometry/src/Instrument/CompAssembly.cpp index 7c73ef1e6b9..c2f18df7918 100644 --- a/Framework/Geometry/src/Instrument/CompAssembly.cpp +++ b/Framework/Geometry/src/Instrument/CompAssembly.cpp @@ -16,14 +16,14 @@ using Kernel::Quat; /** Empty constructor */ CompAssembly::CompAssembly() - : Component(), m_children(), m_cachedBoundingBox(NULL) {} + : Component(), m_children(), m_cachedBoundingBox(nullptr) {} /** Constructor for a parametrized CompAssembly * @param base: the base (un-parametrized) IComponent * @param map: pointer to the ParameterMap * */ CompAssembly::CompAssembly(const IComponent *base, const ParameterMap *map) - : Component(base, map), m_children(), m_cachedBoundingBox(NULL) {} + : Component(base, map), m_children(), m_cachedBoundingBox(nullptr) {} /** Valued constructor * @param n :: name of the assembly @@ -35,7 +35,7 @@ CompAssembly::CompAssembly(const IComponent *base, const ParameterMap *map) * this is registered as a children of reference. */ CompAssembly::CompAssembly(const std::string &n, IComponent *reference) - : Component(n, reference), m_children(), m_cachedBoundingBox(NULL) { + : Component(n, reference), m_children(), m_cachedBoundingBox(nullptr) { if (reference) { ICompAssembly *test = dynamic_cast<ICompAssembly *>(reference); if (test) { diff --git a/Framework/Geometry/src/Instrument/Component.cpp b/Framework/Geometry/src/Instrument/Component.cpp index 72bb0aa8be0..4d3672ac85f 100644 --- a/Framework/Geometry/src/Instrument/Component.cpp +++ b/Framework/Geometry/src/Instrument/Component.cpp @@ -15,7 +15,7 @@ using Kernel::Quat; * @param map :: a ParameterMap to parameterize the component */ Component::Component(const IComponent *base, const ParameterMap *map) - : m_parent(NULL), m_base(dynamic_cast<const Component *>(base)), + : m_parent(nullptr), m_base(dynamic_cast<const Component *>(base)), m_map(map) { if (!m_base) { throw std::invalid_argument( @@ -28,14 +28,14 @@ Component::Component(const IComponent *base, const ParameterMap *map) * Create a component with null parent */ Component::Component() - : m_parent(NULL), m_base(NULL), m_map(NULL), m_name(), m_pos(), m_rot() {} + : m_parent(nullptr), m_base(nullptr), m_map(nullptr), m_name(), m_pos(), m_rot() {} /** Constructor by value * @param name :: Component name * @param parent :: parent Component (optional) */ Component::Component(const std::string &name, IComponent *parent) - : m_parent(parent), m_base(NULL), m_map(NULL), m_name(name), m_pos(), + : m_parent(parent), m_base(nullptr), m_map(nullptr), m_name(name), m_pos(), m_rot() {} /** Constructor by value @@ -46,7 +46,7 @@ Component::Component(const std::string &name, IComponent *parent) */ Component::Component(const std::string &name, const V3D &position, IComponent *parent) - : m_parent(parent), m_base(NULL), m_map(NULL), m_name(name), + : m_parent(parent), m_base(nullptr), m_map(nullptr), m_name(name), m_pos(position), m_rot() {} /** Constructor @@ -57,7 +57,7 @@ Component::Component(const std::string &name, const V3D &position, */ Component::Component(const std::string &name, const V3D &position, const Quat &rotation, IComponent *parent) - : m_parent(parent), m_base(NULL), m_map(NULL), m_name(name), + : m_parent(parent), m_base(nullptr), m_map(nullptr), m_name(name), m_pos(position), m_rot(rotation) {} /// Destructor @@ -67,7 +67,7 @@ Component::~Component() {} /** Return true if the Component is, in fact, parametrized * (that is - it has a valid parameter map) */ -bool Component::isParametrized() const { return (m_map != NULL); } +bool Component::isParametrized() const { return (m_map != nullptr); } /** Clone method * Make a copy of the Component diff --git a/Framework/Geometry/src/Instrument/ComponentHelper.cpp b/Framework/Geometry/src/Instrument/ComponentHelper.cpp index f624aff34c3..e3ac86ae5d1 100644 --- a/Framework/Geometry/src/Instrument/ComponentHelper.cpp +++ b/Framework/Geometry/src/Instrument/ComponentHelper.cpp @@ -133,7 +133,7 @@ createMinimalInstrument(const Mantid::Kernel::V3D &sourcePos, instrument->markAsSamplePos(sample); // A detector - Detector *det = new Detector("point-detector", 1 /*detector id*/, NULL); + Detector *det = new Detector("point-detector", 1 /*detector id*/, nullptr); det->setPos(detectorPos); det->setShape(createSphere(0.01 /*1cm*/, V3D(0, 0, 0), "1")); instrument->add(det); @@ -169,7 +169,7 @@ createVirtualInstrument(Kernel::V3D sourcePos, Kernel::V3D samplePos, size_t numdets = vecdetpos.size(); for (size_t i = 0; i < numdets; ++i) { Detector *det = - new Detector("point-detector", vecdetid[i] /*detector id*/, NULL); + new Detector("point-detector", vecdetid[i] /*detector id*/, nullptr); det->setPos(vecdetpos[i]); // FIXME - should be cubi... pixel det->setShape(createSphere(0.01 /*1cm*/, V3D(0, 0, 0), "1")); diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index fec0c50da5f..dddd4aacc0a 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -52,7 +52,7 @@ Kernel::Logger g_log("InstrumentDefinitionParser"); */ InstrumentDefinitionParser::InstrumentDefinitionParser() : m_xmlFile(boost::make_shared<NullIDFObject>()), - m_cacheFile(boost::make_shared<NullIDFObject>()), m_pDoc(NULL), + m_cacheFile(boost::make_shared<NullIDFObject>()), m_pDoc(nullptr), m_hasParameterElement_beenSet(false), m_haveDefaultFacing(false), m_deltaOffsets(false), m_angleConvertConst(1.0), m_indirectPositions(false), m_cachingOption(NoneApplied) { @@ -69,7 +69,7 @@ InstrumentDefinitionParser::InstrumentDefinitionParser( const std::string &filename, const std::string &instName, const std::string &xmlText) : m_xmlFile(boost::make_shared<NullIDFObject>()), - m_cacheFile(boost::make_shared<NullIDFObject>()), m_pDoc(NULL), + m_cacheFile(boost::make_shared<NullIDFObject>()), m_pDoc(nullptr), m_hasParameterElement_beenSet(false), m_haveDefaultFacing(false), m_deltaOffsets(false), m_angleConvertConst(1.0), m_indirectPositions(false), m_cachingOption(NoneApplied) { @@ -89,7 +89,7 @@ InstrumentDefinitionParser::InstrumentDefinitionParser( const IDFObject_const_sptr expectedCacheFile, const std::string &instName, const std::string &xmlText) : m_xmlFile(boost::make_shared<NullIDFObject>()), - m_cacheFile(boost::make_shared<NullIDFObject>()), m_pDoc(NULL), + m_cacheFile(boost::make_shared<NullIDFObject>()), m_pDoc(nullptr), m_hasParameterElement_beenSet(false), m_haveDefaultFacing(false), m_deltaOffsets(false), m_angleConvertConst(1.0), m_indirectPositions(false), m_cachingOption(NoneApplied) { @@ -221,7 +221,7 @@ InstrumentDefinitionParser::parseXML(Kernel::ProgressBase *prog) { // Get all the type and component element pointers. std::vector<Element *> typeElems; std::vector<Element *> compElems; - for (Node *pNode = pRootElem->firstChild(); pNode != 0; + for (Node *pNode = pRootElem->firstChild(); pNode != nullptr; pNode = pNode->nextSibling()) { auto pElem = dynamic_cast<Element *>(pNode); if (pElem) { @@ -395,7 +395,7 @@ InstrumentDefinitionParser::parseXML(Kernel::ProgressBase *prog) { // order they are listed in the IDF. The latter needed to get detector IDs // assigned // as expected - for (Node *pNode = pElem->firstChild(); pNode != 0; + for (Node *pNode = pElem->firstChild(); pNode != nullptr; pNode = pNode->nextSibling()) { auto pChildElem = dynamic_cast<Element *>(pNode); if (!pChildElem) @@ -571,7 +571,7 @@ void InstrumentDefinitionParser::setLocation(Geometry::IComponent *comp, // Check if sub-elements <trans> or <rot> of present - for now ignore these if // m_deltaOffset = true - Element *pRecursive = NULL; + Element *pRecursive = nullptr; Element *tElem = pElem->getChildElement("trans"); Element *rElem = pElem->getChildElement("rot"); bool stillTransElement = true; @@ -589,7 +589,7 @@ void InstrumentDefinitionParser::setLocation(Geometry::IComponent *comp, if (tElem && rElem) { // if both a <trans> and <rot> child element present. Ignore <rot> element - rElem = NULL; + rElem = nullptr; } if (!tElem && !rElem) { @@ -1024,7 +1024,7 @@ void InstrumentDefinitionParser::appendAssembly( Element *pFound = pCompElem->ownerDocument()->getElementById(idlist, "idname"); - if (pFound == NULL) { + if (pFound == nullptr) { throw Kernel::Exception::InstrumentDefinitionError( "No <idlist> with name idname=\"" + idlist + "\" present in instrument definition file.", @@ -1196,7 +1196,7 @@ void InstrumentDefinitionParser::appendLeaf(Geometry::ICompAssembly *parent, Element *pFound = pCompElem->ownerDocument()->getElementById(idlist, "idname"); - if (pFound == NULL) { + if (pFound == nullptr) { throw Kernel::Exception::InstrumentDefinitionError( "No <idlist> with name idname=\"" + idlist + "\" present in instrument definition file.", @@ -2393,7 +2393,7 @@ void InstrumentDefinitionParser::adjust( // check if a <translate-rotate-combined-shape-to> is defined Poco::AutoPtr<NodeList> pNL_TransRot = pElem->getElementsByTagName("translate-rotate-combined-shape-to"); - Element *pTransRot = 0; + Element *pTransRot = nullptr; if (pNL_TransRot->length() == 1) { pTransRot = static_cast<Element *>(pNL_TransRot->item(0)); } @@ -2429,7 +2429,7 @@ void InstrumentDefinitionParser::adjust( CompAssembly *baseCoor = new CompAssembly( "base"); // dummy assembly used to get to end assembly if nested ICompAssembly *endComponent = - 0; // end assembly, its purpose is to hold the shape coordinate system + nullptr; // end assembly, its purpose is to hold the shape coordinate system // get shape coordinate system, returned as endComponent, as defined by pLoc // and nested <location> elements // of pLoc diff --git a/Framework/Geometry/src/Instrument/ObjComponent.cpp b/Framework/Geometry/src/Instrument/ObjComponent.cpp index 04d2143f861..186f83885a7 100644 --- a/Framework/Geometry/src/Instrument/ObjComponent.cpp +++ b/Framework/Geometry/src/Instrument/ObjComponent.cpp @@ -303,7 +303,7 @@ const V3D ObjComponent::takeOutRotation(V3D point) const { * nothing. */ void ObjComponent::draw() const { - if (Handle() == NULL) + if (Handle() == nullptr) return; // Render the ObjComponent and then render the object Handle()->Render(); @@ -313,7 +313,7 @@ void ObjComponent::draw() const { * Draws the Object */ void ObjComponent::drawObject() const { - if (shape() != NULL) + if (shape() != nullptr) shape()->draw(); } @@ -322,10 +322,10 @@ void ObjComponent::drawObject() const { * before rendering. */ void ObjComponent::initDraw() const { - if (Handle() == NULL) + if (Handle() == nullptr) return; // Render the ObjComponent and then render the object - if (shape() != NULL) + if (shape() != nullptr) shape()->initDraw(); Handle()->Initialize(); } diff --git a/Framework/Geometry/src/Instrument/ParameterMap.cpp b/Framework/Geometry/src/Instrument/ParameterMap.cpp index f491db4d599..c8c0ce2c26b 100644 --- a/Framework/Geometry/src/Instrument/ParameterMap.cpp +++ b/Framework/Geometry/src/Instrument/ParameterMap.cpp @@ -837,7 +837,7 @@ Parameter_sptr ParameterMap::getByType(const IComponent *comp, Parameter_sptr ParameterMap::getRecursiveByType(const IComponent *comp, const std::string &type) const { boost::shared_ptr<const IComponent> compInFocus(comp, NoDeleting()); - while (compInFocus != NULL) { + while (compInFocus != nullptr) { Parameter_sptr param = getByType(compInFocus.get(), type); if (param) { return param; diff --git a/Framework/Geometry/src/Instrument/RectangularDetector.cpp b/Framework/Geometry/src/Instrument/RectangularDetector.cpp index 2c2a8a2ec97..6fe38e93749 100644 --- a/Framework/Geometry/src/Instrument/RectangularDetector.cpp +++ b/Framework/Geometry/src/Instrument/RectangularDetector.cpp @@ -21,7 +21,7 @@ using Kernel::Matrix; /** Empty constructor */ RectangularDetector::RectangularDetector() - : CompAssembly(), IObjComponent(NULL), m_rectBase(NULL), m_minDetId(0), + : CompAssembly(), IObjComponent(nullptr), m_rectBase(nullptr), m_minDetId(0), m_maxDetId(0) { init(); @@ -34,7 +34,7 @@ RectangularDetector::RectangularDetector() * */ RectangularDetector::RectangularDetector(const RectangularDetector *base, const ParameterMap *map) - : CompAssembly(base, map), IObjComponent(NULL), m_rectBase(base), + : CompAssembly(base, map), IObjComponent(nullptr), m_rectBase(base), m_minDetId(0), m_maxDetId(0) { init(); setGeometryHandler(new BitmapGeometryHandler(this)); @@ -51,7 +51,7 @@ RectangularDetector::RectangularDetector(const RectangularDetector *base, */ RectangularDetector::RectangularDetector(const std::string &n, IComponent *reference) - : CompAssembly(n, reference), IObjComponent(NULL), m_rectBase(NULL), + : CompAssembly(n, reference), IObjComponent(nullptr), m_rectBase(nullptr), m_minDetId(0), m_maxDetId(0) { init(); this->setName(n); @@ -669,7 +669,7 @@ unsigned int RectangularDetector::getTextureID() const { return m_textureID; } void RectangularDetector::draw() const { // std::cout << "RectangularDetector::draw() called for " << this->getName() // << "\n"; - if (Handle() == NULL) + if (Handle() == nullptr) return; // Render the ObjComponent and then render the object Handle()->Render(); @@ -691,7 +691,7 @@ void RectangularDetector::drawObject() const { void RectangularDetector::initDraw() const { // std::cout << "RectangularDetector::initDraw() called for " << // this->getName() << "\n"; - if (Handle() == NULL) + if (Handle() == nullptr) return; // Render the ObjComponent and then render the object // if(shape!=NULL) shape->initDraw(); diff --git a/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp b/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp index a68e26b2c1c..ae7c0a900e2 100644 --- a/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp +++ b/Framework/Geometry/src/MDGeometry/CompositeImplicitFunction.cpp @@ -21,7 +21,7 @@ CompositeImplicitFunction::~CompositeImplicitFunction() {} bool CompositeImplicitFunction::addFunction( Mantid::Geometry::MDImplicitFunction_sptr constituentFunction) { bool bSuccess = false; - if (constituentFunction.get() != NULL) { + if (constituentFunction.get() != nullptr) { this->m_Functions.push_back(constituentFunction); bSuccess = true; } diff --git a/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp b/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp index a6033082b84..8bef79efd77 100644 --- a/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp +++ b/Framework/Geometry/src/MDGeometry/IMDDimensionFactory.cpp @@ -47,7 +47,7 @@ IMDDimension_sptr createDimension(const Poco::XML::Element &dimensionXML) { } Poco::XML::Element *nameElement = dimensionXML.getChildElement("Name"); - if (NULL == nameElement) { + if (nullptr == nameElement) { throw std::invalid_argument( "Invalid string passed to createDimension: No Name element"); } @@ -55,27 +55,27 @@ IMDDimension_sptr createDimension(const Poco::XML::Element &dimensionXML) { Poco::XML::Element *unitsElement = dimensionXML.getChildElement("Units"); std::string units = "None"; - if (NULL != unitsElement) { + if (nullptr != unitsElement) { // Set units if they exist. units = unitsElement->innerText(); } Poco::XML::Element *frameElement = dimensionXML.getChildElement("Frame"); std::string frame = "Unknown frame"; - if (NULL != frameElement) { + if (nullptr != frameElement) { // Set the frame if it exists frame = frameElement->innerText(); } Poco::XML::Element *upperBoundsElement = dimensionXML.getChildElement("UpperBounds"); - if (NULL == upperBoundsElement) { + if (nullptr == upperBoundsElement) { throw std::invalid_argument( "Invalid string passed to createDimension: No UpperBounds element"); } Poco::XML::Element *lowerBoundsElement = dimensionXML.getChildElement("LowerBounds"); - if (NULL == lowerBoundsElement) { + if (nullptr == lowerBoundsElement) { throw std::invalid_argument( "Invalid string passed to createDimension: No LowerBounds element"); } @@ -93,7 +93,7 @@ IMDDimension_sptr createDimension(const Poco::XML::Element &dimensionXML) { Poco::XML::Element *numBinsElement = dimensionXML.getChildElement("NumberOfBins"); - if (NULL == numBinsElement) { + if (nullptr == numBinsElement) { throw std::invalid_argument( "Invalid string passed to createDimension: No NumberOfBins element"); } @@ -107,7 +107,7 @@ IMDDimension_sptr createDimension(const Poco::XML::Element &dimensionXML) { Poco::XML::Element *integrationXML = dimensionXML.getChildElement("Integrated"); - if (NULL != integrationXML) { + if (nullptr != integrationXML) { double upperLimit = atof( integrationXML->getChildElement("UpperLimit")->innerText().c_str()); double lowerLimit = atof( diff --git a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp index ff15b1395b1..c5aa3024884 100644 --- a/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp +++ b/Framework/Geometry/src/MDGeometry/MDGeometryXMLBuilder.cpp @@ -44,7 +44,7 @@ template <typename CheckDimensionPolicy> bool MDGeometryBuilderXML<CheckDimensionPolicy>::addOrdinaryDimension( IMDDimension_const_sptr dimensionToAdd) const { bool bAdded = false; // Addition fails by default. - if (dimensionToAdd.get() != NULL) { + if (dimensionToAdd.get() != nullptr) { CompareIMDDimension_const_sptr comparitor(dimensionToAdd); auto location = std::find_if(m_vecDimensions.begin(), m_vecDimensions.end(), comparitor); @@ -119,7 +119,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addXDimension( IMDDimension_const_sptr dimension) const { bool bAdded = false; - if (dimension.get() != NULL) { + if (dimension.get() != nullptr) { applyPolicyChecking(dimension); addOrdinaryDimension(dimension); m_spXDimension = dimension; @@ -139,7 +139,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addYDimension( IMDDimension_const_sptr dimension) const { bool bAdded = false; - if (dimension.get() != NULL) { + if (dimension.get() != nullptr) { applyPolicyChecking(dimension); addOrdinaryDimension(dimension); m_spYDimension = dimension; @@ -158,7 +158,7 @@ template <typename CheckDimensionPolicy> bool MDGeometryBuilderXML<CheckDimensionPolicy>::addZDimension( IMDDimension_const_sptr dimension) const { bool bAdded = false; - if (dimension.get() != NULL) { + if (dimension.get() != nullptr) { applyPolicyChecking(dimension); addOrdinaryDimension(dimension); m_spZDimension = dimension; @@ -178,7 +178,7 @@ bool MDGeometryBuilderXML<CheckDimensionPolicy>::addTDimension( IMDDimension_const_sptr dimension) const { bool bAdded = false; - if (dimension.get() != NULL) { + if (dimension.get() != nullptr) { applyPolicyChecking(dimension); addOrdinaryDimension(dimension); m_spTDimension = dimension; @@ -273,22 +273,22 @@ const std::string &MDGeometryBuilderXML<CheckDimensionPolicy>::create() const { template <typename CheckDimensionPolicy> bool MDGeometryBuilderXML<CheckDimensionPolicy>::hasXDimension() const { - return NULL != this->m_spXDimension.get(); + return nullptr != this->m_spXDimension.get(); } template <typename CheckDimensionPolicy> bool MDGeometryBuilderXML<CheckDimensionPolicy>::hasYDimension() const { - return NULL != this->m_spYDimension.get(); + return nullptr != this->m_spYDimension.get(); } template <typename CheckDimensionPolicy> bool MDGeometryBuilderXML<CheckDimensionPolicy>::hasZDimension() const { - return NULL != this->m_spZDimension.get(); + return nullptr != this->m_spZDimension.get(); } template <typename CheckDimensionPolicy> bool MDGeometryBuilderXML<CheckDimensionPolicy>::hasTDimension() const { - return NULL != this->m_spTDimension.get(); + return nullptr != this->m_spTDimension.get(); } template <typename CheckDimensionPolicy> diff --git a/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp b/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp index 64793e5f038..23d43cdecd5 100644 --- a/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp +++ b/Framework/Geometry/src/MDGeometry/MDGeometryXMLParser.cpp @@ -51,11 +51,11 @@ void MDGeometryXMLParser::execute() { Poco::AutoPtr<Poco::XML::Document> pDoc = pParser.parseString(m_xmlToProcess); Poco::XML::Element *pRootElem = pDoc->documentElement(); // Apply root node checking if supplied. - Poco::XML::Element *geometryXMLElement = NULL; + Poco::XML::Element *geometryXMLElement = nullptr; if (!m_rootNodeName.empty()) { Poco::XML::Element *temp = pRootElem->getChildElement(m_rootNodeName); geometryXMLElement = temp; - if (geometryXMLElement == NULL) { + if (geometryXMLElement == nullptr) { std::string message = "Root node was not found to be the expected value of " + m_rootNodeName; @@ -266,7 +266,7 @@ MDGeometryXMLParser::getAllDimensions() const { */ bool MDGeometryXMLParser::hasXDimension() const { validate(); - return NULL != m_xDimension.get(); + return nullptr != m_xDimension.get(); } /** @@ -275,7 +275,7 @@ bool MDGeometryXMLParser::hasXDimension() const { */ bool MDGeometryXMLParser::hasYDimension() const { validate(); - return NULL != m_yDimension.get(); + return nullptr != m_yDimension.get(); } /** @@ -284,7 +284,7 @@ bool MDGeometryXMLParser::hasYDimension() const { */ bool MDGeometryXMLParser::hasZDimension() const { validate(); - return NULL != m_zDimension.get(); + return nullptr != m_zDimension.get(); } /** @@ -293,7 +293,7 @@ bool MDGeometryXMLParser::hasZDimension() const { */ bool MDGeometryXMLParser::hasTDimension() const { validate(); - return NULL != m_tDimension.get(); + return nullptr != m_tDimension.get(); } /** diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index 0ea4f61ad13..c6f1c2ea9d6 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -1554,7 +1554,7 @@ Assessor function to get a Comp points */ { if (Index < 0 || Index >= static_cast<int>(Comp.size())) - return 0; + return nullptr; return &Comp[Index]; } diff --git a/Framework/Geometry/src/Objects/Object.cpp b/Framework/Geometry/src/Objects/Object.cpp index 91420767786..4d8dfd1f894 100644 --- a/Framework/Geometry/src/Objects/Object.cpp +++ b/Framework/Geometry/src/Objects/Object.cpp @@ -61,7 +61,7 @@ Object::Object(const std::string &shapeXML) * @param A :: The object to initialise this copy from */ Object::Object(const Object &A) - : ObjName(A.ObjName), TopRule((A.TopRule) ? A.TopRule->clone() : NULL), + : ObjName(A.ObjName), TopRule((A.TopRule) ? A.TopRule->clone() : nullptr), m_boundingBox(A.m_boundingBox), AABBxMax(A.AABBxMax), AABByMax(A.AABByMax), AABBzMax(A.AABBzMax), AABBxMin(A.AABBxMin), AABByMin(A.AABByMin), AABBzMin(A.AABBzMin), boolBounded(A.boolBounded), @@ -80,7 +80,7 @@ Object::Object(const Object &A) Object &Object::operator=(const Object &A) { if (this != &A) { ObjName = A.ObjName; - TopRule = (A.TopRule) ? A.TopRule->clone() : 0; + TopRule = (A.TopRule) ? A.TopRule->clone() : nullptr; AABBxMax = A.AABBxMax; AABByMax = A.AABByMax; AABBzMax = A.AABBzMax; @@ -126,7 +126,7 @@ const Kernel::Material &Object::material() const { return m_material; } */ bool Object::hasValidShape() const { // Assume invalid shape if object has no 'TopRule' or surfaces - return (TopRule != NULL && !SurList.empty()); + return (TopRule != nullptr && !SurList.empty()); } /** @@ -668,7 +668,7 @@ void Object::write(std::ostream &OX) const { * @returns 1 on success */ int Object::procString(const std::string &Line) { - TopRule = 0; + TopRule = nullptr; std::map<int, std::unique_ptr<Rule>> RuleList; // List for the rules int Ridx = 0; // Current index (not necessary size of RuleList // SURFACE REPLACEMENT @@ -1835,7 +1835,7 @@ int Object::searchForObject(Kernel::V3D &point) const { * the calling function. */ void Object::setGeometryHandler(boost::shared_ptr<GeometryHandler> h) { - if (h == NULL) + if (h == nullptr) return; handle = h; } @@ -1845,7 +1845,7 @@ void Object::setGeometryHandler(boost::shared_ptr<GeometryHandler> h) { * function does nothing. */ void Object::draw() const { - if (handle == NULL) + if (handle == nullptr) return; // Render the Object handle->Render(); @@ -1857,7 +1857,7 @@ void Object::draw() const { * If the handler is not set then this function does nothing. */ void Object::initDraw() const { - if (handle == NULL) + if (handle == nullptr) return; // Render the Object handle->Initialize(); @@ -1897,16 +1897,16 @@ void Object::updateGeometryHandler() { return; bGeometryCaching = true; // Check if the Geometry handler can be handled for cache - if (handle == NULL) + if (handle == nullptr) return; if (!handle->canTriangulate()) return; // Check if the reader exist then read the cache - if (vtkCacheReader.get() != NULL) { + if (vtkCacheReader.get() != nullptr) { vtkCacheReader->readCacheForObject(this); } // Check if the writer exist then write the cache - if (vtkCacheWriter.get() != NULL) { + if (vtkCacheWriter.get() != nullptr) { vtkCacheWriter->addObject(this); } } @@ -1918,7 +1918,7 @@ void Object::updateGeometryHandler() { * @return the number of triangles */ int Object::NumberOfTriangles() const { - if (handle == NULL) + if (handle == nullptr) return 0; return handle->NumberOfTriangles(); } @@ -1927,7 +1927,7 @@ int Object::NumberOfTriangles() const { * get number of points */ int Object::NumberOfPoints() const { - if (handle == NULL) + if (handle == nullptr) return 0; return handle->NumberOfPoints(); } @@ -1936,8 +1936,8 @@ int Object::NumberOfPoints() const { * get vertices */ double *Object::getTriangleVertices() const { - if (handle == NULL) - return NULL; + if (handle == nullptr) + return nullptr; return handle->getTriangleVertices(); } @@ -1945,8 +1945,8 @@ double *Object::getTriangleVertices() const { * get faces */ int *Object::getTriangleFaces() const { - if (handle == NULL) - return NULL; + if (handle == nullptr) + return nullptr; return handle->getTriangleFaces(); } @@ -1956,7 +1956,7 @@ int *Object::getTriangleFaces() const { void Object::GetObjectGeom(int &type, std::vector<Kernel::V3D> &vectors, double &myradius, double &myheight) const { type = 0; - if (handle == NULL) + if (handle == nullptr) return; handle->GetObjectGeom(type, vectors, myradius, myheight); } diff --git a/Framework/Geometry/src/Objects/RuleItems.cpp b/Framework/Geometry/src/Objects/RuleItems.cpp index 7b7f4ff4517..bba20e95262 100644 --- a/Framework/Geometry/src/Objects/RuleItems.cpp +++ b/Framework/Geometry/src/Objects/RuleItems.cpp @@ -232,10 +232,10 @@ Rule *Intersection::findKey(const int KeyN) @retval Rule* if an appropiate leaf is found */ { - Rule *PtrOut = (A) ? A->findKey(KeyN) : 0; + Rule *PtrOut = (A) ? A->findKey(KeyN) : nullptr; if (PtrOut) return PtrOut; - return (B) ? B->findKey(KeyN) : 0; + return (B) ? B->findKey(KeyN) : nullptr; } std::string Intersection::display() const @@ -534,10 +534,10 @@ Rule *Union::findKey(const int KeyN) */ { - Rule *PtrOut = (A) ? A->findKey(KeyN) : 0; + Rule *PtrOut = (A) ? A->findKey(KeyN) : nullptr; if (PtrOut) return PtrOut; - return (B) ? B->findKey(KeyN) : 0; + return (B) ? B->findKey(KeyN) : nullptr; } int Union::isComplementary() const @@ -758,7 +758,7 @@ Rule *SurfPoint::findKey(const int KeyNum) @retval Rule* if an appropiate leaf is found */ { - return (KeyNum == keyN) ? this : 0; + return (KeyNum == keyN) ? this : nullptr; } void SurfPoint::setKeyN(const int Ky) @@ -971,7 +971,7 @@ TopoDS_Shape SurfPoint::analyze() { //---------------------------------------- CompObj::CompObj() - : Rule(), objN(0), key(0) + : Rule(), objN(0), key(nullptr) /** Constructor */ @@ -1079,7 +1079,7 @@ Rule *CompObj::findKey(const int i) */ { (void)i; // Avoid compiler warning - return 0; + return nullptr; } int CompObj::findLeaf(const Rule *A) const @@ -1536,7 +1536,7 @@ Rule *CompGrp::findKey(const int i) */ { (void)i; // Avoid compiler warning - return 0; + return nullptr; } int CompGrp::findLeaf(const Rule *R) const diff --git a/Framework/Geometry/src/Objects/Rules.cpp b/Framework/Geometry/src/Objects/Rules.cpp index c94bd9f171b..1b14e4c9aff 100644 --- a/Framework/Geometry/src/Objects/Rules.cpp +++ b/Framework/Geometry/src/Objects/Rules.cpp @@ -76,7 +76,7 @@ int Rule::removeComplementary(std::unique_ptr<Rule> &TopRule) while (active) { active = 0; std::stack<DTriple<Rule *, int, Rule *>> TreeLine; // Tree stack of rules - TreeLine.push(DTriple<Rule *, int, Rule *>(0, 0, TopRule.get())); + TreeLine.push(DTriple<Rule *, int, Rule *>(nullptr, 0, TopRule.get())); while (!active && !TreeLine.empty()) // need to exit on active { @@ -111,11 +111,11 @@ int Rule::removeComplementary(std::unique_ptr<Rule> &TopRule) if (TreeComp.first) { TreeComp.first = tmpA->leaf(0); // delete tmpA - tmpA->setLeaf(0, 0); + tmpA->setLeaf(nullptr, 0); Rule *parentOfA = tmpA->getParent(); if (parentOfA) { int leafNumber = parentOfA->findLeaf(tmpA); - parentOfA->setLeaf(NULL, leafNumber); + parentOfA->setLeaf(nullptr, leafNumber); } } } @@ -174,7 +174,7 @@ int Rule::makeCNFcopy(std::unique_ptr<Rule> &TopRule) // Start by putting the top item on the Tree Stack. // Note that it doesn't have a parent. - TreeLine.push(DTriple<Rule *, int, Rule *>(0, 0, TopRule.get())); + TreeLine.push(DTriple<Rule *, int, Rule *>(nullptr, 0, TopRule.get())); // Exit condition is that nothing changed last time // or the tree is Empty. @@ -218,8 +218,8 @@ int Rule::makeCNFcopy(std::unique_ptr<Rule> &TopRule) -1) // ok the LHS is a union. (a ^ b) v g ==> (a v g) ^ (b v g ) { // Make copies of the Unions leaves (allowing for null union) - alpha = (tmpB->leaf(0)) ? tmpB->leaf(0)->clone() : 0; - beta = (tmpB->leaf(1)) ? tmpB->leaf(1)->clone() : 0; + alpha = (tmpB->leaf(0)) ? tmpB->leaf(0)->clone() : nullptr; + beta = (tmpB->leaf(1)) ? tmpB->leaf(1)->clone() : nullptr; gamma = tmpC->clone(); } else // RHS a v (b ^ g) ==> (a v b) ^ (a v g ) { @@ -227,8 +227,8 @@ int Rule::makeCNFcopy(std::unique_ptr<Rule> &TopRule) // Note :: alpha designated as beta , gamma plays the role of alpha // in the RHS part of the above equation (allows common replace // block below. - alpha = (tmpC->leaf(0)) ? tmpC->leaf(0)->clone() : 0; - beta = (tmpC->leaf(1)) ? tmpC->leaf(1)->clone() : 0; + alpha = (tmpC->leaf(0)) ? tmpC->leaf(0)->clone() : nullptr; + beta = (tmpC->leaf(1)) ? tmpC->leaf(1)->clone() : nullptr; gamma = tmpB->clone(); } // Have bit to replace @@ -398,7 +398,7 @@ int Rule::removeItem(std::unique_ptr<Rule> &TRule, const int SurfN) Rule *Ptr = TRule->findKey(SurfN); while (Ptr) { Rule *LevelOne = Ptr->getParent(); // Must work - Rule *LevelTwo = (LevelOne) ? LevelOne->getParent() : 0; + Rule *LevelTwo = (LevelOne) ? LevelOne->getParent() : nullptr; if (LevelTwo) /// Not the top level { @@ -414,7 +414,7 @@ int Rule::removeItem(std::unique_ptr<Rule> &TRule, const int SurfN) Rule *PObj = (LevelOne->leaf(0) != Ptr) ? LevelOne->leaf(0) : LevelOne->leaf(1); - PObj->setParent(0); /// New Top rule + PObj->setParent(nullptr); /// New Top rule TRule = PObj->clone(); } else // Basic surf object { @@ -433,14 +433,14 @@ int Rule::removeItem(std::unique_ptr<Rule> &TRule, const int SurfN) } Rule::Rule() - : Parent(0) + : Parent(nullptr) /** Standard Constructor */ {} Rule::Rule(const Rule &) - : Parent(0) + : Parent(nullptr) /** Constructor copies. Parent set to 0 diff --git a/Framework/Geometry/src/Objects/ShapeFactory.cpp b/Framework/Geometry/src/Objects/ShapeFactory.cpp index 69e7181d95a..a28a9bea639 100644 --- a/Framework/Geometry/src/Objects/ShapeFactory.cpp +++ b/Framework/Geometry/src/Objects/ShapeFactory.cpp @@ -148,7 +148,7 @@ boost::shared_ptr<Object> ShapeFactory::createShape(Poco::XML::Element *pElem) { int l_id = 1; // used to build up unique id's for each shape added. Must start // from int > zero. - Element *lastElement = NULL; // This is to store element for the fixed + Element *lastElement = nullptr; // This is to store element for the fixed // complete objects such as sphere,cone,cylinder // and cuboid for (unsigned int i = 0; i < pNL_length; i++) { @@ -279,7 +279,7 @@ boost::shared_ptr<Object> ShapeFactory::createShape(Poco::XML::Element *pElem) { retVal->setObject(21, algebraFromUser); retVal->populate(primitives); // check whether there is only one surface/closed surface - if (numPrimitives == 1 && lastElement != NULL) // special case + if (numPrimitives == 1 && lastElement != nullptr) // special case { // parse the primitive and create a Geometry handler for the object createGeometryHandler(lastElement, retVal); @@ -1199,7 +1199,7 @@ ShapeFactory::getOptionalShapeElement(Poco::XML::Element *pElem, // Allow zero or one occurances of subelements with the given name. Poco::AutoPtr<NodeList> pNL = pElem->getElementsByTagName(name); if (pNL->length() == 0) - return NULL; + return nullptr; else if (pNL->length() > 1) throw std::invalid_argument( "XML element: <" + pElem->tagName() + diff --git a/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp b/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp index 6b7e298ba75..473269de7dd 100644 --- a/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/BitmapGeometryHandler.cpp @@ -25,7 +25,7 @@ BitmapGeometryHandler::BitmapGeometryHandler(RectangularDetector *comp) } BitmapGeometryHandler::BitmapGeometryHandler() - : GeometryHandler((Object *)NULL), m_rectDet(NULL) {} + : GeometryHandler((Object *)nullptr), m_rectDet(nullptr) {} /// Destructor BitmapGeometryHandler::~BitmapGeometryHandler() {} diff --git a/Framework/Geometry/src/Rendering/CacheGeometryGenerator.cpp b/Framework/Geometry/src/Rendering/CacheGeometryGenerator.cpp index dcb1b8b6c9a..6038a712b7b 100644 --- a/Framework/Geometry/src/Rendering/CacheGeometryGenerator.cpp +++ b/Framework/Geometry/src/Rendering/CacheGeometryGenerator.cpp @@ -19,8 +19,8 @@ namespace Geometry { CacheGeometryGenerator::CacheGeometryGenerator(Object *obj) : Obj(obj) { mNoOfVertices = 0; mNoOfTriangles = 0; - mFaces = NULL; - mPoints = NULL; + mFaces = nullptr; + mPoints = nullptr; } /** @@ -45,9 +45,9 @@ void CacheGeometryGenerator::Generate() { * Destroy the surface generated for the object */ CacheGeometryGenerator::~CacheGeometryGenerator() { - if (mFaces != NULL) + if (mFaces != nullptr) delete[] mFaces; - if (mPoints != NULL) + if (mPoints != nullptr) delete[] mPoints; } @@ -68,9 +68,9 @@ int *CacheGeometryGenerator::getTriangleFaces() { return mFaces; } */ void CacheGeometryGenerator::setGeometryCache(int noPts, int noFaces, double *pts, int *faces) { - if (mPoints != NULL) + if (mPoints != nullptr) delete[] mPoints; - if (mFaces != NULL) + if (mFaces != nullptr) delete[] mFaces; mNoOfVertices = noPts; mNoOfTriangles = noFaces; diff --git a/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp b/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp index 6c3948ce7ad..52fbc651ed6 100644 --- a/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/CacheGeometryHandler.cpp @@ -12,7 +12,7 @@ namespace Geometry { CacheGeometryHandler::CacheGeometryHandler(IObjComponent *comp) : GeometryHandler(comp) { - Triangulator = NULL; + Triangulator = nullptr; Renderer = new CacheGeometryRenderer(); } @@ -33,14 +33,14 @@ boost::shared_ptr<GeometryHandler> CacheGeometryHandler::clone() const { if (this->Triangulator) clone->Triangulator = new CacheGeometryGenerator(this->Obj); else - clone->Triangulator = NULL; + clone->Triangulator = nullptr; return clone; } CacheGeometryHandler::~CacheGeometryHandler() { - if (Triangulator != NULL) + if (Triangulator != nullptr) delete Triangulator; - if (Renderer != NULL) + if (Renderer != nullptr) delete Renderer; } @@ -60,39 +60,39 @@ GeometryHandler *CacheGeometryHandler::createInstance(Object *obj) { void CacheGeometryHandler::Triangulate() { // Check whether Object is triangulated otherwise triangulate PARALLEL_CRITICAL(Triangulate) - if (Obj != NULL && !boolTriangulated) { + if (Obj != nullptr && !boolTriangulated) { Triangulator->Generate(); boolTriangulated = true; } } void CacheGeometryHandler::Render() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); Renderer->Render( Triangulator->getNumberOfPoints(), Triangulator->getNumberOfTriangles(), Triangulator->getTriangleVertices(), Triangulator->getTriangleFaces()); - } else if (ObjComp != NULL) { + } else if (ObjComp != nullptr) { Renderer->Render(ObjComp); } } void CacheGeometryHandler::Initialize() { - if (Obj != NULL) { + if (Obj != nullptr) { Obj->updateGeometryHandler(); if (boolTriangulated == false) Triangulate(); Renderer->Initialize( Triangulator->getNumberOfPoints(), Triangulator->getNumberOfTriangles(), Triangulator->getTriangleVertices(), Triangulator->getTriangleFaces()); - } else if (ObjComp != NULL) { + } else if (ObjComp != nullptr) { Renderer->Initialize(ObjComp); } } int CacheGeometryHandler::NumberOfTriangles() { - if (Obj != NULL) { + if (Obj != nullptr) { Obj->updateGeometryHandler(); if (boolTriangulated == false) Triangulate(); @@ -103,7 +103,7 @@ int CacheGeometryHandler::NumberOfTriangles() { } int CacheGeometryHandler::NumberOfPoints() { - if (Obj != NULL) { + if (Obj != nullptr) { Obj->updateGeometryHandler(); if (boolTriangulated == false) Triangulate(); @@ -114,24 +114,24 @@ int CacheGeometryHandler::NumberOfPoints() { } double *CacheGeometryHandler::getTriangleVertices() { - if (Obj != NULL) { + if (Obj != nullptr) { Obj->updateGeometryHandler(); if (boolTriangulated == false) Triangulate(); return Triangulator->getTriangleVertices(); } else { - return NULL; + return nullptr; } } int *CacheGeometryHandler::getTriangleFaces() { - if (Obj != NULL) { + if (Obj != nullptr) { Obj->updateGeometryHandler(); if (boolTriangulated == false) Triangulate(); return Triangulator->getTriangleFaces(); } else { - return NULL; + return nullptr; } } diff --git a/Framework/Geometry/src/Rendering/GeometryHandler.cpp b/Framework/Geometry/src/Rendering/GeometryHandler.cpp index 21623e2739b..75b3d9215f9 100644 --- a/Framework/Geometry/src/Rendering/GeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/GeometryHandler.cpp @@ -19,7 +19,7 @@ GeometryHandler::GeometryHandler(IObjComponent *comp) : Obj() { */ GeometryHandler::GeometryHandler(boost::shared_ptr<Object> obj) : Obj(obj.get()) { - ObjComp = NULL; + ObjComp = nullptr; boolTriangulated = false; boolIsInitialized = false; } @@ -29,12 +29,12 @@ GeometryHandler::GeometryHandler(boost::shared_ptr<Object> obj) * This geometry handler will be Object's geometry handler */ GeometryHandler::GeometryHandler(Object *obj) : Obj(obj) { - ObjComp = NULL; + ObjComp = nullptr; boolTriangulated = false; boolIsInitialized = false; } /// Destructor -GeometryHandler::~GeometryHandler() { ObjComp = NULL; } +GeometryHandler::~GeometryHandler() { ObjComp = nullptr; } } } diff --git a/Framework/Geometry/src/Rendering/GluGeometryHandler.cpp b/Framework/Geometry/src/Rendering/GluGeometryHandler.cpp index 18afc9da75f..23fc745b7c7 100644 --- a/Framework/Geometry/src/Rendering/GluGeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/GluGeometryHandler.cpp @@ -32,7 +32,7 @@ boost::shared_ptr<GeometryHandler> GluGeometryHandler::clone() const { } GluGeometryHandler::~GluGeometryHandler() { - if (Renderer != NULL) + if (Renderer != nullptr) delete Renderer; } @@ -56,7 +56,7 @@ void GluGeometryHandler::Triangulate() { } void GluGeometryHandler::Render() { - if (Obj != NULL) { + if (Obj != nullptr) { switch (type) { case CUBOID: (dynamic_cast<GluGeometryRenderer *>(Renderer)) @@ -79,7 +79,7 @@ void GluGeometryHandler::Render() { ->RenderSegmentedCylinder(center, axis, radius, height); break; } - } else if (ObjComp != NULL) { + } else if (ObjComp != nullptr) { Renderer->Render(ObjComp); } } @@ -88,7 +88,7 @@ void GluGeometryHandler::GetObjectGeom(int &mytype, std::vector<Kernel::V3D> &vectors, double &myradius, double &myheight) { mytype = 0; - if (Obj != NULL) { + if (Obj != nullptr) { switch (type) { case CUBOID: mytype = 1; @@ -128,7 +128,7 @@ void GluGeometryHandler::GetObjectGeom(int &mytype, } void GluGeometryHandler::Initialize() { - if (Obj != NULL) { + if (Obj != nullptr) { // There is no initialization or probably call render Render(); } diff --git a/Framework/Geometry/src/Rendering/OCGeometryGenerator.cpp b/Framework/Geometry/src/Rendering/OCGeometryGenerator.cpp index 35768fab559..52817635eaa 100644 --- a/Framework/Geometry/src/Rendering/OCGeometryGenerator.cpp +++ b/Framework/Geometry/src/Rendering/OCGeometryGenerator.cpp @@ -78,14 +78,14 @@ Kernel::Logger g_log("OCGeometryGenerator"); * @param obj :: input object */ OCGeometryGenerator::OCGeometryGenerator(const Object *obj) : Obj(obj) { - ObjSurface = NULL; + ObjSurface = nullptr; } /** * Generate geometry, it uses OpenCascade to generate surface triangles. */ void OCGeometryGenerator::Generate() { - if (ObjSurface == NULL) { + if (ObjSurface == nullptr) { AnalyzeObject(); } } @@ -94,7 +94,7 @@ void OCGeometryGenerator::Generate() { * Destroy the surface generated for the object */ OCGeometryGenerator::~OCGeometryGenerator() { - if (ObjSurface != NULL) { + if (ObjSurface != nullptr) { delete ObjSurface; } } @@ -103,11 +103,11 @@ OCGeometryGenerator::~OCGeometryGenerator() { * Analyzes the rule tree in object and creates a Topology Shape */ void OCGeometryGenerator::AnalyzeObject() { - if (Obj != NULL) // If object exists + if (Obj != nullptr) // If object exists { // Get the top rule tree in Obj const Rule *top = Obj->topRule(); - if (top == NULL) { + if (top == nullptr) { ObjSurface = new TopoDS_Shape(); return; } @@ -129,7 +129,7 @@ TopoDS_Shape *OCGeometryGenerator::getObjectSurface() { return ObjSurface; } int OCGeometryGenerator::getNumberOfTriangles() { int countFace = 0; - if (ObjSurface != NULL) { + if (ObjSurface != nullptr) { TopExp_Explorer Ex; for (Ex.Init(*ObjSurface, TopAbs_FACE); Ex.More(); Ex.Next()) { TopoDS_Face F = TopoDS::Face(Ex.Current()); @@ -143,7 +143,7 @@ int OCGeometryGenerator::getNumberOfTriangles() { int OCGeometryGenerator::getNumberOfPoints() { int countVert = 0; - if (ObjSurface != NULL) { + if (ObjSurface != nullptr) { TopExp_Explorer Ex; for (Ex.Init(*ObjSurface, TopAbs_FACE); Ex.More(); Ex.Next()) { TopoDS_Face F = TopoDS::Face(Ex.Current()); @@ -156,7 +156,7 @@ int OCGeometryGenerator::getNumberOfPoints() { } double *OCGeometryGenerator::getTriangleVertices() { - double *points = NULL; + double *points = nullptr; int nPts = this->getNumberOfPoints(); if (nPts > 0) { points = new double[static_cast<std::size_t>(nPts) * 3]; @@ -181,7 +181,7 @@ double *OCGeometryGenerator::getTriangleVertices() { } int *OCGeometryGenerator::getTriangleFaces() { - int *faces = NULL; + int *faces = nullptr; int nFaces = this->getNumberOfTriangles(); // was Points if (nFaces > 0) { faces = new int[static_cast<std::size_t>(nFaces) * 3]; diff --git a/Framework/Geometry/src/Rendering/OCGeometryHandler.cpp b/Framework/Geometry/src/Rendering/OCGeometryHandler.cpp index b82c21c7abe..47bfdf14894 100644 --- a/Framework/Geometry/src/Rendering/OCGeometryHandler.cpp +++ b/Framework/Geometry/src/Rendering/OCGeometryHandler.cpp @@ -11,7 +11,7 @@ namespace Mantid { namespace Geometry { OCGeometryHandler::OCGeometryHandler(IObjComponent *comp) : GeometryHandler(comp) { - Triangulator = NULL; + Triangulator = nullptr; Renderer = new OCGeometryRenderer(); } @@ -35,9 +35,9 @@ boost::shared_ptr<GeometryHandler> OCGeometryHandler::clone() const { } OCGeometryHandler::~OCGeometryHandler() { - if (Triangulator != NULL) + if (Triangulator != nullptr) delete Triangulator; - if (Renderer != NULL) + if (Renderer != nullptr) delete Renderer; } @@ -56,34 +56,34 @@ GeometryHandler *OCGeometryHandler::createInstance(Object *obj) { void OCGeometryHandler::Triangulate() { // Check whether Object is triangulated otherwise triangulate - if (Obj != NULL && !boolTriangulated) { + if (Obj != nullptr && !boolTriangulated) { Triangulator->Generate(); boolTriangulated = true; } } void OCGeometryHandler::Render() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); Renderer->Render(Triangulator->getObjectSurface()); - } else if (ObjComp != NULL) { + } else if (ObjComp != nullptr) { Renderer->Render(ObjComp); } } void OCGeometryHandler::Initialize() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); Renderer->Initialize(Triangulator->getObjectSurface()); - } else if (ObjComp != NULL) { + } else if (ObjComp != nullptr) { Renderer->Initialize(ObjComp); } } int OCGeometryHandler::NumberOfTriangles() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); return Triangulator->getNumberOfTriangles(); @@ -93,7 +93,7 @@ int OCGeometryHandler::NumberOfTriangles() { } int OCGeometryHandler::NumberOfPoints() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); return Triangulator->getNumberOfPoints(); @@ -103,22 +103,22 @@ int OCGeometryHandler::NumberOfPoints() { } double *OCGeometryHandler::getTriangleVertices() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); return Triangulator->getTriangleVertices(); } else { - return NULL; + return nullptr; } } int *OCGeometryHandler::getTriangleFaces() { - if (Obj != NULL) { + if (Obj != nullptr) { if (boolTriangulated == false) Triangulate(); return Triangulator->getTriangleFaces(); } else { - return NULL; + return nullptr; } } } diff --git a/Framework/Geometry/src/Rendering/OCGeometryRenderer.cpp b/Framework/Geometry/src/Rendering/OCGeometryRenderer.cpp index e713533cada..5e3cc614378 100644 --- a/Framework/Geometry/src/Rendering/OCGeometryRenderer.cpp +++ b/Framework/Geometry/src/Rendering/OCGeometryRenderer.cpp @@ -69,7 +69,7 @@ void OCGeometryRenderer::Render(TopoDS_Shape *ObjSurf) { Initialize(ObjSurf); } * @param ObjComp :: input to render */ void OCGeometryRenderer::Render(IObjComponent *ObjComp) { - if (ObjComp == NULL) + if (ObjComp == nullptr) return; glPushMatrix(); V3D pos = ObjComp->getPos(); @@ -117,7 +117,7 @@ void OCGeometryRenderer::Initialize(IObjComponent *ObjComp) { * Renders TopoDS Shape by traversing through the TopoDS_Shape */ void OCGeometryRenderer::RenderTopoDS(TopoDS_Shape *ObjSurf) { - if ((ObjSurf != NULL) && !ObjSurf->IsNull()) { + if ((ObjSurf != nullptr) && !ObjSurf->IsNull()) { TopExp_Explorer Ex; for (Ex.Init(*ObjSurf, TopAbs_FACE); Ex.More(); Ex.Next()) { TopoDS_Face F = TopoDS::Face(Ex.Current()); diff --git a/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp b/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp index ddfc5d61177..31b83401ebf 100644 --- a/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp +++ b/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp @@ -35,7 +35,7 @@ Kernel::Logger g_log("vtkGeometryCacheReader"); */ vtkGeometryCacheReader::vtkGeometryCacheReader(std::string filename) { mFileName = filename; - mDoc = NULL; + mDoc = nullptr; Init(); } @@ -68,7 +68,7 @@ void vtkGeometryCacheReader::readCacheForObject(Object *obj) { std::stringstream objName; objName << obj->getName(); Poco::XML::Element *pEle = getElementByObjectName(objName.str()); - if (pEle == NULL) // Element not found + if (pEle == nullptr) // Element not found { g_log.debug("Cache not found for Object with name " + objName.str()); return; @@ -106,11 +106,11 @@ void vtkGeometryCacheReader::readCacheForObject(Object *obj) { Poco::XML::Element * vtkGeometryCacheReader::getElementByObjectName(std::string name) { Element *pRoot = mDoc->documentElement(); - if (pRoot == NULL || pRoot->nodeName().compare("VTKFile") != 0) - return NULL; + if (pRoot == nullptr || pRoot->nodeName().compare("VTKFile") != 0) + return nullptr; Element *pPolyData = pRoot->getChildElement("PolyData"); - if (pPolyData == NULL) - return NULL; + if (pPolyData == nullptr) + return nullptr; return pPolyData->getElementById(name, "name"); } @@ -119,13 +119,13 @@ vtkGeometryCacheReader::getElementByObjectName(std::string name) { */ void vtkGeometryCacheReader::readPoints(Poco::XML::Element *pEle, int *noOfPoints, double **points) { - if (pEle == NULL) { + if (pEle == nullptr) { *noOfPoints = 0; return; } // Allocate memory *points = new double[(*noOfPoints) * 3]; - if (*points == NULL) // Out of memory + if (*points == nullptr) // Out of memory { g_log.error("Cannot allocate memory for triangle cache of Object "); return; @@ -145,13 +145,13 @@ void vtkGeometryCacheReader::readPoints(Poco::XML::Element *pEle, */ void vtkGeometryCacheReader::readTriangles(Poco::XML::Element *pEle, int *noOfTriangles, int **faces) { - if (pEle == NULL) { + if (pEle == nullptr) { *noOfTriangles = 0; return; } // Allocate memory *faces = new int[(*noOfTriangles) * 3]; - if (*faces == NULL) // Out of memory + if (*faces == nullptr) // Out of memory { g_log.error("Cannot allocate memory for triangle cache of Object "); return; diff --git a/Framework/Geometry/src/Surfaces/SurfaceFactory.cpp b/Framework/Geometry/src/Surfaces/SurfaceFactory.cpp index 6b5fa1f79d9..fdbaf8ea922 100644 --- a/Framework/Geometry/src/Surfaces/SurfaceFactory.cpp +++ b/Framework/Geometry/src/Surfaces/SurfaceFactory.cpp @@ -30,7 +30,7 @@ namespace Mantid { namespace Geometry { -SurfaceFactory *SurfaceFactory::FOBJ(0); +SurfaceFactory *SurfaceFactory::FOBJ(nullptr); SurfaceFactory *SurfaceFactory::Instance() /** diff --git a/Framework/ICat/src/CatalogDownloadDataFiles.cpp b/Framework/ICat/src/CatalogDownloadDataFiles.cpp index c2f9ba5b2fb..d1c975b24e4 100644 --- a/Framework/ICat/src/CatalogDownloadDataFiles.cpp +++ b/Framework/ICat/src/CatalogDownloadDataFiles.cpp @@ -162,7 +162,7 @@ std::string CatalogDownloadDataFiles::doDownloadandSavetoLocalDrive( Poco::Net::Context::VERIFY_NONE); // Create a singleton for holding the default context. E.g. any future // requests to publish are made to this certificate and context. - Poco::Net::SSLManager::instance().initializeClient(NULL, certificateHandler, + Poco::Net::SSLManager::instance().initializeClient(nullptr, certificateHandler, context); // Session takes ownership of socket diff --git a/Framework/ICat/src/CatalogPublish.cpp b/Framework/ICat/src/CatalogPublish.cpp index 0f1b6157a2c..80a8c4842fe 100644 --- a/Framework/ICat/src/CatalogPublish.cpp +++ b/Framework/ICat/src/CatalogPublish.cpp @@ -152,7 +152,7 @@ void CatalogPublish::publish(std::istream &fileContents, Poco::Net::Context::VERIFY_NONE); // Create a singleton for holding the default context. E.g. any future // requests to publish are made to this certificate and context. - Poco::Net::SSLManager::instance().initializeClient(NULL, certificateHandler, + Poco::Net::SSLManager::instance().initializeClient(nullptr, certificateHandler, context); Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort(), context); diff --git a/Framework/ICat/src/ICat3/ICat3Helper.cpp b/Framework/ICat/src/ICat3/ICat3Helper.cpp index d350acbaf1c..b40971ab023 100644 --- a/Framework/ICat/src/ICat3/ICat3Helper.cpp +++ b/Framework/ICat/src/ICat3/ICat3Helper.cpp @@ -188,8 +188,8 @@ void CICatHelper::saveInvestigationIncludesResponse( savetoTableWorkspace((*datafile_citr)->location, t); // File creation Time. - std::string *creationtime = NULL; - if ((*datafile_citr)->datafileCreateTime != NULL) { + std::string *creationtime = nullptr; + if ((*datafile_citr)->datafileCreateTime != nullptr) { time_t crtime = *(*datafile_citr)->datafileCreateTime; char temp[25]; strftime(temp, 25, "%Y-%b-%d %H:%M:%S", localtime(&crtime)); @@ -698,12 +698,12 @@ void CICatHelper::setICATProxySettings(ICat3::ICATPortBindingProxy &icat) { void CICatHelper::setSSLContext(ICat3::ICATPortBindingProxy &icat) { if (soap_ssl_client_context( &icat, SOAP_SSL_CLIENT, /* use SOAP_SSL_DEFAULT in production code */ - NULL, /* keyfile: required only when client must authenticate to + nullptr, /* keyfile: required only when client must authenticate to server (see SSL docs on how to obtain this file) */ - NULL, /* password to read the keyfile */ - NULL, /* optional cacert file to store trusted certificates */ - NULL, /* optional capath to directory with trusted certificates */ - NULL /* if randfile!=NULL: use a file with random data to seed + nullptr, /* password to read the keyfile */ + nullptr, /* optional cacert file to store trusted certificates */ + nullptr, /* optional capath to directory with trusted certificates */ + nullptr /* if randfile!=NULL: use a file with random data to seed randomness */ )) { CErrorHandling::throwErrorMessages(icat); diff --git a/Framework/ICat/src/ICat4/ICat4Catalog.cpp b/Framework/ICat/src/ICat4/ICat4Catalog.cpp index c6ed4b9a885..e6532ec61a1 100644 --- a/Framework/ICat/src/ICat4/ICat4Catalog.cpp +++ b/Framework/ICat/src/ICat4/ICat4Catalog.cpp @@ -713,12 +713,12 @@ void ICat4Catalog::keepAlive() { void ICat4Catalog::setSSLContext(ICATPortBindingProxy &icat) { if (soap_ssl_client_context( &icat, SOAP_SSL_CLIENT, /* use SOAP_SSL_DEFAULT in production code */ - NULL, /* keyfile: required only when client must authenticate to + nullptr, /* keyfile: required only when client must authenticate to server (see SSL docs on how to obtain this file) */ - NULL, /* password to read the keyfile */ - NULL, /* optional cacert file to store trusted certificates */ - NULL, /* optional capath to directory with trusted certificates */ - NULL /* if randfile!=NULL: use a file with random data to seed + nullptr, /* password to read the keyfile */ + nullptr, /* optional cacert file to store trusted certificates */ + nullptr, /* optional capath to directory with trusted certificates */ + nullptr /* if randfile!=NULL: use a file with random data to seed randomness */ )) { throwErrorMessage(icat); diff --git a/Framework/ISISLiveData/src/FakeISISEventDAE.cpp b/Framework/ISISLiveData/src/FakeISISEventDAE.cpp index c699dfb9411..bb362861f98 100644 --- a/Framework/ISISLiveData/src/FakeISISEventDAE.cpp +++ b/Framework/ISISLiveData/src/FakeISISEventDAE.cpp @@ -148,7 +148,7 @@ public: }; /// (Empty) Constructor -FakeISISEventDAE::FakeISISEventDAE() : m_server(NULL) {} +FakeISISEventDAE::FakeISISEventDAE() : m_server(nullptr) {} /// Destructor FakeISISEventDAE::~FakeISISEventDAE() { @@ -222,7 +222,7 @@ void FakeISISEventDAE::exec() { histoDAEHandle.wait(); if (m_server) { m_server->stop(); - m_server = NULL; + m_server = nullptr; } socket.close(); diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index 426e5bbafa0..da457b8236c 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -141,7 +141,7 @@ private: /// Private constructor for singleton class ConfigServiceImpl::ConfigServiceImpl() - : m_pConf(NULL), m_pSysConfig(NULL), m_changed_keys(), m_ConfigPaths(), + : m_pConf(nullptr), m_pSysConfig(nullptr), m_changed_keys(), m_ConfigPaths(), m_AbsolutePaths(), m_strBaseDir(""), m_PropertyString(""), m_properties_file_name("Mantid.properties"), #ifdef MPI_BUILD @@ -155,7 +155,7 @@ ConfigServiceImpl::ConfigServiceImpl() m_instr_prefixes(), m_proxyInfo(), m_isProxySet(false) { // getting at system details m_pSysConfig = new WrappedObject<Poco::Util::SystemConfiguration>; - m_pConf = 0; + m_pConf = nullptr; // Register the FilterChannel with the Poco logging factory Poco::LoggingFactory::defaultFactory().registerChannelClass( @@ -405,7 +405,7 @@ void ConfigServiceImpl::configureLogging() { // Try to create or append to the file. If it fails, use the default FILE *fp = fopen(m_logFilePath.c_str(), "a+"); - if (fp == NULL) { + if (fp == nullptr) { std::cerr << "Error writing to log file path given in properties file: \"" << m_logFilePath << "\". Will use a default path instead." @@ -1311,7 +1311,7 @@ std::string ConfigServiceImpl::getOSVersionReadable() { try { Poco::Pipe outPipe, errorPipe; Poco::ProcessHandle ph = - Poco::Process::launch(cmd, args, 0, &outPipe, &errorPipe); + Poco::Process::launch(cmd, args, nullptr, &outPipe, &errorPipe); const int rc = ph.wait(); // Only if the command returned successfully. if (rc == 0) { @@ -1978,7 +1978,7 @@ void ConfigServiceImpl::setConsoleLogLevel(int logLevel) { */ void ConfigServiceImpl::setFilterChannelLogLevel( const std::string &filterChannelName, int logLevel) { - Poco::Channel *channel = NULL; + Poco::Channel *channel = nullptr; try { channel = Poco::LoggingRegistry::defaultRegistry().channelForName( filterChannelName); diff --git a/Framework/Kernel/src/DataItem.cpp b/Framework/Kernel/src/DataItem.cpp index 56ed17a103d..7e5c010234d 100644 --- a/Framework/Kernel/src/DataItem.cpp +++ b/Framework/Kernel/src/DataItem.cpp @@ -24,7 +24,7 @@ DataItem::DataItem(const DataItem & /*other*/) { */ DataItem::~DataItem() { delete m_lock; - m_lock = NULL; + m_lock = nullptr; } /** Private method to access the RWLock object. diff --git a/Framework/Kernel/src/DateAndTime.cpp b/Framework/Kernel/src/DateAndTime.cpp index 1e3b63eec9a..687c59c5b03 100644 --- a/Framework/Kernel/src/DateAndTime.cpp +++ b/Framework/Kernel/src/DateAndTime.cpp @@ -90,7 +90,7 @@ time_t utc_mktime(struct tm *utctime) { result = mktime(&tmp); if (result == (time_t)-1) return (time_t)-1; - if (gmtime_r_portable(&result, &check) == NULL) + if (gmtime_r_portable(&result, &check) == nullptr) return (time_t)-1; // loop until match @@ -111,7 +111,7 @@ time_t utc_mktime(struct tm *utctime) { if (result == (time_t)-1) return (time_t)-1; gmtime_r_portable(&result, &check); - if (gmtime_r_portable(&result, &check) == NULL) + if (gmtime_r_portable(&result, &check) == nullptr) return (time_t)-1; // Seems like there can be endless loops at the end of a month? E.g. sep 30, // 2010 at 4:40 pm. This is to avoid it. diff --git a/Framework/Kernel/src/DateValidator.cpp b/Framework/Kernel/src/DateValidator.cpp index 4f7eee94a29..3322a09db4e 100644 --- a/Framework/Kernel/src/DateValidator.cpp +++ b/Framework/Kernel/src/DateValidator.cpp @@ -30,7 +30,7 @@ struct tm getTimeValue(const std::string &sDate, std::string &error) { timeinfo.tm_isdst = -1; #ifndef _WIN32 timeinfo.tm_gmtoff = 0; - timeinfo.tm_zone = 0; + timeinfo.tm_zone = nullptr; #endif std::basic_string<char>::size_type index, off = 0; diff --git a/Framework/Kernel/src/DiskBuffer.cpp b/Framework/Kernel/src/DiskBuffer.cpp index fd6fc09fbbd..ec910adb4dd 100644 --- a/Framework/Kernel/src/DiskBuffer.cpp +++ b/Framework/Kernel/src/DiskBuffer.cpp @@ -44,7 +44,7 @@ DiskBuffer::~DiskBuffer() {} * @param item :: item that can be written to disk. */ void DiskBuffer::toWrite(ISaveable *item) { - if (item == NULL) + if (item == nullptr) return; // if (!m_useWriteBuffer) return; @@ -81,7 +81,7 @@ void DiskBuffer::toWrite(ISaveable *item) { * @param item :: ISaveable object that is getting deleted. */ void DiskBuffer::objectDeleted(ISaveable *item) { - if (item == NULL) + if (item == nullptr) return; // have it ever been in the buffer? m_mutex.lock(); @@ -119,7 +119,7 @@ void DiskBuffer::writeOldObjects() { auto it = m_toWriteBuffer.begin(); auto it_end = m_toWriteBuffer.end(); - ISaveable *obj = NULL; + ISaveable *obj = nullptr; for (; it != it_end; ++it) { obj = *it; diff --git a/Framework/Kernel/src/EnabledWhenProperty.cpp b/Framework/Kernel/src/EnabledWhenProperty.cpp index 61e02212351..57d1df52a69 100644 --- a/Framework/Kernel/src/EnabledWhenProperty.cpp +++ b/Framework/Kernel/src/EnabledWhenProperty.cpp @@ -15,9 +15,9 @@ EnabledWhenProperty::~EnabledWhenProperty() {} bool EnabledWhenProperty::fulfillsCriterion( const IPropertyManager *algo) const { // Find the property - if (algo == NULL) + if (algo == nullptr) return true; - Property *prop = NULL; + Property *prop = nullptr; try { prop = algo->getPointerToProperty(m_otherPropName); } catch (Exception::NotFoundError &) { diff --git a/Framework/Kernel/src/FilterChannel.cpp b/Framework/Kernel/src/FilterChannel.cpp index c6dab197e19..68c3b8632a4 100644 --- a/Framework/Kernel/src/FilterChannel.cpp +++ b/Framework/Kernel/src/FilterChannel.cpp @@ -7,7 +7,7 @@ namespace Poco { -FilterChannel::FilterChannel() : _channel(0), _priority(8) {} +FilterChannel::FilterChannel() : _channel(nullptr), _priority(8) {} FilterChannel::~FilterChannel() { close(); } @@ -44,7 +44,7 @@ void FilterChannel::log(const Message &msg) { void FilterChannel::close() { FastMutex::ScopedLock lock(_mutex); - if (_channel != NULL) { + if (_channel != nullptr) { _channel->release(); } } diff --git a/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp b/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp index 52a8e817ddb..b602bfd98eb 100644 --- a/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp +++ b/Framework/Kernel/src/FilteredTimeSeriesProperty.cpp @@ -17,7 +17,7 @@ template <typename HeldType> FilteredTimeSeriesProperty<HeldType>::FilteredTimeSeriesProperty( TimeSeriesProperty<HeldType> *seriesProp, const TimeSeriesProperty<bool> &filterProp, const bool transferOwnership) - : TimeSeriesProperty<HeldType>(*seriesProp), m_unfiltered(NULL) { + : TimeSeriesProperty<HeldType>(*seriesProp), m_unfiltered(nullptr) { if (transferOwnership) m_unfiltered = seriesProp; else diff --git a/Framework/Kernel/src/InternetHelper.cpp b/Framework/Kernel/src/InternetHelper.cpp index 09cf0b15931..7f1618aa3d5 100644 --- a/Framework/Kernel/src/InternetHelper.cpp +++ b/Framework/Kernel/src/InternetHelper.cpp @@ -54,8 +54,8 @@ Logger g_log("InternetHelper"); InternetHelper::InternetHelper() : m_proxyInfo(), m_isProxySet(false), m_timeout(30), m_isTimeoutSet(false), m_contentLength(0), m_method(HTTPRequest::HTTP_GET), - m_contentType("application/json"), m_body(), m_headers(), m_request(NULL), - m_response(NULL) {} + m_contentType("application/json"), m_body(), m_headers(), m_request(nullptr), + m_response(nullptr) {} //---------------------------------------------------------------------------------------------- /** Constructor @@ -64,16 +64,16 @@ InternetHelper::InternetHelper(const Kernel::ProxyInfo &proxy) : m_proxyInfo(proxy), m_isProxySet(true), m_timeout(30), m_isTimeoutSet(false), m_contentLength(0), m_method(HTTPRequest::HTTP_GET), m_contentType("application/json"), - m_body(), m_headers(), m_request(NULL), m_response(NULL) {} + m_body(), m_headers(), m_request(nullptr), m_response(nullptr) {} //---------------------------------------------------------------------------------------------- /** Destructor */ InternetHelper::~InternetHelper() { - if (m_request != NULL) { + if (m_request != nullptr) { delete m_request; } - if (m_response != NULL) { + if (m_response != nullptr) { delete m_response; } } @@ -88,10 +88,10 @@ void InternetHelper::setupProxyOnSession(HTTPClientSession &session, } void InternetHelper::createRequest(Poco::URI &uri) { - if (m_request != NULL) { + if (m_request != nullptr) { delete m_request; } - if (m_response != NULL) { + if (m_response != nullptr) { delete m_response; } @@ -248,7 +248,7 @@ int InternetHelper::sendHTTPSRequest(const std::string &url, // Create a singleton for holding the default context. // e.g. any future requests to publish are made to this certificate and // context. - SSLManager::instance().initializeClient(NULL, certificateHandler, context); + SSLManager::instance().initializeClient(nullptr, certificateHandler, context); // Create the session HTTPSClientSession session(uri.getHost(), static_cast<Poco::UInt16>(uri.getPort())); @@ -529,7 +529,7 @@ void InternetHelper::setBody(const std::ostringstream &body) { void InternetHelper::setBody(Poco::Net::HTMLForm &form) { setMethod("POST"); - if (m_request == NULL) { + if (m_request == nullptr) { Poco::URI uri("http://www.mantidproject.org"); createRequest(uri); } @@ -602,7 +602,7 @@ void InternetHelper::reset() { m_body = ""; m_method = HTTPRequest::HTTP_GET; m_contentType = "application/json"; - m_request = NULL; + m_request = nullptr; } } // namespace Kernel diff --git a/Framework/Kernel/src/LibraryWrapper.cpp b/Framework/Kernel/src/LibraryWrapper.cpp index c371ef0c093..9172ddf7891 100644 --- a/Framework/Kernel/src/LibraryWrapper.cpp +++ b/Framework/Kernel/src/LibraryWrapper.cpp @@ -5,14 +5,14 @@ namespace Mantid { namespace Kernel { /// Constructor -LibraryWrapper::LibraryWrapper() : module(0) {} +LibraryWrapper::LibraryWrapper() : module(nullptr) {} /// Destructor LibraryWrapper::~LibraryWrapper() { // Close lib if (module) { DllOpen::CloseDll(module); - module = 0; + module = nullptr; } } diff --git a/Framework/Kernel/src/LogFilter.cpp b/Framework/Kernel/src/LogFilter.cpp index 6cd99a7daec..3a868ba2b31 100644 --- a/Framework/Kernel/src/LogFilter.cpp +++ b/Framework/Kernel/src/LogFilter.cpp @@ -128,7 +128,7 @@ template <typename SrcType> struct ConvertToTimeSeriesDouble { auto srcTypeSeries = dynamic_cast<const TimeSeriesProperty<SrcType> *>(prop); if (!srcTypeSeries) - return NULL; + return nullptr; auto converted = new TimeSeriesProperty<double>(prop->name()); auto pmap = srcTypeSeries->valueAsMap(); for (auto it = pmap.begin(); it != pmap.end(); ++it) { @@ -143,7 +143,7 @@ template <> struct ConvertToTimeSeriesDouble<double> { static TimeSeriesProperty<double> *apply(const Property *prop) { auto doubleSeries = dynamic_cast<const TimeSeriesProperty<double> *>(prop); if (!doubleSeries) - return NULL; + return nullptr; return doubleSeries->clone(); } }; diff --git a/Framework/Kernel/src/LogParser.cpp b/Framework/Kernel/src/LogParser.cpp index b4f3c9528ee..6a1bdc49e72 100644 --- a/Framework/Kernel/src/LogParser.cpp +++ b/Framework/Kernel/src/LogParser.cpp @@ -38,7 +38,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, std::ifstream file(logFName.c_str()); if (!file) { g_log.warning() << "Cannot open log file " << logFName << "\n"; - return 0; + return nullptr; } // Change times and new values read from file @@ -95,7 +95,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, } if (change_times.empty()) - return 0; + return nullptr; if (isNumeric) { auto logv = new Kernel::TimeSeriesProperty<double>(name); @@ -115,7 +115,7 @@ Kernel::Property *LogParser::createLogProperty(const std::string &logFName, } return logv; } - return 0; + return nullptr; } /** diff --git a/Framework/Kernel/src/Math/Optimization/SLSQPMinimizer.cpp b/Framework/Kernel/src/Math/Optimization/SLSQPMinimizer.cpp index 38788db5a44..cbd40ca1598 100644 --- a/Framework/Kernel/src/Math/Optimization/SLSQPMinimizer.cpp +++ b/Framework/Kernel/src/Math/Optimization/SLSQPMinimizer.cpp @@ -179,7 +179,7 @@ void SLSQPMinimizer::initializeConstraints(const DblMatrix &equality, size_t constrCounter(0); while (constrCounter < totalNumConstr) { - const DblMatrix *constrMatrix(NULL); + const DblMatrix *constrMatrix(nullptr); if (constrCounter < numEqualityConstraints()) constrMatrix = &equality; else diff --git a/Framework/Kernel/src/Matrix.cpp b/Framework/Kernel/src/Matrix.cpp index 530aa6b5cc6..13e61181bbe 100644 --- a/Framework/Kernel/src/Matrix.cpp +++ b/Framework/Kernel/src/Matrix.cpp @@ -83,7 +83,7 @@ template <typename T> std::vector<T> Matrix<T>::getVector() const { // template <typename T> Matrix<T>::Matrix(const size_t nrow, const size_t ncol, const bool makeIdentity) - : nx(0), ny(0), V(0) + : nx(0), ny(0), V(nullptr) /** Constructor with pre-set sizes. Matrix is zeroed @param nrow :: number of rows @@ -100,7 +100,7 @@ Matrix<T>::Matrix(const size_t nrow, const size_t ncol, const bool makeIdentity) template <typename T> Matrix<T>::Matrix(const std::vector<T> &A, const std::vector<T> &B) - : nx(0), ny(0), V(0) + : nx(0), ny(0), V(nullptr) /** Constructor to take two vectors and multiply them to construct a matrix. (assuming that we have columns x row @@ -120,7 +120,7 @@ Matrix<T>::Matrix(const std::vector<T> &A, const std::vector<T> &B) // template <typename T> Matrix<T>::Matrix(const std::vector<T> &data) - : nx(0), ny(0), V(0) { + : nx(0), ny(0), V(nullptr) { size_t numel = data.size(); size_t nxt = (size_t)sqrt(double(numel)); size_t test = nxt * nxt; @@ -142,7 +142,7 @@ Matrix<T>::Matrix(const std::vector<T> &data) template <typename T> Matrix<T>::Matrix(const Matrix<T> &A, const size_t nrow, const size_t ncol) - : nx(A.nx - 1), ny(A.ny - 1), V(0) + : nx(A.nx - 1), ny(A.ny - 1), V(nullptr) /** Constructor with for a missing row/column. @param A :: The input matrix @@ -178,7 +178,7 @@ Matrix<T>::Matrix(const Matrix<T> &A, const size_t nrow, const size_t ncol) template <typename T> Matrix<T>::Matrix(const Matrix<T> &A) - : nx(0), ny(0), V(0) + : nx(0), ny(0), V(nullptr) /** Simple copy constructor @param A :: Object to copy @@ -545,7 +545,7 @@ void Matrix<T>::deleteMem() if (V) { delete[] * V; delete[] V; - V = 0; + V = nullptr; } nx = 0; ny = 0; diff --git a/Framework/Kernel/src/Memory.cpp b/Framework/Kernel/src/Memory.cpp index 448b2276787..66f4967360d 100644 --- a/Framework/Kernel/src/Memory.cpp +++ b/Framework/Kernel/src/Memory.cpp @@ -229,7 +229,7 @@ void MemoryStats::process_mem_system(size_t &sys_avail, size_t &sys_total) { uint64_t totalmem; size_t len = sizeof(totalmem); // Gives system memory in bytes - int err = sysctlbyname("hw.memsize", &totalmem, &len, NULL, 0); + int err = sysctlbyname("hw.memsize", &totalmem, &len, nullptr, 0); if (err) g_log.warning("Unable to obtain memory of system"); sys_total = totalmem / 1024; diff --git a/Framework/Kernel/src/MersenneTwister.cpp b/Framework/Kernel/src/MersenneTwister.cpp index c940b8b2d40..5148e0d80e5 100644 --- a/Framework/Kernel/src/MersenneTwister.cpp +++ b/Framework/Kernel/src/MersenneTwister.cpp @@ -16,7 +16,7 @@ namespace Kernel { */ MersenneTwister::MersenneTwister(const size_t seedValue) : m_generator(), m_uniform_dist(), m_currentSeed(0), - m_savedStateGenerator(NULL) { + m_savedStateGenerator(nullptr) { setSeed(seedValue); setRange(0.0, 1.0); } @@ -30,7 +30,7 @@ MersenneTwister::MersenneTwister(const size_t seedValue) MersenneTwister::MersenneTwister(const size_t seedValue, const double start, const double end) : m_generator(), m_uniform_dist(), m_currentSeed(), - m_savedStateGenerator(NULL) { + m_savedStateGenerator(nullptr) { setSeed(seedValue); setRange(start, end); } @@ -48,7 +48,7 @@ void MersenneTwister::setSeed(const size_t seedValue) { m_currentSeed = (boost::mt19937::result_type)seedValue; m_generator.seed(m_currentSeed); delete m_savedStateGenerator; - m_savedStateGenerator = NULL; + m_savedStateGenerator = nullptr; } /** diff --git a/Framework/Kernel/src/NetworkProxyOSX.cpp b/Framework/Kernel/src/NetworkProxyOSX.cpp index 1db21340e15..4dcd0e0d9d3 100644 --- a/Framework/Kernel/src/NetworkProxyOSX.cpp +++ b/Framework/Kernel/src/NetworkProxyOSX.cpp @@ -108,10 +108,10 @@ ProxyInfoVec proxyInformationFromPac(CFDictionaryRef dict, dict, kSCPropNetProxiesProxyAutoConfigURLString); CFDataRef pacData; CFURLRef pacURL = - CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL); + CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, nullptr); SInt32 errorCode; if (!CFURLCreateDataAndPropertiesFromResource( - kCFAllocatorDefault, pacURL, &pacData, NULL, NULL, &errorCode)) { + kCFAllocatorDefault, pacURL, &pacData, nullptr, nullptr, &errorCode)) { logger.debug() << "Unable to get the PAC script at " << toString(cfPacLocation) << "Error code: " << errorCode << std::endl; @@ -123,7 +123,7 @@ ProxyInfoVec proxyInformationFromPac(CFDictionaryRef dict, CFURLRef targetURL = CFURLCreateWithBytes( kCFAllocatorDefault, (UInt8 *)targetURLString.c_str(), - targetURLString.size(), kCFStringEncodingUTF8, NULL); + targetURLString.size(), kCFStringEncodingUTF8, nullptr); if (!targetURL) { logger.debug("Problem with Target URI for proxy script"); return proxyInfoVec; @@ -207,7 +207,7 @@ ProxyInfo httpProxyFromSystem(CFDictionaryRef dict) { ProxyInfo findHttpProxy(const std::string &targetURLString, Mantid::Kernel::Logger &logger) { ProxyInfo httpProxy; - CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL); + CFDictionaryRef dict = SCDynamicStoreCopyProxies(nullptr); if (!dict) { logger.debug("NetworkProxyOSX SCDynamicStoreCopyProxies returned NULL"); } diff --git a/Framework/Kernel/src/NexusDescriptor.cpp b/Framework/Kernel/src/NexusDescriptor.cpp index f05232f4cb5..2532289589f 100644 --- a/Framework/Kernel/src/NexusDescriptor.cpp +++ b/Framework/Kernel/src/NexusDescriptor.cpp @@ -113,7 +113,7 @@ bool NexusDescriptor::isHDF(const std::string &filename, */ NexusDescriptor::NexusDescriptor(const std::string &filename) : m_filename(), m_extension(), m_firstEntryNameType(), m_rootAttrs(), - m_pathsToTypes(), m_file(NULL) { + m_pathsToTypes(), m_file(nullptr) { if (filename.empty()) { throw std::invalid_argument("NexusDescriptor() - Empty filename '" + filename + "'"); diff --git a/Framework/Kernel/src/Property.cpp b/Framework/Kernel/src/Property.cpp index d3ec47e0a3c..8c849533e51 100644 --- a/Framework/Kernel/src/Property.cpp +++ b/Framework/Kernel/src/Property.cpp @@ -18,7 +18,7 @@ namespace Kernel { Property::Property(const std::string &name, const std::type_info &type, const unsigned int direction) : m_name(name), m_documentation(""), m_typeinfo(&type), - m_direction(direction), m_units(""), m_settings(NULL), m_group(""), + m_direction(direction), m_units(""), m_settings(nullptr), m_group(""), m_remember(true) { // Make sure a random int hasn't been passed in for the direction // Property & PropertyWithValue destructors will be called in this case @@ -31,7 +31,7 @@ Property::Property(const std::string &name, const std::type_info &type, Property::Property(const Property &right) : m_name(right.m_name), m_documentation(right.m_documentation), m_typeinfo(right.m_typeinfo), m_direction(right.m_direction), - m_units(right.m_units), m_settings(NULL), m_group(right.m_group), + m_units(right.m_units), m_settings(nullptr), m_group(right.m_group), m_remember(right.m_remember) { if (right.m_settings) m_settings = right.m_settings->clone(); @@ -102,7 +102,7 @@ IPropertySettings *Property::getSettings() { return m_settings; } */ void Property::deleteSettings() { delete m_settings; - m_settings = NULL; + m_settings = nullptr; } /** diff --git a/Framework/Kernel/src/PropertyManager.cpp b/Framework/Kernel/src/PropertyManager.cpp index 5641fe152c7..0d330975ac0 100644 --- a/Framework/Kernel/src/PropertyManager.cpp +++ b/Framework/Kernel/src/PropertyManager.cpp @@ -141,7 +141,7 @@ void PropertyManager::splitByTime( output_properties.push_back( outputs[i]->getPointerToPropertyOrNull(prop->name())); else - output_properties.push_back(NULL); + output_properties.push_back(nullptr); } // Now the property does the splitting. @@ -500,7 +500,7 @@ PropertyManager::getPointerToPropertyOrNull(const std::string &name) const { if (it != m_properties.end()) { return it->second; } - return NULL; + return nullptr; } //----------------------------------------------------------------------------------------------- diff --git a/Framework/Kernel/src/RemoteJobManager.cpp b/Framework/Kernel/src/RemoteJobManager.cpp index d513398ab4b..d0e8c6b9c1e 100644 --- a/Framework/Kernel/src/RemoteJobManager.cpp +++ b/Framework/Kernel/src/RemoteJobManager.cpp @@ -25,7 +25,7 @@ Logger g_log("RemoteJobManager"); RemoteJobManager::RemoteJobManager(const Poco::XML::Element *elem) : m_displayName(elem->getAttribute("name")), m_session( - NULL) // Make sure this is always either NULL or a valid pointer. + nullptr) // Make sure this is always either NULL or a valid pointer. { // Sanity check m_displayName if (m_displayName.length() == 0) { @@ -196,7 +196,7 @@ void RemoteJobManager::initHTTPRequest(Poco::Net::HTTPRequest &req, // Set up the session object if (m_session) { delete m_session; - m_session = NULL; + m_session = nullptr; } if (Poco::URI(m_serviceBaseUrl).getScheme() == "https") { diff --git a/Framework/Kernel/src/SingletonHolder.cpp b/Framework/Kernel/src/SingletonHolder.cpp index 851e3e01fda..1a3a698b614 100644 --- a/Framework/Kernel/src/SingletonHolder.cpp +++ b/Framework/Kernel/src/SingletonHolder.cpp @@ -5,14 +5,14 @@ namespace Mantid { namespace Kernel { /// List of functions to call on program exit -static std::list<atexit_func_t> *cleanup_list = NULL; +static std::list<atexit_func_t> *cleanup_list = nullptr; /// Function registed to atexit() that will clean up /// all our singletons /// This function may be registed with atexit() more than once, so it needs to /// clear the list once it has called all the functions MANTID_KERNEL_DLL void CleanupSingletons() { - if (cleanup_list == NULL) { + if (cleanup_list == nullptr) { return; } std::list<atexit_func_t>::const_iterator it; @@ -20,7 +20,7 @@ MANTID_KERNEL_DLL void CleanupSingletons() { (*(*it))(); } delete cleanup_list; - cleanup_list = NULL; + cleanup_list = nullptr; } /// Adds singleton cleanup function to our atexit list @@ -28,7 +28,7 @@ MANTID_KERNEL_DLL void CleanupSingletons() { /// first out /// @param func :: Exit function to call - the singleton destructor function MANTID_KERNEL_DLL void AddSingleton(atexit_func_t func) { - if (cleanup_list == NULL) { + if (cleanup_list == nullptr) { cleanup_list = new std::list<atexit_func_t>; atexit(&CleanupSingletons); } diff --git a/Framework/Kernel/src/SobolSequence.cpp b/Framework/Kernel/src/SobolSequence.cpp index 796fb6612e0..5592cc2d520 100644 --- a/Framework/Kernel/src/SobolSequence.cpp +++ b/Framework/Kernel/src/SobolSequence.cpp @@ -10,8 +10,8 @@ namespace Kernel { * Constructor taking the number of dimensions for the sequence */ SobolSequence::SobolSequence(const unsigned int ndims) - : QuasiRandomNumberSequence(ndims), m_gslGenerator(NULL), - m_savedGenerator(NULL) { + : QuasiRandomNumberSequence(ndims), m_gslGenerator(nullptr), + m_savedGenerator(nullptr) { setNumberOfDimensions(ndims); } diff --git a/Framework/Kernel/src/TimeSeriesProperty.cpp b/Framework/Kernel/src/TimeSeriesProperty.cpp index 3029ef935c9..a45921644fc 100644 --- a/Framework/Kernel/src/TimeSeriesProperty.cpp +++ b/Framework/Kernel/src/TimeSeriesProperty.cpp @@ -444,7 +444,7 @@ void TimeSeriesProperty<TYPE>::splitByTime( myOutput->m_size = 0; } } else { - outputs_tsp.push_back(NULL); + outputs_tsp.push_back(nullptr); } } diff --git a/Framework/Kernel/src/Timer.cpp b/Framework/Kernel/src/Timer.cpp index 343209ec785..df533ccfc46 100644 --- a/Framework/Kernel/src/Timer.cpp +++ b/Framework/Kernel/src/Timer.cpp @@ -15,7 +15,7 @@ Timer::Timer() { #ifdef _WIN32 m_start = clock(); #else /* linux & mac */ - gettimeofday(&m_start, 0); + gettimeofday(&m_start, nullptr); #endif } @@ -46,7 +46,7 @@ float Timer::elapsed_no_reset() const { const float retval = float(now - m_start) / CLOCKS_PER_SEC; #else /* linux & mac */ timeval now; - gettimeofday(&now, 0); + gettimeofday(&now, nullptr); const float retval = float(now.tv_sec - m_start.tv_sec) + float(static_cast<float>(now.tv_usec - m_start.tv_usec) / 1e6); @@ -60,7 +60,7 @@ void Timer::reset() { m_start = clock(); #else /* linux & mac */ timeval now; - gettimeofday(&now, 0); + gettimeofday(&now, nullptr); m_start = now; #endif } diff --git a/Framework/LiveData/src/ADARA/ADARAPackets.cpp b/Framework/LiveData/src/ADARA/ADARAPackets.cpp index 3f1a10f4e99..3a085d54bbd 100644 --- a/Framework/LiveData/src/ADARA/ADARAPackets.cpp +++ b/Framework/LiveData/src/ADARA/ADARAPackets.cpp @@ -120,7 +120,7 @@ SourceListPkt::SourceListPkt(const SourceListPkt &pkt) : Packet(pkt) {} BankedEventPkt::BankedEventPkt(const uint8_t *data, uint32_t len) : Packet(data, len), m_fields((const uint32_t *)payload()), - m_curEvent(NULL), m_lastFieldIndex(0), m_curFieldIndex(0), + m_curEvent(nullptr), m_lastFieldIndex(0), m_curFieldIndex(0), m_sourceStartIndex(0), m_bankCount(0), m_TOFOffset(0), m_isCorrected(false), m_bankNum(0), m_bankStartIndex(0), m_bankId(0), m_eventCount(0) { @@ -131,7 +131,7 @@ BankedEventPkt::BankedEventPkt(const uint8_t *data, uint32_t len) } BankedEventPkt::BankedEventPkt(const BankedEventPkt &pkt) - : Packet(pkt), m_fields((const uint32_t *)payload()), m_curEvent(NULL), + : Packet(pkt), m_fields((const uint32_t *)payload()), m_curEvent(nullptr), m_lastFieldIndex(0), m_curFieldIndex(0), m_sourceStartIndex(0), m_bankCount(0), m_TOFOffset(0), m_isCorrected(false), m_bankNum(0), m_bankStartIndex(0), m_bankId(0), m_eventCount(0) { @@ -149,9 +149,9 @@ BankedEventPkt::BankedEventPkt(const BankedEventPkt &pkt) // That means the only payload we're guarenteed to have is the first 4 fields. // After that, we've got to start checking against the payload len... const Event *BankedEventPkt::firstEvent() const { - m_curEvent = NULL; + m_curEvent = nullptr; m_curFieldIndex = 4; - while (m_curEvent == NULL && m_curFieldIndex <= m_lastFieldIndex) { + while (m_curEvent == nullptr && m_curFieldIndex <= m_lastFieldIndex) { // Start of a new source firstEventInSource(); } @@ -163,7 +163,7 @@ const Event *BankedEventPkt::nextEvent() const { if (m_curEvent) // If we're null, it's because we've already incremented past // the last event { - m_curEvent = NULL; + m_curEvent = nullptr; m_curFieldIndex += 2; // go to where the next event will start (if there is a next event) @@ -173,9 +173,9 @@ const Event *BankedEventPkt::nextEvent() const { m_curEvent = (const Event *)&m_fields[m_curFieldIndex]; } else { m_bankNum++; - while (m_bankNum <= m_bankCount && m_curEvent == NULL) { + while (m_bankNum <= m_bankCount && m_curEvent == nullptr) { firstEventInBank(); - if (m_curEvent == NULL) { + if (m_curEvent == nullptr) { // Increment banknum because there were no events in the bank we // just tested m_bankNum++; @@ -183,7 +183,7 @@ const Event *BankedEventPkt::nextEvent() const { } // If we still haven't found an event, check for more source sections - while (m_curEvent == NULL && m_curFieldIndex < m_lastFieldIndex) { + while (m_curEvent == nullptr && m_curFieldIndex < m_lastFieldIndex) { firstEventInSource(); } } @@ -210,9 +210,9 @@ void BankedEventPkt::firstEventInSource() const { m_bankNum = 1; // banks are numbered from 1 to m_bankCount. m_curFieldIndex = m_sourceStartIndex + 4; - while (m_bankNum <= m_bankCount && m_curEvent == NULL) { + while (m_bankNum <= m_bankCount && m_curEvent == nullptr) { firstEventInBank(); - if (m_curEvent == NULL) { + if (m_curEvent == nullptr) { // Increment banknum because there were no events in the bank we // just tested m_bankNum++; @@ -221,7 +221,7 @@ void BankedEventPkt::firstEventInSource() const { } else // no banks in this source, skip to the next source { m_curFieldIndex += 4; - m_curEvent = NULL; + m_curEvent = nullptr; } } @@ -239,7 +239,7 @@ void BankedEventPkt::firstEventInBank() const { if (m_eventCount > 0) { m_curEvent = (const Event *)&m_fields[m_curFieldIndex]; } else { - m_curEvent = NULL; + m_curEvent = nullptr; } } @@ -511,7 +511,7 @@ BeamMonitorConfigPkt::BeamMonitorConfigPkt(const BeamMonitorConfigPkt &pkt) DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) : Packet(data, len), m_fields((const uint32_t *)payload()), - m_sectionOffsets(NULL), m_after_banks_offset(NULL) { + m_sectionOffsets(nullptr), m_after_banks_offset(nullptr) { // Get Number of Detector Bank Sets... // - Basic Packet Size Sanity Check @@ -564,9 +564,9 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) msg += " payload_len="; msg += boost::lexical_cast<std::string>(m_payload_len); delete[] m_sectionOffsets; - m_sectionOffsets = (uint32_t *)NULL; + m_sectionOffsets = (uint32_t *)nullptr; delete[] m_after_banks_offset; - m_after_banks_offset = (uint32_t *)NULL; + m_after_banks_offset = (uint32_t *)nullptr; throw invalid_packet(msg); } @@ -593,16 +593,16 @@ DetectorBankSetsPkt::DetectorBankSetsPkt(const uint8_t *data, uint32_t len) msg += " payload_len="; msg += boost::lexical_cast<std::string>(m_payload_len); delete[] m_sectionOffsets; - m_sectionOffsets = (uint32_t *)NULL; + m_sectionOffsets = (uint32_t *)nullptr; delete[] m_after_banks_offset; - m_after_banks_offset = (uint32_t *)NULL; + m_after_banks_offset = (uint32_t *)nullptr; throw invalid_packet(msg); } } DetectorBankSetsPkt::DetectorBankSetsPkt(const DetectorBankSetsPkt &pkt) : Packet(pkt), m_fields((const uint32_t *)payload()), - m_sectionOffsets(NULL), m_after_banks_offset(NULL) { + m_sectionOffsets(nullptr), m_after_banks_offset(nullptr) { uint32_t numSets = detBankSetCount(); // Don't Allocate Anything if there are No Detector Bank Sets... diff --git a/Framework/LiveData/src/ADARA/ADARAParser.cpp b/Framework/LiveData/src/ADARA/ADARAParser.cpp index 5e5bea2611b..12347be980d 100644 --- a/Framework/LiveData/src/ADARA/ADARAParser.cpp +++ b/Framework/LiveData/src/ADARA/ADARAParser.cpp @@ -54,7 +54,7 @@ int Parser::bufferParse(std::string &log_info, unsigned int max_packets) { chunk_len = m_oversize_len; if (valid_len < chunk_len) chunk_len = valid_len; - stopped = rxOversizePkt(NULL, p, m_oversize_offset, chunk_len); + stopped = rxOversizePkt(nullptr, p, m_oversize_offset, chunk_len); m_oversize_offset += chunk_len; m_oversize_len -= chunk_len; valid_len -= chunk_len; @@ -256,7 +256,7 @@ bool Parser::rxOversizePkt(const PacketHeader *hdr, const uint8_t *, unsigned int, unsigned int) { // NOTE: ADARA::PacketHeader *hdr can be NULL...! ;-o /* Default is to discard the data */ - if (hdr != NULL) + if (hdr != nullptr) (m_discarded_packets[hdr->type()])++; return false; } diff --git a/Framework/LiveData/src/FakeISISHistoDAE.cpp b/Framework/LiveData/src/FakeISISHistoDAE.cpp index 630b4e46384..c6b84c8a6a2 100644 --- a/Framework/LiveData/src/FakeISISHistoDAE.cpp +++ b/Framework/LiveData/src/FakeISISHistoDAE.cpp @@ -310,7 +310,7 @@ using namespace Kernel; using namespace API; /// (Empty) Constructor -FakeISISHistoDAE::FakeISISHistoDAE() : m_server(NULL) {} +FakeISISHistoDAE::FakeISISHistoDAE() : m_server(nullptr) {} /// Destructor FakeISISHistoDAE::~FakeISISHistoDAE() { @@ -367,7 +367,7 @@ void FakeISISHistoDAE::exec() { } if (m_server) { m_server->stop(); - m_server = NULL; + m_server = nullptr; } socket.close(); } diff --git a/Framework/LiveData/src/FileEventDataListener.cpp b/Framework/LiveData/src/FileEventDataListener.cpp index 1ed3a89f3c0..1903cdb229e 100644 --- a/Framework/LiveData/src/FileEventDataListener.cpp +++ b/Framework/LiveData/src/FileEventDataListener.cpp @@ -22,7 +22,7 @@ FileEventDataListener::FileEventDataListener() : ILiveListener(), m_filename(), m_runNumber(-1), m_tempWSname("__filelistenerchunk"), m_nextChunk(1), m_filePropName("Filename"), m_loaderName(""), m_canLoadMonitors(true), - m_chunkload(NULL) { + m_chunkload(nullptr) { std::string tfilename = ConfigService::Instance().getString("fileeventdatalistener.filename"); if (tfilename.empty()) { @@ -101,7 +101,7 @@ ILiveListener::RunStatus FileEventDataListener::runStatus() { return BeginRun; } // This means we've read the whole file - else if (m_chunkload == NULL) { + else if (m_chunkload == nullptr) { return EndRun; } // Otherwise we're in the run @@ -125,7 +125,7 @@ boost::shared_ptr<Workspace> FileEventDataListener::extractData() { // algorithm. // This is equivalent to the end of the run - which we still need to figure // out how to handle. - if (m_chunkload == NULL) { + if (m_chunkload == nullptr) { throw std::runtime_error("The whole file has been read!"); } @@ -141,7 +141,7 @@ boost::shared_ptr<Workspace> FileEventDataListener::extractData() { AnalysisDataService::Instance().remove(m_tempWSname); // Delete the ActiveResult to signify that we're done with it. delete m_chunkload; - m_chunkload = NULL; + m_chunkload = nullptr; // Kick off the loading of the next chunk (unless we're at the end of the // file) if (m_nextChunk <= m_numChunks) { diff --git a/Framework/LiveData/src/ISISHistoDataListener.cpp b/Framework/LiveData/src/ISISHistoDataListener.cpp index 53c3ae7833b..545db4f8401 100644 --- a/Framework/LiveData/src/ISISHistoDataListener.cpp +++ b/Framework/LiveData/src/ISISHistoDataListener.cpp @@ -44,7 +44,7 @@ Kernel::Logger g_log("ISISHistoDataListener"); /// Constructor ISISHistoDataListener::ISISHistoDataListener() - : ILiveListener(), isInitilized(false), m_daeHandle(NULL), + : ILiveListener(), isInitilized(false), m_daeHandle(nullptr), m_numberOfPeriods(0), m_totalNumberOfSpectra(0), m_timeRegime(-1) { declareProperty(new Kernel::ArrayProperty<specid_t>("SpectraList"), "An optional list of spectra to load. If blank, all " @@ -94,7 +94,7 @@ bool ISISHistoDataListener::connect(const Poco::Net::SocketAddress &address) { IDCsetreportfunc(&ISISHistoDataListener::IDCReporter); if (IDCopen(m_daeName.c_str(), 0, 0, &m_daeHandle, address.port()) != 0) { - m_daeHandle = NULL; + m_daeHandle = nullptr; return false; } @@ -121,7 +121,7 @@ bool ISISHistoDataListener::connect(const Poco::Net::SocketAddress &address) { } bool ISISHistoDataListener::isConnected() { - if (m_daeHandle == NULL) + if (m_daeHandle == nullptr) return false; // try to read a parameter, success means connected int sv_dims_array[1] = {1}, sv_ndims = 1, buffer; diff --git a/Framework/LiveData/src/ISISLiveEventDataListener.cpp b/Framework/LiveData/src/ISISLiveEventDataListener.cpp index e18ca7752a4..0a6f964f35a 100644 --- a/Framework/LiveData/src/ISISLiveEventDataListener.cpp +++ b/Framework/LiveData/src/ISISLiveEventDataListener.cpp @@ -127,7 +127,7 @@ bool ISISLiveEventDataListener::connect( retVal = IDCopen(daeName.c_str(), 0, 0, &m_daeHandle); } if (retVal != 0) { - m_daeHandle = NULL; + m_daeHandle = nullptr; return false; } diff --git a/Framework/LiveData/src/LoadDAE/idc.cpp b/Framework/LiveData/src/LoadDAE/idc.cpp index 9f07b5982d5..c959b0c9026 100644 --- a/Framework/LiveData/src/LoadDAE/idc.cpp +++ b/Framework/LiveData/src/LoadDAE/idc.cpp @@ -63,7 +63,7 @@ int IDCopen(const char *host, int mode, int options, idc_handle_t *pfh, (void)options; // Avoid compiler warning SOCKET s; - *pfh = NULL; + *pfh = nullptr; s = isisds_send_open(host, ISISDSDAEAccess, port); if (s == INVALID_SOCKET) { IDCreport(0, 0, "Error accessing DAE"); @@ -77,7 +77,7 @@ int IDCopen(const char *host, int mode, int options, idc_handle_t *pfh, int IDCclose(idc_handle_t *pfh) { isisds_send_close((*pfh)->s); free((*pfh)); - *pfh = NULL; + *pfh = nullptr; return 0; } @@ -92,7 +92,7 @@ static int getdat(idc_handle_t fh, int ifsn, int nos, int **value, ISISDSDataType ret_type; int spec_nos[2] = {ifsn, nos}; int spec_nos_dims[1] = {2}; - char *command = NULL; + char *command = nullptr; if (isisds_send_command(fh->s, "GETDAT", spec_nos, ISISDSInt32, spec_nos_dims, 1) <= 0) { IDCreport(0, 0, "error sending command (getdat)"); @@ -137,7 +137,7 @@ static int IDCgetpar(idc_handle_t fh, const char *name, void **value, int do_alloc) { int n, stat, comm_buff_size; ISISDSDataType ret_type; - char *command = NULL; + char *command = nullptr; char comm_buffer[256]; sprintf(comm_buffer, "GETPAR%s", isisds_type_code[type]); n = static_cast<int>(strlen(name)); diff --git a/Framework/LiveData/src/LoadDAE/isisds_command.cpp b/Framework/LiveData/src/LoadDAE/isisds_command.cpp index b54ea2c9781..b340faa7f82 100644 --- a/Framework/LiveData/src/LoadDAE/isisds_command.cpp +++ b/Framework/LiveData/src/LoadDAE/isisds_command.cpp @@ -108,7 +108,7 @@ static void clear_replies(SOCKET s) { while (!done) { FD_ZERO(&fds); FD_SET(s, &fds); - if ((select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) && + if ((select(FD_SETSIZE, &fds, nullptr, nullptr, &timeout) > 0) && FD_ISSET(s, &fds)) { recv(s, buffer, sizeof(buffer), 0); } else { @@ -133,7 +133,7 @@ SOCKET isisds_send_open(const char *host, ISISDSAccessMode access_type, ISISDSDataType data_type; int dims_array[10], ndims; - if ((hostp = gethostbyname(host)) == NULL) { + if ((hostp = gethostbyname(host)) == nullptr) { return INVALID_SOCKET; } memset(&address, 0, sizeof(address)); @@ -171,14 +171,14 @@ SOCKET isisds_send_open(const char *host, ISISDSAccessMode access_type, closesocket(s); return INVALID_SOCKET; } - comm = NULL; + comm = nullptr; if (isisds_recv_command_alloc(s, &comm, (void **)&comm_data, &data_type, dims_array, &ndims) <= 0) { closesocket(s); free(comm); return INVALID_SOCKET; } - if (comm_data != NULL) { + if (comm_data != nullptr) { free(comm_data); } if (!strcmp(comm, "OK")) { @@ -207,7 +207,7 @@ int isisds_recv_open(SOCKET s, ISISDSAccessMode *access_type) { return -1; } *access_type = (ISISDSAccessMode)op.access_type; - return isisds_send_command(s, "OK", NULL, ISISDSUnknown, NULL, 0); + return isisds_send_command(s, "OK", nullptr, ISISDSUnknown, nullptr, 0); } /* * return > 0 on success @@ -226,7 +226,7 @@ int isisds_send_command(SOCKET s, const char *command, const void *data, int n, len_data; isisds_command_header_t comm; memset(&comm, 0, sizeof(comm)); - if (dims_array == NULL) { + if (dims_array == nullptr) { comm.ndims = 1; comm.dims_array[0] = ndims; len_data = ndims * isisds_type_size[type]; @@ -249,7 +249,7 @@ int isisds_send_command(SOCKET s, const char *command, const void *data, strncpy(comm.command, command, sizeof(comm.command) - 1); clear_replies(s); n = send(s, (char *)&comm, sizeof(comm), 0); - if ((n == sizeof(comm)) && (data != NULL) && (len_data > 0)) { + if ((n == sizeof(comm)) && (data != nullptr) && (len_data > 0)) { n = send(s, (const char *)data, len_data, 0); } return n; @@ -300,7 +300,7 @@ static int isisds_recv_command_helper(SOCKET s, char **command, void **data, n = recv_all(s, *data, len_data, 0); if (n != len_data) { free(*data); - *data = NULL; + *data = nullptr; len_data = 0; return -1; } @@ -323,11 +323,11 @@ int isisds_recv_command(SOCKET s, char *command, int *len_command, void *data, ISISDSDataType *type, int dims_array[], int *ndims) { int t_ndims = 1; int istat; - char *command_temp = NULL; - if (type == NULL) { + char *command_temp = nullptr; + if (type == nullptr) { return -1; } - if (dims_array == NULL || ndims == NULL || + if (dims_array == nullptr || ndims == nullptr || (*ndims <= 1 && dims_array[0] <= 1)) { int t_dims[8] = {1, 0, 0, 0, 0, 0, 0, 0}; /* assume single simple value */ @@ -350,14 +350,14 @@ int isisds_recv_command(SOCKET s, char *command, int *len_command, void *data, int isisds_recv_command_alloc(SOCKET s, char **command, void **data, ISISDSDataType *type, int dims_array[], int *ndims) { - if (ndims == NULL || dims_array == NULL || type == NULL) { + if (ndims == nullptr || dims_array == nullptr || type == nullptr) { return -1; } - if (data == NULL || command == NULL) { + if (data == nullptr || command == nullptr) { return -1; } - *data = NULL; - *command = NULL; + *data = nullptr; + *command = nullptr; /* *ndims = 0; */ dims_array[0] = 0; *type = ISISDSUnknown; diff --git a/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Framework/LiveData/src/SNSLiveEventDataListener.cpp index 4ea7b4d1f5a..47be4adb02e 100644 --- a/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -411,7 +411,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::BankedEventPkt &pkt) { unsigned lastBankID = pkt.curBankId(); // A counter that we use for logging purposes unsigned eventsPerBank = 0; - while (event != NULL) { + while (event != nullptr) { eventsPerBank++; totalEvents++; if (lastBankID < 0xFFFFFFFE) // Bank ID -1 & -2 are special cases and are @@ -1092,7 +1092,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::DeviceDescriptorPkt &pkt) { // actual keyword // to the template declaration. Hense all the if...else if...else // stuff... - Property *prop = NULL; + Property *prop = nullptr; if (pvType == "double") { prop = new TimeSeriesProperty<double>(pvName); } else if ((pvType == "integer") || (pvType == "unsigned") || diff --git a/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp b/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp index b58b8ffae11..5c8b636b442 100644 --- a/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp +++ b/Framework/LiveData/src/TOPAZLiveEventDataListener.cpp @@ -158,7 +158,7 @@ TOPAZLiveEventDataListener::TOPAZLiveEventDataListener() : ILiveListener(), m_workspaceInitialized(false), m_eventBuffer(), m_monitorLogs(), m_wsName(), m_indexMap(), m_monitorIndexMap(), m_tcpSocket(), m_dataSocket(), m_dataAddr(), m_isConnected(false), - m_udpBuf(NULL), m_udpBufSize(32768), m_runNumber(0), m_mutex(), + m_udpBuf(nullptr), m_udpBufSize(32768), m_runNumber(0), m_mutex(), m_thread(), m_stopThread(false), m_backgroundException() { m_udpBuf = new unsigned char[m_udpBufSize]; diff --git a/Framework/MDAlgorithms/src/BinMD.cpp b/Framework/MDAlgorithms/src/BinMD.cpp index b7ae382f0ba..77eced2e40a 100644 --- a/Framework/MDAlgorithms/src/BinMD.cpp +++ b/Framework/MDAlgorithms/src/BinMD.cpp @@ -35,8 +35,8 @@ using namespace Mantid::DataObjects; /** Constructor */ BinMD::BinMD() - : outWS(), prog(NULL), implicitFunction(NULL), indexMultiplier(NULL), - signals(NULL), errors(NULL), numEvents(NULL) {} + : outWS(), prog(nullptr), implicitFunction(nullptr), indexMultiplier(nullptr), + signals(nullptr), errors(nullptr), numEvents(nullptr) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -373,7 +373,7 @@ void BinMD::exec() { // De serialize the implicit function std::string ImplicitFunctionXML = getPropertyValue("ImplicitFunctionXML"); - implicitFunction = NULL; + implicitFunction = nullptr; if (!ImplicitFunctionXML.empty()) implicitFunction = Mantid::API::ImplicitFunctionFactory::Instance().createUnwrapped( diff --git a/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp b/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp index 2dbfbda15da..f37307581c9 100644 --- a/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp +++ b/Framework/MDAlgorithms/src/ConvToMDEventsWS.cpp @@ -125,7 +125,7 @@ void ConvToMDEventsWS::runConversion(API::Progress *pProgress) { size_t nValidSpectra = m_NSpectra; //--->>> Thread control stuff - Kernel::ThreadSchedulerFIFO *ts(NULL); + Kernel::ThreadSchedulerFIFO *ts(nullptr); int nThreads(m_NumThreads); if (nThreads < 0) @@ -170,7 +170,7 @@ void ConvToMDEventsWS::runConversion(API::Progress *pProgress) { tp.joinAll(); } else { m_OutWSWrapper->pWorkspace()->splitAllIfNeeded( - NULL); // it is done this way as it is possible trying to do single + nullptr); // it is done this way as it is possible trying to do single // threaded split more efficiently } // Count the new # of boxes. @@ -187,7 +187,7 @@ void ConvToMDEventsWS::runConversion(API::Progress *pProgress) { m_OutWSWrapper->pWorkspace()->splitAllIfNeeded(ts); tp.joinAll(); } else { - m_OutWSWrapper->pWorkspace()->splitAllIfNeeded(NULL); + m_OutWSWrapper->pWorkspace()->splitAllIfNeeded(nullptr); } // Recount totals at the end. diff --git a/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp b/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp index b0e5500f5c3..fa08c5dcd09 100644 --- a/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp +++ b/Framework/MDAlgorithms/src/ConvToMDHistoWS.cpp @@ -178,7 +178,7 @@ void ConvToMDHistoWS::runConversion(API::Progress *pProgress) { return; //--->>> Thread control stuff - Kernel::ThreadSchedulerFIFO *ts(NULL); + Kernel::ThreadSchedulerFIFO *ts(nullptr); int nThreads(m_NumThreads); if (nThreads < 0) nThreads = 0; // negative m_NumThreads correspond to all cores used, 0 no @@ -222,7 +222,7 @@ void ConvToMDHistoWS::runConversion(API::Progress *pProgress) { tp.joinAll(); } else { m_OutWSWrapper->pWorkspace()->splitAllIfNeeded( - NULL); // it is done this way as it is possible trying to do single + nullptr); // it is done this way as it is possible trying to do single // threaded split more efficiently } // Count the new # of boxes. @@ -251,7 +251,7 @@ void ConvToMDHistoWS::runConversion(API::Progress *pProgress) { m_OutWSWrapper->pWorkspace()->splitAllIfNeeded(ts); tp.joinAll(); } else { - m_OutWSWrapper->pWorkspace()->splitAllIfNeeded(NULL); + m_OutWSWrapper->pWorkspace()->splitAllIfNeeded(nullptr); } m_OutWSWrapper->pWorkspace()->refreshCache(); // m_OutWSWrapper->refreshCentroid(); diff --git a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp index 746eb498bc4..1257931557d 100644 --- a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp @@ -280,7 +280,7 @@ void ConvertCWSDExpToMomentum::addMDEvents(bool usevirtual) { throw std::runtime_error("Unable to cast to MDBox"); mdbox->setExtents(dim, -10, 10); mdbox->calcVolume(); - mdbox->refreshCache(NULL); + mdbox->refreshCache(nullptr); } } diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp index 2c839eee383..59c9f9a9aba 100644 --- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace.cpp @@ -43,8 +43,8 @@ ConvertToDiffractionMDWorkspace::ConvertToDiffractionMDWorkspace() Append(true), // append data to existing target MD workspace if one exist LorentzCorrection(false), // not doing Lorents l1(1.), beamline_norm(1.), failedDetectorLookupCount(0), - m_extentsMin(NULL), - m_extentsMax(NULL) // will be allocated in exec using nDims + m_extentsMin(nullptr), + m_extentsMax(nullptr) // will be allocated in exec using nDims {} //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/DivideMD.cpp b/Framework/MDAlgorithms/src/DivideMD.cpp index 23c762fcd57..5137a692ebe 100644 --- a/Framework/MDAlgorithms/src/DivideMD.cpp +++ b/Framework/MDAlgorithms/src/DivideMD.cpp @@ -67,7 +67,7 @@ void DivideMD::execEventScalar(typename MDEventWorkspace<MDE, nd>::sptr ws) { parentBox->getBoxes(boxes, 1000, true); bool fileBackedTarget(false); - Kernel::DiskBuffer *dbuff(NULL); + Kernel::DiskBuffer *dbuff(nullptr); if (ws->isFileBacked()) { fileBackedTarget = true; dbuff = ws->getBoxController()->getFileIO(); diff --git a/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Framework/MDAlgorithms/src/FindPeaksMD.cpp index 5f26a22c472..2e8e9069bd1 100644 --- a/Framework/MDAlgorithms/src/FindPeaksMD.cpp +++ b/Framework/MDAlgorithms/src/FindPeaksMD.cpp @@ -107,7 +107,7 @@ DECLARE_ALGORITHM(FindPeaksMD) */ FindPeaksMD::FindPeaksMD() : peakWS(), peakRadiusSquared(), DensityThresholdFactor(0.0), m_maxPeaks(0), - m_addDetectors(true), m_densityScaleFactor(1e-6), prog(NULL), inst(), + m_addDetectors(true), m_densityScaleFactor(1e-6), prog(nullptr), inst(), m_runNumber(-1), dimType(), m_goniometer() {} //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/FitMD.cpp b/Framework/MDAlgorithms/src/FitMD.cpp index 3f411bbc0d6..4f9d9c0bb7a 100644 --- a/Framework/MDAlgorithms/src/FitMD.cpp +++ b/Framework/MDAlgorithms/src/FitMD.cpp @@ -33,7 +33,7 @@ using namespace Kernel; * Default Constructor */ FitMD::FitMD() - : API::IDomainCreator(NULL, std::vector<std::string>(), + : API::IDomainCreator(nullptr, std::vector<std::string>(), IDomainCreator::Simple), m_maxSize(0), m_startIndex(0), m_count(0) {} diff --git a/Framework/MDAlgorithms/src/IntegrateFlux.cpp b/Framework/MDAlgorithms/src/IntegrateFlux.cpp index 056c90c3be4..982be8f94a8 100644 --- a/Framework/MDAlgorithms/src/IntegrateFlux.cpp +++ b/Framework/MDAlgorithms/src/IntegrateFlux.cpp @@ -170,7 +170,7 @@ template <class EventType> void IntegrateFlux::integrateSpectraEvents( const DataObjects::EventWorkspace &inputWS, API::MatrixWorkspace &integrWS) const { - inputWS.sortAll(DataObjects::TOF_SORT, NULL); + inputWS.sortAll(DataObjects::TOF_SORT, nullptr); size_t nSpec = inputWS.getNumberHistograms(); assert(nSpec == integrWS.getNumberHistograms()); diff --git a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp index 0557a9a29df..4c1ca11b572 100644 --- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp +++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp @@ -352,7 +352,7 @@ void IntegrateMDHistoWorkspace::exec() { const int nThreads = Mantid::API::FrameworkManager::Instance() .getNumOMPThreads(); // NThreads to Request - auto outIterators = outWS->createIterators(nThreads, NULL); + auto outIterators = outWS->createIterators(nThreads, nullptr); PARALLEL_FOR_NO_WSP_CHECK() for (int i = 0; i < int(outIterators.size()); ++i) { diff --git a/Framework/MDAlgorithms/src/LoadMD.cpp b/Framework/MDAlgorithms/src/LoadMD.cpp index 37726c4a957..4d4c8dacea1 100644 --- a/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Framework/MDAlgorithms/src/LoadMD.cpp @@ -603,7 +603,7 @@ CoordTransform *LoadMD::loadAffineMatrix(std::string entry_name) { inD--; outD--; Matrix<coord_t> mat(vec); - CoordTransform *transform = NULL; + CoordTransform *transform = nullptr; if (("CoordTransformAffine" == type) || ("CoordTransformAligned" == type)) { auto affine = new CoordTransformAffine(inD, outD); affine->setMatrix(mat); diff --git a/Framework/MDAlgorithms/src/LoadSQW.cpp b/Framework/MDAlgorithms/src/LoadSQW.cpp index e0beda7bcb6..a8fb5140511 100644 --- a/Framework/MDAlgorithms/src/LoadSQW.cpp +++ b/Framework/MDAlgorithms/src/LoadSQW.cpp @@ -243,7 +243,7 @@ void LoadSQW::readEvents( // For tracking when to split boxes size_t eventsAdded = 0; BoxController_sptr bc = ws->getBoxController(); - DiskBuffer *dbuf(NULL); + DiskBuffer *dbuf(nullptr); if (bc->isFileBacked()) dbuf = bc->getFileIO(); diff --git a/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp b/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp index f288262e306..e09eab7fbc2 100644 --- a/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp +++ b/Framework/MDAlgorithms/src/MDEventWSWrapper.cpp @@ -27,7 +27,7 @@ void MDEventWSWrapper::createEmptyEventWS(const MDWSDescription &description) { if (!numBins.empty()) nBins = numBins[d]; - Geometry::MDHistoDimension *dim = NULL; + Geometry::MDHistoDimension *dim = nullptr; if (d < 3 && description.isQ3DMode()) { // We should have frame and scale information that we can use correctly // for our Q dimensions. diff --git a/Framework/MDAlgorithms/src/MDNormDirectSC.cpp b/Framework/MDAlgorithms/src/MDNormDirectSC.cpp index efc710413ea..f676e597286 100644 --- a/Framework/MDAlgorithms/src/MDNormDirectSC.cpp +++ b/Framework/MDAlgorithms/src/MDNormDirectSC.cpp @@ -155,7 +155,7 @@ void MDNormDirectSC::cacheInputs() { const auto &exptInfoZero = *(m_inputWS->getExperimentInfo(0)); auto source = exptInfoZero.getInstrument()->getSource(); auto sample = exptInfoZero.getInstrument()->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { throw Kernel::Exception::InstrumentDefinitionError( "Instrument not sufficiently defined: failed to get source and/or " "sample"); @@ -449,7 +449,7 @@ void MDNormDirectSC::calculateNormalization( API::MatrixWorkspace_const_sptr solidAngleWS = getProperty("SolidAngleWorkspace"); detid2index_map solidAngDetToIdx; - if (solidAngleWS != NULL) { + if (solidAngleWS != nullptr) { haveSA = true; solidAngDetToIdx = solidAngleWS->getDetectorIDToWorkspaceIndexMap(); } diff --git a/Framework/MDAlgorithms/src/MDNormSCD.cpp b/Framework/MDAlgorithms/src/MDNormSCD.cpp index 665807725fa..cd52b0c7a49 100644 --- a/Framework/MDAlgorithms/src/MDNormSCD.cpp +++ b/Framework/MDAlgorithms/src/MDNormSCD.cpp @@ -155,7 +155,7 @@ void MDNormSCD::cacheInputs() { const auto &exptInfoZero = *(m_inputWS->getExperimentInfo(0)); auto source = exptInfoZero.getInstrument()->getSource(); auto sample = exptInfoZero.getInstrument()->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { throw Kernel::Exception::InstrumentDefinitionError( "Instrument not sufficiently defined: failed to get source and/or " "sample"); diff --git a/Framework/MDAlgorithms/src/MDTransfModQ.cpp b/Framework/MDAlgorithms/src/MDTransfModQ.cpp index d253d3ab12b..197acc853fc 100644 --- a/Framework/MDAlgorithms/src/MDTransfModQ.cpp +++ b/Framework/MDAlgorithms/src/MDTransfModQ.cpp @@ -278,7 +278,7 @@ void MDTransfModQ::initialize(const MDWSDescription &ConvParams) { // pHost = &Conv; // get transformation matrix (needed for CrystalAsPoder mode) m_RotMat = ConvParams.getTransfMatrix(); - m_pEfixedArray = NULL; + m_pEfixedArray = nullptr; if (!ConvParams.m_PreprDetTable) throw(std::runtime_error("The detectors have not been preprocessed but " "they have to before running initialize")); @@ -333,7 +333,7 @@ void MDTransfModQ::initialize(const MDWSDescription &ConvParams) { // the wave vector of incident neutrons; m_Ki = sqrt(m_Ei / PhysicalConstants::E_mev_toNeutronWavenumberSq); - m_pEfixedArray = NULL; + m_pEfixedArray = nullptr; if (m_Emode == (int)Kernel::DeltaEMode::Indirect) m_pEfixedArray = ConvParams.m_PreprDetTable->getColDataArray<float>("eFixed"); @@ -402,10 +402,10 @@ MDTransfModQ::outputUnitID(Kernel::DeltaEMode::Type dEmode, /// constructor; MDTransfModQ::MDTransfModQ() - : m_ex(0), m_ey(0), m_ez(1), m_DetDirecton(NULL), //,m_NMatrixDim(-1) + : m_ex(0), m_ey(0), m_ez(1), m_DetDirecton(nullptr), //,m_NMatrixDim(-1) m_NMatrixDim(0), // uninitialized m_Emode(Kernel::DeltaEMode::Undefined), // uninitialized - m_Ki(1.), m_Ei(1.), m_pEfixedArray(NULL), m_pDetMasks(NULL) {} + m_Ki(1.), m_Ei(1.), m_pEfixedArray(nullptr), m_pDetMasks(nullptr) {} std::vector<std::string> MDTransfModQ::getEmodes() const { return Kernel::DeltaEMode::availableTypes(); diff --git a/Framework/MDAlgorithms/src/MDTransfNoQ.cpp b/Framework/MDAlgorithms/src/MDTransfNoQ.cpp index bf5f87c6385..00b5e1d76f1 100644 --- a/Framework/MDAlgorithms/src/MDTransfNoQ.cpp +++ b/Framework/MDAlgorithms/src/MDTransfNoQ.cpp @@ -180,7 +180,7 @@ MDTransfNoQ::inputUnitID(Kernel::DeltaEMode::Type mode, return pXAxis->unit()->unitID(); } -MDTransfNoQ::MDTransfNoQ() : m_NMatrixDim(0), m_YAxis(NULL), m_Det(NULL) {} +MDTransfNoQ::MDTransfNoQ() : m_NMatrixDim(0), m_YAxis(nullptr), m_Det(nullptr) {} /** * Set the display normalization for no Q diff --git a/Framework/MDAlgorithms/src/MDTransfQ3D.cpp b/Framework/MDAlgorithms/src/MDTransfQ3D.cpp index 3a79ff96bc4..cce7eb18983 100644 --- a/Framework/MDAlgorithms/src/MDTransfQ3D.cpp +++ b/Framework/MDAlgorithms/src/MDTransfQ3D.cpp @@ -193,8 +193,8 @@ bool MDTransfQ3D::calcYDepCoordinates(std::vector<coord_t> &Coord, size_t i) { /** function initalizes all variables necessary for converting workspace * variables into MD variables in ModQ (elastic/inelastic) cases */ void MDTransfQ3D::initialize(const MDWSDescription &ConvParams) { - m_pEfixedArray = NULL; - m_pDetMasks = NULL; + m_pEfixedArray = nullptr; + m_pDetMasks = nullptr; //********** Generic part of initialization, common for elastic and inelastic // modes: // get transformation matrix (needed for CrystalAsPoder mode) @@ -225,7 +225,7 @@ void MDTransfQ3D::initialize(const MDWSDescription &ConvParams) { // the wave vector of incident neutrons; m_Ki = sqrt(m_Ei / PhysicalConstants::E_mev_toNeutronWavenumberSq); - m_pEfixedArray = NULL; + m_pEfixedArray = nullptr; if (m_Emode == (int)Kernel::DeltaEMode::Indirect) m_pEfixedArray = ConvParams.m_PreprDetTable->getColDataArray<float>("eFixed"); @@ -318,7 +318,7 @@ MDTransfQ3D::outputUnitID(Kernel::DeltaEMode::Type dEmode, /// constructor; MDTransfQ3D::MDTransfQ3D() - : m_isLorentzCorrected(false), m_SinThetaSqArray(NULL), SinThetaSq(), + : m_isLorentzCorrected(false), m_SinThetaSqArray(nullptr), SinThetaSq(), m_SinThetaSq(0.), m_AbsMin(0.) {} } // End MDAlgorighms namespace diff --git a/Framework/MDAlgorithms/src/MergeMD.cpp b/Framework/MDAlgorithms/src/MergeMD.cpp index 5965871db3a..605e994e46d 100644 --- a/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Framework/MDAlgorithms/src/MergeMD.cpp @@ -218,7 +218,7 @@ void MergeMD::doPlus(typename MDEventWorkspace<MDE, nd>::sptr ws) { PARALLEL_CHECK_INTERUPT_REGION // Progress * prog2 = new Progress(this, 0.4, 0.9, 100); - Progress *prog2 = NULL; + Progress *prog2 = nullptr; ThreadScheduler *ts = new ThreadSchedulerFIFO(); ThreadPool tp(ts, 0, prog2); ws1->splitAllIfNeeded(ts); diff --git a/Framework/MDAlgorithms/src/MergeMDFiles.cpp b/Framework/MDAlgorithms/src/MergeMDFiles.cpp index 052b710d6aa..a82b54e006d 100644 --- a/Framework/MDAlgorithms/src/MergeMDFiles.cpp +++ b/Framework/MDAlgorithms/src/MergeMDFiles.cpp @@ -28,7 +28,7 @@ DECLARE_ALGORITHM(MergeMDFiles) MergeMDFiles::MergeMDFiles() : m_nDims(0), m_MDEventType(), m_fileBasedTargetWS(false), m_Filenames(), m_EventLoader(), m_OutIWS(), totalEvents(0), totalLoaded(0), fileMutex(), - statsMutex(), prog(NULL) {} + statsMutex(), prog(nullptr) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -77,7 +77,7 @@ void MergeMDFiles::loadBoxData() { totalEvents = 0; m_fileComponentsStructure.resize(m_Filenames.size()); - m_EventLoader.assign(m_Filenames.size(), NULL); + m_EventLoader.assign(m_Filenames.size(), nullptr); try { for (size_t i = 0; i < m_Filenames.size(); i++) { @@ -242,7 +242,7 @@ void MergeMDFiles::doExecByCloning(Mantid::API::IMDEventWorkspace_sptr ws, auto ts = new ThreadSchedulerFIFO(); ThreadPool tp(ts); - Kernel::DiskBuffer *DiskBuf(NULL); + Kernel::DiskBuffer *DiskBuf(nullptr); if (m_fileBasedTargetWS) { DiskBuf = bc->getFileIO(); } @@ -402,7 +402,7 @@ void MergeMDFiles::clearEventLoaders() { for (size_t i = 0; i < m_EventLoader.size(); i++) { if (m_EventLoader[i]) { delete m_EventLoader[i]; - m_EventLoader[i] = NULL; + m_EventLoader[i] = nullptr; } } } diff --git a/Framework/MDAlgorithms/src/MultiplyMD.cpp b/Framework/MDAlgorithms/src/MultiplyMD.cpp index c9352192194..9d2037843e7 100644 --- a/Framework/MDAlgorithms/src/MultiplyMD.cpp +++ b/Framework/MDAlgorithms/src/MultiplyMD.cpp @@ -68,7 +68,7 @@ void MultiplyMD::execEventScalar(typename MDEventWorkspace<MDE, nd>::sptr ws) { parentBox->getBoxes(boxes, 1000, true); bool fileBackedTarget(false); - Kernel::DiskBuffer *dbuff(NULL); + Kernel::DiskBuffer *dbuff(nullptr); if (ws->isFileBacked()) { fileBackedTarget = true; dbuff = ws->getBoxController()->getFileIO(); diff --git a/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp b/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp index c3aa0a51f81..209cc439c2e 100644 --- a/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp +++ b/Framework/MDAlgorithms/src/PreprocessDetectorsToMD.cpp @@ -223,13 +223,13 @@ void PreprocessDetectorsToMD::processDetectorsPositions( // Efixed; do we need one and does one exist? double Efi = targWS->getLogs()->getPropertyValueAsType<double>("Ei"); - float *pEfixedArray(NULL); + float *pEfixedArray(nullptr); const Geometry::ParameterMap &pmap = inputWS->constInstrumentParameters(); if (m_getEFixed) pEfixedArray = targWS->getColDataArray<float>("eFixed"); // check if one needs to generate masked detectors column. - int *pMasksArray(NULL); + int *pMasksArray(nullptr); if (m_getIsMasked) pMasksArray = targWS->getColDataArray<int>("detMask"); diff --git a/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp b/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp index 618b255e989..fb8d7ffd385 100644 --- a/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp +++ b/Framework/MDAlgorithms/src/Quantification/CachedExperimentInfo.cpp @@ -22,7 +22,7 @@ CachedExperimentInfo::CachedExperimentInfo(const API::ExperimentInfo &exptInfo, m_modToChop(0.0), m_apertureToChop(0.0), m_chopToSample(0.0), m_sampleToDet(0.0), m_beam(Geometry::Z), m_up(Geometry::Y), m_horiz(Geometry::X), m_apertureSize(0.0, 0.0), m_sampleWidths(), - m_detBox(), m_gonimeter(NULL), m_sampleToDetMatrix(0, 0) { + m_detBox(), m_gonimeter(nullptr), m_sampleToDetMatrix(0, 0) { Instrument_const_sptr instrument = exptInfo.getInstrument(); initCaches(instrument, detID); } diff --git a/Framework/MDAlgorithms/src/Quantification/ForegroundModel.cpp b/Framework/MDAlgorithms/src/Quantification/ForegroundModel.cpp index 4b9ab002559..3655083df19 100644 --- a/Framework/MDAlgorithms/src/Quantification/ForegroundModel.cpp +++ b/Framework/MDAlgorithms/src/Quantification/ForegroundModel.cpp @@ -18,8 +18,8 @@ const char *FORM_FACTOR_ION = "FormFactorIon"; * Default constructor only callable by the factory */ ForegroundModel::ForegroundModel() - : API::ParamFunction(), m_fittingFunction(NULL), m_parOffset(0), - m_MagIonName(""), m_formFactorTable(NULL) { + : API::ParamFunction(), m_fittingFunction(nullptr), m_parOffset(0), + m_MagIonName(""), m_formFactorTable(nullptr) { addAttributes(); setFormFactorIon("0"); // Off } @@ -29,8 +29,8 @@ ForegroundModel::ForegroundModel() * @param fittingFunction :: A reference to the fitting function */ ForegroundModel::ForegroundModel(const API::IFunction &fittingFunction) - : API::ParamFunction(), m_fittingFunction(NULL), m_parOffset(0), - m_formFactorTable(NULL) { + : API::ParamFunction(), m_fittingFunction(nullptr), m_parOffset(0), + m_formFactorTable(nullptr) { addAttributes(); setFormFactorIon("0"); // Off setFunctionUnderMinimization(fittingFunction); @@ -130,7 +130,7 @@ void ForegroundModel::setFormFactorIon(const std::string &ionType) { // "0" indicates off if (ionType == "0") { delete m_formFactorTable; - m_formFactorTable = NULL; + m_formFactorTable = nullptr; } else { using namespace PhysicalConstants; if (m_MagIonName != ionType) { diff --git a/Framework/MDAlgorithms/src/Quantification/MDResolutionConvolution.cpp b/Framework/MDAlgorithms/src/Quantification/MDResolutionConvolution.cpp index 911d35f858f..7e78d75f74e 100644 --- a/Framework/MDAlgorithms/src/Quantification/MDResolutionConvolution.cpp +++ b/Framework/MDAlgorithms/src/Quantification/MDResolutionConvolution.cpp @@ -9,7 +9,7 @@ namespace Mantid { namespace MDAlgorithms { /// Default constructor required by the factory MDResolutionConvolution::MDResolutionConvolution() - : ParamFunction(), m_fittingFunction(NULL), m_foreground(NULL) {} + : ParamFunction(), m_fittingFunction(nullptr), m_foreground(nullptr) {} /** * Construct the object with a ForegroundModel & resolution the function being @@ -21,7 +21,7 @@ MDResolutionConvolution::MDResolutionConvolution() */ MDResolutionConvolution::MDResolutionConvolution( const API::IFunctionMD &fittingFunction, const std::string &fgModelName) - : ParamFunction(), m_fittingFunction(NULL), m_foreground(NULL) { + : ParamFunction(), m_fittingFunction(nullptr), m_foreground(nullptr) { setFittingFunction(fittingFunction); setForegroundModel(fgModelName); } diff --git a/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp b/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp index 2e046ad19f7..f2ff2581fd2 100644 --- a/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp +++ b/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitResolutionModel.cpp @@ -44,7 +44,7 @@ Kernel::Logger g_log("TobyFitResolutionModel"); * Default constructor */ TobyFitResolutionModel::TobyFitResolutionModel() - : MDResolutionConvolution(), m_randomNumbers(1, NULL), m_mcLoopMin(100), + : MDResolutionConvolution(), m_randomNumbers(1, nullptr), m_mcLoopMin(100), m_mcLoopMax(1000), m_mcType(4), m_mcRelErrorTol(1e-5), m_foregroundOnly(false), m_mosaicActive(true), m_bmatrix(1), m_yvector(1), m_etaInPlane(1, 0.0), m_etaOutPlane(1, 0.0), @@ -60,7 +60,7 @@ TobyFitResolutionModel::TobyFitResolutionModel() TobyFitResolutionModel::TobyFitResolutionModel( const API::IFunctionMD &fittedFunction, const std::string &fgModel) : MDResolutionConvolution(fittedFunction, fgModel), - m_randomNumbers(1, NULL), m_mcLoopMin(100), m_mcLoopMax(1000), + m_randomNumbers(1, nullptr), m_mcLoopMin(100), m_mcLoopMax(1000), m_mcType(4), m_mcRelErrorTol(1e-5), m_foregroundOnly(false), m_mosaicActive(true), m_bmatrix(1), m_yvector(1), m_etaInPlane(1, 0.0), m_etaOutPlane(1, 0.0), m_deltaQE(1, std::vector<double>(4, 0.0)), @@ -548,7 +548,7 @@ void TobyFitResolutionModel::setNThreads(int nthreads) { return; // done on construction m_randomNumbers = - std::vector<Kernel::NDRandomNumberGenerator *>(nthreads, NULL); + std::vector<Kernel::NDRandomNumberGenerator *>(nthreads, nullptr); m_bmatrix = std::vector<TobyFitBMatrix>( nthreads, m_bmatrix[0]); // Initialize with copy of current m_yvector = std::vector<TobyFitYVector>(nthreads, m_yvector[0]); diff --git a/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitYVector.cpp b/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitYVector.cpp index d3da277c6df..c6e8346f381 100644 --- a/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitYVector.cpp +++ b/Framework/MDAlgorithms/src/Quantification/Resolution/TobyFitYVector.cpp @@ -28,8 +28,8 @@ unsigned int TobyFitYVector::length() { return 11; } * Construct a Y vector for the current set up. */ TobyFitYVector::TobyFitYVector() - : m_yvector(length(), 0.0), m_curRandNums(NULL), m_randIndex(0), - m_curObs(NULL), m_curQOmega(NULL), m_moderator(true), m_aperture(true), + : m_yvector(length(), 0.0), m_curRandNums(nullptr), m_randIndex(0), + m_curObs(nullptr), m_curQOmega(nullptr), m_moderator(true), m_aperture(true), m_chopper(true), m_chopperJitter(true), m_sampleVolume(true), m_detectorDepth(true), m_detectorArea(true), m_detectionTime(true) {} @@ -148,10 +148,10 @@ size_t TobyFitYVector::recalculate(const std::vector<double> &randomNums, calculateTimeBinContribution(); size_t randUsed = m_randIndex; - m_curRandNums = NULL; + m_curRandNums = nullptr; m_randIndex = 0; - m_curObs = NULL; - m_curQOmega = NULL; + m_curObs = nullptr; + m_curQOmega = nullptr; return randUsed; } diff --git a/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp b/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp index dddeb6e4a76..cfc787c852a 100644 --- a/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp +++ b/Framework/MDAlgorithms/src/Quantification/ResolutionConvolvedCrossSection.cpp @@ -67,7 +67,7 @@ Kernel::Logger g_log("ResolutionConvolvedCrossSection"); * Constructor */ ResolutionConvolvedCrossSection::ResolutionConvolvedCrossSection() - : ParamFunction(), IFunctionMD(), m_simulation(false), m_convolution(NULL), + : ParamFunction(), IFunctionMD(), m_simulation(false), m_convolution(nullptr), m_inputWS() {} /** diff --git a/Framework/MDAlgorithms/src/ReplicateMD.cpp b/Framework/MDAlgorithms/src/ReplicateMD.cpp index 340f280f2be..85be2db7902 100644 --- a/Framework/MDAlgorithms/src/ReplicateMD.cpp +++ b/Framework/MDAlgorithms/src/ReplicateMD.cpp @@ -326,7 +326,7 @@ void ReplicateMD::exec() { .getNumOMPThreads(); // NThreads to Request // collection of iterators - auto iterators = outputWS->createIterators(nThreads, NULL); + auto iterators = outputWS->createIterators(nThreads, nullptr); PARALLEL_FOR_NO_WSP_CHECK() for (int it = 0; it < int(iterators.size()); ++it) { diff --git a/Framework/MDAlgorithms/src/SliceMD.cpp b/Framework/MDAlgorithms/src/SliceMD.cpp index ae371f90a4f..af305a7a0e6 100644 --- a/Framework/MDAlgorithms/src/SliceMD.cpp +++ b/Framework/MDAlgorithms/src/SliceMD.cpp @@ -185,7 +185,7 @@ void SliceMD::slice(typename MDEventWorkspace<MDE, nd>::sptr ws) { // Function defining which events (in the input dimensions) to place in the // output - MDImplicitFunction *function = this->getImplicitFunctionForChunk(NULL, NULL); + MDImplicitFunction *function = this->getImplicitFunctionForChunk(nullptr, nullptr); std::vector<API::IMDNode *> boxes; // Leaf-only; no depth limit; with the implicit function passed to it. @@ -262,7 +262,7 @@ void SliceMD::slice(typename MDEventWorkspace<MDE, nd>::sptr ws) { } // for each box in the vector prog->report(); - outWS->splitAllIfNeeded(NULL); + outWS->splitAllIfNeeded(nullptr); // Refresh all cache. outWS->refreshCache(); diff --git a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index f444e2555b3..b478a469962 100644 --- a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -422,7 +422,7 @@ void SlicingAlgorithm::createGeneralTransform() { "the OutDimX, etc. properties."); // Now the reverse transformation - m_transformToOriginal = NULL; + m_transformToOriginal = nullptr; if (m_outD == inD) { // Can't reverse transform if you lost dimensions. auto ctTo = new DataObjects::CoordTransformAffine(inD, m_outD); @@ -598,7 +598,7 @@ void SlicingAlgorithm::createAlignedTransform() { m_transformToOriginal = tmp; } else { // Changed # of dimensions - can't reverse the transform - m_transformToOriginal = NULL; + m_transformToOriginal = nullptr; g_log.warning("SlicingAlgorithm: Your slice will cause the output " "workspace to have less dimensions than the input. This will " "affect your ability to create subsequent slices."); @@ -684,7 +684,7 @@ void SlicingAlgorithm::createTransform() { } // Create the coordinate transformation - m_transform = NULL; + m_transform = nullptr; if (m_axisAligned) this->createAlignedTransform(); else @@ -819,9 +819,9 @@ SlicingAlgorithm::getGeneralImplicitFunction(const size_t *const chunkMin, double xMin = m_binDimensions[d]->getMinimum(); double xMax = m_binDimensions[d]->getMaximum(); // Move the position if you're using a chunk - if (chunkMin != NULL) + if (chunkMin != nullptr) xMin = m_binDimensions[d]->getX(chunkMin[d]); - if (chunkMax != NULL) + if (chunkMax != nullptr) xMax = m_binDimensions[d]->getX(chunkMax[d]); // Offset the origin by the position along the basis vector o1 += (m_bases[d] * xMin); diff --git a/Framework/MDAlgorithms/src/SmoothMD.cpp b/Framework/MDAlgorithms/src/SmoothMD.cpp index 72243e086fd..505eb5f1c33 100644 --- a/Framework/MDAlgorithms/src/SmoothMD.cpp +++ b/Framework/MDAlgorithms/src/SmoothMD.cpp @@ -126,7 +126,7 @@ SmoothMD::hatSmooth(IMDHistoWorkspace_const_sptr toSmooth, const int nThreads = Mantid::API::FrameworkManager::Instance() .getNumOMPThreads(); // NThreads to Request - auto iterators = toSmooth->createIterators(nThreads, NULL); + auto iterators = toSmooth->createIterators(nThreads, nullptr); PARALLEL_FOR_NO_WSP_CHECK() for (int it = 0; it < int(iterators.size()); ++it) { diff --git a/Framework/MDAlgorithms/src/TransposeMD.cpp b/Framework/MDAlgorithms/src/TransposeMD.cpp index 0a2f355fdd1..d90d42f882f 100644 --- a/Framework/MDAlgorithms/src/TransposeMD.cpp +++ b/Framework/MDAlgorithms/src/TransposeMD.cpp @@ -135,7 +135,7 @@ void TransposeMD::exec() { const int nThreads = Mantid::API::FrameworkManager::Instance() .getNumOMPThreads(); // NThreads to Request - auto iterators = inWS->createIterators(nThreads, NULL); + auto iterators = inWS->createIterators(nThreads, nullptr); PARALLEL_FOR_NO_WSP_CHECK() for (int it = 0; it < int(iterators.size()); ++it) { diff --git a/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp b/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp index 7e29d31311e..877572a7072 100644 --- a/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp +++ b/Framework/MDAlgorithms/src/UnitsConversionHelper.cpp @@ -263,7 +263,7 @@ void UnitsConversionHelper::initialize( // get efix m_Efix = DetWS->getLogs()->getPropertyValueAsType<double>("Ei"); - m_pEfixedArray = NULL; + m_pEfixedArray = nullptr; if (m_Emode == (int)Kernel::DeltaEMode::Indirect) m_pEfixedArray = DetWS->getColDataArray<float>("eFixed"); @@ -365,8 +365,8 @@ UnitsConversionHelper::UnitsConversionHelper( UnitsConversionHelper::UnitsConversionHelper() : m_UnitCnvrsn(CnvrtToMD::ConvertNo), m_Factor(1), m_Power(1), m_Emode(-1), // undefined - m_L1(1), m_Efix(1), m_TwoTheta(0), m_L2(1), m_pTwoThetas(NULL), - m_pL2s(NULL), m_pEfixedArray(NULL) {} + m_L1(1), m_Efix(1), m_TwoTheta(0), m_L2(1), m_pTwoThetas(nullptr), + m_pL2s(nullptr), m_pEfixedArray(nullptr) {} } // endNamespace DataObjects } // endNamespace Mantid diff --git a/Framework/Nexus/src/MuonNexusReader.cpp b/Framework/Nexus/src/MuonNexusReader.cpp index 594dc6d35b4..b7b1c6b2c0f 100644 --- a/Framework/Nexus/src/MuonNexusReader.cpp +++ b/Framework/Nexus/src/MuonNexusReader.cpp @@ -27,7 +27,7 @@ using namespace Mantid; MuonNexusReader::MuonNexusReader() : nexus_instrument_name(), nexus_samplename(), nexusLogCount(0), startTime_time_t(), t_nsp1(0), t_ntc1(0), t_nper(0), - corrected_times(NULL), counts(NULL), detectorGroupings(NULL), + corrected_times(nullptr), counts(nullptr), detectorGroupings(nullptr), numDetectors(0) {} /// Destructor deletes temp storage diff --git a/Framework/Nexus/src/NexusClasses.cpp b/Framework/Nexus/src/NexusClasses.cpp index f0266f90289..0a2035b2d53 100644 --- a/Framework/Nexus/src/NexusClasses.cpp +++ b/Framework/Nexus/src/NexusClasses.cpp @@ -596,7 +596,7 @@ Kernel::Property *NXLog::createSingleValueProperty() { bool state = (value[0] == 0) ? false : true; prop = new Kernel::PropertyWithValue<bool>(name(), state); } else { - prop = NULL; + prop = nullptr; } return prop; @@ -625,7 +625,7 @@ Kernel::Property *NXLog::createTimeSeries(const std::string &start_time, std::transform(times(), times() + times.dim0(), times(), std::bind2nd(std::multiplies<double>(), 60)); } else if (!units.empty() && units.substr(0, 6) != "second") { - return NULL; + return nullptr; } return parseTimeSeries(logName, times, start_time); } else if (vinfo.type == NX_FLOAT32) { @@ -637,12 +637,12 @@ Kernel::Property *NXLog::createTimeSeries(const std::string &start_time, std::transform(times(), times() + times.dim0(), times(), std::bind2nd(std::multiplies<float>(), 60)); } else if (!units.empty() && units.substr(0, 6) != "second") { - return NULL; + return nullptr; } return parseTimeSeries(logName, times, start_time); } - return NULL; + return nullptr; } } // namespace DataHandling diff --git a/Framework/Nexus/src/NexusFileIO.cpp b/Framework/Nexus/src/NexusFileIO.cpp index 784d9232923..fd41f17daaf 100644 --- a/Framework/Nexus/src/NexusFileIO.cpp +++ b/Framework/Nexus/src/NexusFileIO.cpp @@ -36,7 +36,7 @@ Logger g_log("NexusFileIO"); /// Empty default constructor NexusFileIO::NexusFileIO() - : fileID(), m_filehandle(), m_nexuscompression(NX_COMP_LZW), m_progress(0), + : fileID(), m_filehandle(), m_nexuscompression(NX_COMP_LZW), m_progress(nullptr), m_filename() {} /// Constructor that supplies a progress object @@ -343,7 +343,7 @@ int NexusFileIO::writeNexusProcessedData2D( start, asize); start[0]++; } - if (m_progress != 0) + if (m_progress != nullptr) m_progress->reportIncrement(1, "Writing data"); int signal = 1; NXputattr(fileID, "signal", &signal, 1, NX_INT32); @@ -376,7 +376,7 @@ int NexusFileIO::writeNexusProcessedData2D( start[0]++; } - if (m_progress != 0) + if (m_progress != nullptr) m_progress->reportIncrement(1, "Writing data"); // Fractional area for RebinnedOutput @@ -395,7 +395,7 @@ int NexusFileIO::writeNexusProcessedData2D( start, asize); start[0]++; } - if (m_progress != 0) + if (m_progress != nullptr) m_progress->reportIncrement(1, "Writing data"); } diff --git a/Framework/PythonInterface/mantid/api/src/CloneMatrixWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/CloneMatrixWorkspace.cpp index 93b31ecd1ad..50221e80f91 100644 --- a/Framework/PythonInterface/mantid/api/src/CloneMatrixWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/CloneMatrixWorkspace.cpp @@ -63,7 +63,7 @@ PyArrayObject *cloneArray(MatrixWorkspace &workspace, DataField field, &PyArray_Type, PyArray_DescrFromType(NPY_DOUBLE), 2, // rank 2 arrayDims, // Length in each dimension - NULL, NULL, 0, NULL); + nullptr, NULL, 0, nullptr); double *dest = (double *)PyArray_DATA( nparray); // HEAD of the contiguous numpy data array for (size_t i = start; i < endp1; ++i) { diff --git a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp index e0e2d4edc98..873f0b78506 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/AlgorithmFactory.cpp @@ -80,7 +80,7 @@ void subscribe(AlgorithmFactoryImpl &self, const boost::python::object &obj) { (PyObject *) converter::registered<Algorithm>::converters.to_python_target_type(); // obj could be or instance/class, check instance first - PyObject *classObject(NULL); + PyObject *classObject(nullptr); if (PyObject_IsInstance(obj.ptr(), pyAlgClass)) { classObject = PyObject_GetAttrString(obj.ptr(), "__class__"); } else if (PyObject_IsSubclass(obj.ptr(), pyAlgClass)) { diff --git a/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp b/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp index ad05a3f0262..7615fa909c0 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/FunctionFactory.cpp @@ -61,7 +61,7 @@ void subscribe(FunctionFactoryImpl &self, const boost::python::object &obj) { converter::registered<IFunction>::converters.to_python_target_type()); // obj could be or instance/class, check instance first - PyObject *classObject(NULL); + PyObject *classObject(nullptr); if (PyObject_IsInstance(obj.ptr(), (PyObject *)baseClass)) { classObject = PyObject_GetAttrString(obj.ptr(), "__class__"); } else if (PyObject_IsSubclass(obj.ptr(), (PyObject *)baseClass)) { diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp index 61726399180..7657ed3f22a 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp @@ -206,12 +206,12 @@ std::string createDocString(IAlgorithm &self) { */ struct AllowCThreads { explicit AllowCThreads(const object &algm) - : m_tracefunc(NULL), m_tracearg(NULL), m_saved(NULL), m_tracking(false) { + : m_tracefunc(nullptr), m_tracearg(nullptr), m_saved(nullptr), m_tracking(false) { PyThreadState *curThreadState = PyThreadState_GET(); m_tracefunc = curThreadState->c_tracefunc; m_tracearg = curThreadState->c_traceobj; Py_XINCREF(m_tracearg); - PyEval_SetTrace(NULL, NULL); + PyEval_SetTrace(nullptr, nullptr); if (!isNone(algm)) { _trackAlgorithmInThread(curThreadState->thread_id, algm); m_tracking = true; diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp index 452af26f974..68e8e72d7e5 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp @@ -26,9 +26,9 @@ PyObject *WrapReadOnlyNumpyFArray(Mantid::signal_t *arr, int datatype = Converters::NDArrayTypeIndex<Mantid::signal_t>::typenum; #if NPY_API_VERSION >= 0x00000007 //(1.7) PyArrayObject *nparray = (PyArrayObject *)PyArray_New( - &PyArray_Type, static_cast<int>(dims.size()), &dims[0], datatype, NULL, + &PyArray_Type, static_cast<int>(dims.size()), &dims[0], datatype, nullptr, static_cast<void *>(const_cast<double *>(arr)), 0, NPY_ARRAY_FARRAY, - NULL); + nullptr); PyArray_CLEARFLAGS(nparray, NPY_ARRAY_WRITEABLE); #else PyArrayObject *nparray = (PyArrayObject *)PyArray_New( diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp index 0b2dd40fd55..b0d0216d104 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp @@ -75,7 +75,7 @@ PyObject *getValue(Mantid::API::Column_const_sptr column, // -- Use the boost preprocessor to generate a list of else if clause to cut // out copy // and pasted code. - PyObject *result(NULL); + PyObject *result(nullptr); if (false) { } // So that it always falls through to the list checking BOOST_PP_LIST_FOR_EACH(GET_BUILTIN, _, BUILTIN_TYPES) @@ -155,7 +155,7 @@ bool addColumnPlotType(ITableWorkspace &self, const std::string &type, if (column) column->setPlotType(plottype); - return column != 0; + return column != nullptr; } /** @@ -170,7 +170,7 @@ bool addColumnPlotType(ITableWorkspace &self, const std::string &type, */ bool addColumnSimple(ITableWorkspace &self, const std::string &type, const std::string &name) { - return self.addColumn(type, name) != 0; + return self.addColumn(type, name) != nullptr; } /** diff --git a/Framework/PythonInterface/mantid/api/src/ExtractWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/ExtractWorkspace.cpp index 50657cc8315..4540b383f2d 100644 --- a/Framework/PythonInterface/mantid/api/src/ExtractWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/ExtractWorkspace.cpp @@ -37,7 +37,7 @@ ExtractWorkspace::ExtractWorkspace(const boost::python::api::object &pyvalue) * Check whether the extract can pull out the workspace type * @return True if it can be converted, false otherwise */ -bool ExtractWorkspace::check() const { return m_value.get() != NULL; } +bool ExtractWorkspace::check() const { return m_value.get() != nullptr; } /** * @return The extracted shared_ptr or throws std::invalid_argument diff --git a/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp b/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp index 2e159647b9d..5f0597d9681 100644 --- a/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp +++ b/Framework/PythonInterface/mantid/api/src/FitFunctions/IFunctionAdapter.cpp @@ -99,7 +99,7 @@ PyObject *IFunctionAdapter::getAttributeValue(const std::string &name) { PyObject * IFunctionAdapter::getAttributeValue(const API::IFunction::Attribute &attr) { std::string type = attr.type(); - PyObject *result(NULL); + PyObject *result(nullptr); if (type == "int") result = to_python_value<const int &>()(attr.asInt()); else if (type == "double") diff --git a/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp b/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp index 593ecb9fd06..539b2abb160 100644 --- a/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp +++ b/Framework/PythonInterface/mantid/api/src/PythonAlgorithm/AlgorithmAdapter.cpp @@ -22,7 +22,7 @@ using Environment::CallMethod0; */ template <typename BaseAlgorithm> AlgorithmAdapter<BaseAlgorithm>::AlgorithmAdapter(PyObject *self) - : BaseAlgorithm(), m_self(self), m_isRunningObj(NULL), m_wikiSummary("") { + : BaseAlgorithm(), m_self(self), m_isRunningObj(nullptr), m_wikiSummary("") { // Cache the isRunning call to save the lookup each time it is called // as it is most likely called in a loop @@ -141,7 +141,7 @@ bool AlgorithmAdapter<BaseAlgorithm>::isRunning() const { return SuperClass::isRunning(); } else { Environment::GlobalInterpreterLock gil; - PyObject *result = PyObject_CallObject(m_isRunningObj, NULL); + PyObject *result = PyObject_CallObject(m_isRunningObj, nullptr); if (PyErr_Occurred()) Environment::throwRuntimeError(true); if (PyBool_Check(result)) diff --git a/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp b/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp index 5696352a6ca..15f94382e8d 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Converters/NumpyFunctions.cpp @@ -14,7 +14,7 @@ PyArrayObject *func_PyArray_NewFromDescr(int datatype, const int ndims, return (PyArrayObject *)PyArray_NewFromDescr( &PyArray_Type, PyArray_DescrFromType(datatype), ndims, // rank dims, // Length in each dimension - NULL, NULL, 0, NULL); + nullptr, NULL, 0, nullptr); } } } diff --git a/Framework/PythonInterface/mantid/kernel/src/Environment/ErrorHandling.cpp b/Framework/PythonInterface/mantid/kernel/src/Environment/ErrorHandling.cpp index d3fcc6369ee..a405ac23c30 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Environment/ErrorHandling.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Environment/ErrorHandling.cpp @@ -15,7 +15,7 @@ namespace Environment { namespace { void tracebackToMsg(std::stringstream &msg, PyTracebackObject *traceback, bool root = true) { - if (traceback == NULL) + if (traceback == nullptr) return; msg << "\n "; if (root) @@ -41,7 +41,7 @@ void throwRuntimeError(const bool withTrace) { throw std::runtime_error( "ErrorHandling::throwRuntimeError - No Python error state set!"); } - PyObject *exception(NULL), *value(NULL), *traceback(NULL); + PyObject *exception(nullptr), *value(nullptr), *traceback(nullptr); PyErr_Fetch(&exception, &value, &traceback); PyErr_NormalizeException(&exception, &value, &traceback); PyErr_Clear(); diff --git a/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp b/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp index 6bfecc3bc6b..0063e81f5df 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Registry/SequenceTypeHandler.cpp @@ -97,7 +97,7 @@ Kernel::Property *SequenceTypeHandler<ContainerType>::create( valueInC = std::vector<DestElementType>(1, scalar); } - Kernel::Property *valueProp(NULL); + Kernel::Property *valueProp(nullptr); if (isNone(validator)) { valueProp = new Kernel::PropertyWithValue<ContainerType>(name, valueInC, direction); diff --git a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp index c917c0afe5c..8022e369194 100644 --- a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp +++ b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp @@ -21,7 +21,7 @@ std::vector<Poco::Net::HTTPCookie> MantidWebServiceAPIHelper::g_cookies; MantidWebServiceAPIHelper::MantidWebServiceAPIHelper() : m_session( - NULL) // Make sure this is always either NULL or a valid pointer. + nullptr) // Make sure this is always either NULL or a valid pointer. { // TODO: the job manager factory or someone else should set this, and then // this class would be usable with any other compute resource that implements @@ -182,7 +182,7 @@ void MantidWebServiceAPIHelper::initHTTPRequest(Poco::Net::HTTPRequest &req, // Set up the session object if (m_session) { delete m_session; - m_session = NULL; + m_session = nullptr; } if (Poco::URI(m_serviceBaseUrl).getScheme() == "https") { diff --git a/Framework/SINQ/src/InvertMDDim.cpp b/Framework/SINQ/src/InvertMDDim.cpp index f266f70ab46..cfb4e6cd467 100644 --- a/Framework/SINQ/src/InvertMDDim.cpp +++ b/Framework/SINQ/src/InvertMDDim.cpp @@ -44,7 +44,7 @@ void InvertMDDim::exec() { int rank = static_cast<int>(inWS->getNumDims()); auto idx = new int[rank]; - if (idx == NULL || outWS == NULL) { + if (idx == nullptr || outWS == nullptr) { throw std::runtime_error("Out of memory in InvertMDDim"); } recurseDim(inWS, outWS, 0, idx, rank); diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiDetectorFactory.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiDetectorFactory.cpp index a0602aa9033..5084815893e 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiDetectorFactory.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiDetectorFactory.cpp @@ -22,7 +22,7 @@ PoldiDetectorFactory::createDetector(date experimentDate) { return new PoldiHeliumDetector(); } - return 0; + return nullptr; } } // namespace Poldi diff --git a/Framework/SINQ/src/SINQHMListener.cpp b/Framework/SINQ/src/SINQHMListener.cpp index 408cb99013c..4b79bd86d4a 100644 --- a/Framework/SINQ/src/SINQHMListener.cpp +++ b/Framework/SINQ/src/SINQHMListener.cpp @@ -221,7 +221,7 @@ void SINQHMListener::recurseDim(int *data, IMDHistoWorkspace_sptr ws, } void SINQHMListener::readHMData(IMDHistoWorkspace_sptr ws) { - int *data = NULL, length = 1; + int *data = nullptr, length = 1; coord_t *idx; for (int i = 0; i < rank; i++) { @@ -232,7 +232,7 @@ void SINQHMListener::readHMData(IMDHistoWorkspace_sptr ws) { std::istream &istr = httpRequest(pathBuffer.str()); data = (int *)malloc(length * sizeof(int)); - if (data == NULL) { + if (data == nullptr) { throw std::runtime_error("Out of memory reading HM data"); } istr.read((char *)data, length * sizeof(int)); diff --git a/Framework/TestHelpers/src/ComponentCreationHelper.cpp b/Framework/TestHelpers/src/ComponentCreationHelper.cpp index f6cf5e6bde5..c90770d1eec 100644 --- a/Framework/TestHelpers/src/ComponentCreationHelper.cpp +++ b/Framework/TestHelpers/src/ComponentCreationHelper.cpp @@ -159,8 +159,7 @@ createDetectorGroupWith5CylindricalDetectors() { for (int i = 0; i < ndets; ++i) { std::ostringstream os; os << "d" << i; - boost::shared_ptr<Detector> det( - new Detector(os.str(), i + 1, detShape, NULL)); + auto det = boost::make_shared<Detector>(os.str(), i + 1, detShape, nullptr); det->setPos((double)(i + 1), 2.0, 2.0); groupMembers[i] = det; } @@ -184,8 +183,7 @@ createDetectorGroupWithNCylindricalDetectorsWithGaps(unsigned int nDet, for (unsigned int i = 0; i < nDet; ++i) { std::ostringstream os; os << "d" << i; - boost::shared_ptr<Detector> det( - new Detector(os.str(), i + 1, detShape, NULL)); + auto det = boost::make_shared<Detector>(os.str(), i + 1, detShape, nullptr); det->setPos(double(-0.5 * nDet + i) + gap, 2.0, 2.0); groupMembers[i] = det; } @@ -225,8 +223,7 @@ createRingOfCylindricalDetectors(const double R_min, const double R_max, if (Rsq >= Rmin2 && Rsq < Rmax2) { std::ostringstream os; os << "d" << ic; - boost::shared_ptr<Detector> det( - new Detector(os.str(), ic + 1, detShape, NULL)); + auto det = boost::make_shared<Detector>(os.str(), ic + 1, detShape, nullptr); det->setPos(x, y, z0); groupMembers.push_back(det); } @@ -248,7 +245,7 @@ boost::shared_ptr<DetectorGroup> createGroupOfTwoMonitors() { for (int i = 0; i < ndets; ++i) { std::ostringstream os; os << "m" << i; - boost::shared_ptr<Detector> det(new Detector(os.str(), i + 1, NULL)); + auto det = boost::make_shared<Detector>(os.str(), i + 1, nullptr); det->setPos((double)(i + 1), 2.0, 2.0); det->markAsMonitor(); groupMembers[i] = det; @@ -584,7 +581,7 @@ createMinimalInstrument(const Mantid::Kernel::V3D &sourcePos, instrument->markAsSamplePos(sample); // A detector - Detector *det = new Detector("point-detector", 1 /*detector id*/, NULL); + Detector *det = new Detector("point-detector", 1 /*detector id*/, nullptr); det->setPos(detectorPos); det->setShape(createSphere(0.01 /*1cm*/, V3D(0, 0, 0), "1")); instrument->add(det); diff --git a/Framework/TestHelpers/src/MDEventsTestHelper.cpp b/Framework/TestHelpers/src/MDEventsTestHelper.cpp index fc4f180a7bd..e7f60a1676a 100644 --- a/Framework/TestHelpers/src/MDEventsTestHelper.cpp +++ b/Framework/TestHelpers/src/MDEventsTestHelper.cpp @@ -72,7 +72,7 @@ createDiffractionEventWorkspace(int numEvents, int numPixels, int numBins) { "IDFs_for_UNIT_TESTING/MINITOPAZ_Definition.xml"); InstrumentDefinitionParser parser(filename, "MINITOPAZ", Strings::loadFile(filename)); - auto instrument = parser.parseXML(NULL); + auto instrument = parser.parseXML(nullptr); retVal->populateInstrumentParameters(); retVal->setInstrument(instrument); @@ -256,9 +256,7 @@ makeFakeMDHistoWorkspaceGeneral(size_t numDims, double signal, dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( names[d], names[d], frame, min[d], max[d], numBins[d]))); - MDHistoWorkspace *ws = NULL; - ws = new MDHistoWorkspace(dimensions); - MDHistoWorkspace_sptr ws_sptr(ws); + MDHistoWorkspace_sptr ws_sptr = boost::make_shared<MDHistoWorkspace>(dimensions); ws_sptr->setTo(signal, errorSquared, 1.0 /* num events */); if (!name.empty()) AnalysisDataService::Instance().addOrReplace(name, ws_sptr); @@ -291,9 +289,7 @@ MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceGeneral( dimensions.push_back(MDHistoDimension_sptr(new MDHistoDimension( names[d], names[d], frame, min[d], max[d], numBins[d]))); - MDHistoWorkspace *ws = NULL; - ws = new MDHistoWorkspace(dimensions); - MDHistoWorkspace_sptr ws_sptr(ws); + MDHistoWorkspace_sptr ws_sptr = boost::make_shared<MDHistoWorkspace>(dimensions); ws_sptr->setTo(signal, errorSquared, 1.0 /* num events */); if (!name.empty()) AnalysisDataService::Instance().addOrReplace(name, ws_sptr); @@ -318,39 +314,33 @@ Mantid::DataObjects::MDHistoWorkspace_sptr makeFakeMDHistoWorkspaceWithMDFrame( double signal, size_t numDims, const Mantid::Geometry::MDFrame &frame, size_t numBins, coord_t max, double errorSquared, std::string name, double numEvents) { - MDHistoWorkspace *ws = NULL; + //MDHistoWorkspace *ws = nullptr; + MDHistoWorkspace_sptr ws_sptr; if (numDims == 1) { - ws = new MDHistoWorkspace(MDHistoDimension_sptr( - new MDHistoDimension("x", "x", frame, 0.0, max, numBins))); + ws_sptr = boost::make_shared<MDHistoWorkspace>(boost::make_shared<MDHistoDimension>("x", "x", frame, 0.0, max, numBins)); } else if (numDims == 2) { - ws = new MDHistoWorkspace(MDHistoDimension_sptr(new MDHistoDimension( - "x", "x", frame, 0.0, max, numBins)), - MDHistoDimension_sptr(new MDHistoDimension( - "y", "y", frame, 0.0, max, numBins))); + ws_sptr = boost::make_shared<MDHistoWorkspace>(boost::make_shared<MDHistoDimension>( + "x", "x", frame, 0.0, max, numBins), + boost::make_shared<MDHistoDimension>( + "y", "y", frame, 0.0, max, numBins)); } else if (numDims == 3) { - ws = new MDHistoWorkspace(MDHistoDimension_sptr(new MDHistoDimension( - "x", "x", frame, 0.0, max, numBins)), - MDHistoDimension_sptr(new MDHistoDimension( - "y", "y", frame, 0.0, max, numBins)), - MDHistoDimension_sptr(new MDHistoDimension( - "z", "z", frame, 0.0, max, numBins))); + ws_sptr = boost::make_shared<MDHistoWorkspace>(boost::make_shared<MDHistoDimension>( + "x", "x", frame, 0.0, max, numBins), + boost::make_shared<MDHistoDimension>( + "y", "y", frame, 0.0, max, numBins), + boost::make_shared<MDHistoDimension>( + "z", "z", frame, 0.0, max, numBins)); } else if (numDims == 4) { - ws = new MDHistoWorkspace( - MDHistoDimension_sptr( - new MDHistoDimension("x", "x", frame, 0.0, max, numBins)), - MDHistoDimension_sptr( - new MDHistoDimension("y", "y", frame, 0.0, max, numBins)), - MDHistoDimension_sptr( - new MDHistoDimension("z", "z", frame, 0.0, max, numBins)), - MDHistoDimension_sptr( - new MDHistoDimension("t", "t", frame, 0.0, max, numBins))); + ws_sptr = boost::make_shared<MDHistoWorkspace>(boost::make_shared<MDHistoDimension>("x", "x", frame, 0.0, max, numBins), + boost::make_shared<MDHistoDimension>("y", "y", frame, 0.0, max, numBins), + boost::make_shared<MDHistoDimension>("z", "z", frame, 0.0, max, numBins), + boost::make_shared<MDHistoDimension>("t", "t", frame, 0.0, max, numBins)); } - if (!ws) + if (!ws_sptr) throw std::runtime_error( " invalid or unsupported number of dimensions given"); - MDHistoWorkspace_sptr ws_sptr(ws); ws_sptr->setTo(signal, errorSquared, numEvents); ws_sptr->addExperimentInfo(ExperimentInfo_sptr(new ExperimentInfo())); if (!name.empty()) diff --git a/Framework/TestHelpers/src/NexusTestHelper.cpp b/Framework/TestHelpers/src/NexusTestHelper.cpp index 4667e73470a..9fb8bf16a84 100644 --- a/Framework/TestHelpers/src/NexusTestHelper.cpp +++ b/Framework/TestHelpers/src/NexusTestHelper.cpp @@ -12,7 +12,7 @@ /** Constructor. * */ NexusTestHelper::NexusTestHelper(bool deleteFile) - : file(NULL), deleteFile(deleteFile) {} + : file(nullptr), deleteFile(deleteFile) {} //---------------------------------------------------------------------------------------------- /** Destructor. diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp index e919b750834..48a7e6e461c 100644 --- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp +++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp @@ -217,7 +217,7 @@ Workspace2D_sptr maskSpectra(Workspace2D_sptr workspace, ShapeFactory sFactory; boost::shared_ptr<Object> shape = sFactory.createShape(xmlShape); for (int i = 0; i < nhist; ++i) { - Detector *det = new Detector("det", detid_t(i), shape, NULL); + Detector *det = new Detector("det", detid_t(i), shape, nullptr); det->setPos(i, i + 1, 1); instrument->add(det); instrument->markAsDetector(det); @@ -533,7 +533,7 @@ create2DWorkspaceWithReflectometryInstrument(double startX) { instrument->add(source); instrument->markAsSource(source); - Detector *monitor = new Detector("Monitor", 1, NULL); + Detector *monitor = new Detector("Monitor", 1, nullptr); monitor->setPos(14, 0, 0); instrument->add(monitor); instrument->markAsMonitor(monitor); @@ -546,7 +546,7 @@ create2DWorkspaceWithReflectometryInstrument(double startX) { // Where 0.01 is half detector width etc. Detector *det = new Detector( "point-detector", 2, - ComponentCreationHelper::createCuboid(0.01, 0.02, 0.03), NULL); + ComponentCreationHelper::createCuboid(0.01, 0.02, 0.03), nullptr); det->setPos(20, (20 - sample->getPos().X()), 0); instrument->add(det); instrument->markAsDetector(det); @@ -589,7 +589,7 @@ void createInstrumentForWorkspaceWithDistances( for (int i = 0; i < static_cast<int>(detectorPositions.size()); ++i) { std::stringstream buffer; buffer << "detector_" << i; - Detector *det = new Detector(buffer.str(), i, NULL); + Detector *det = new Detector(buffer.str(), i, nullptr); det->setPos(detectorPositions[i]); instrument->add(det); instrument->markAsDetector(det); diff --git a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp index 6232ca0a476..fec6363d95c 100644 --- a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp +++ b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp @@ -39,7 +39,7 @@ AlignAndFocusPowder::AlignAndFocusPowder() : API::DataProcessorAlgorithm(), m_l1(0.0), m_resampleX(0), dspace(false), xmin(0.0), xmax(0.0), LRef(0.0), DIFCref(0.0), minwl(0.0), maxwl(0.), tmin(0.0), tmax(0.0), m_preserveEvents(false), m_processLowResTOF(false), - m_lowResSpecOffset(0), m_progress(NULL) {} + m_lowResSpecOffset(0), m_progress(nullptr) {} AlignAndFocusPowder::~AlignAndFocusPowder() { if (m_progress) diff --git a/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp b/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp index dbceb989267..5da069d2e38 100644 --- a/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp +++ b/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp @@ -32,7 +32,7 @@ static double getYTubeAngle(IDetector_const_sptr det, workspace->getInstrument()->getSource(); Geometry::IComponent_const_sptr sample = workspace->getInstrument()->getSample(); - if (source == NULL || sample == NULL) { + if (source == nullptr || sample == nullptr) { throw std::invalid_argument("Instrument not sufficiently defined: failed " "to get source and/or sample"); } -- GitLab