diff --git a/Framework/API/src/ADSValidator.cpp b/Framework/API/src/ADSValidator.cpp index f65fa6980997e00d5629aaed92cadaea44bdbe8a..5442a9afa8e99f2029c03fcc9af3e23c28371a45 100644 --- a/Framework/API/src/ADSValidator.cpp +++ b/Framework/API/src/ADSValidator.cpp @@ -40,7 +40,7 @@ void ADSValidator::setOptional(const bool setOptional) { */ std::string ADSValidator::checkValidity(const std::vector<std::string> &value) const { - if (!m_isOptional && (value.size() == 0)) + if (!m_isOptional && value.empty()) return "Select a value"; if (!m_AllowMultiSelection && (value.size() > 1)) { return "Only one workspace was expected."; diff --git a/Framework/API/src/DataProcessorAlgorithm.cpp b/Framework/API/src/DataProcessorAlgorithm.cpp index 67389704fb71804c8784f36883a7c8c13de1008b..1e61e78ce112c5048be2eba7f2840447fa7e7f85 100644 --- a/Framework/API/src/DataProcessorAlgorithm.cpp +++ b/Framework/API/src/DataProcessorAlgorithm.cpp @@ -274,7 +274,7 @@ void DataProcessorAlgorithm::saveNexus(const std::string &outputWSName, saveOutput = false; #endif - if (saveOutput && outputFile.size() > 0) { + if (saveOutput && !outputFile.empty()) { IAlgorithm_sptr saveAlg = createChildAlgorithm("SaveNexus"); saveAlg->setPropertyValue("Filename", outputFile); saveAlg->setPropertyValue("InputWorkspace", outputWSName); diff --git a/Framework/API/src/MultiPeriodGroupWorker.cpp b/Framework/API/src/MultiPeriodGroupWorker.cpp index 0ddef61b1b7b8e933a4fe6064aa1bb216441fdf1..0063cd4002db9fed50983ec6bd13ea6917eecc03 100644 --- a/Framework/API/src/MultiPeriodGroupWorker.cpp +++ b/Framework/API/src/MultiPeriodGroupWorker.cpp @@ -96,8 +96,8 @@ MultiPeriodGroupWorker::findMultiPeriodGroups( } } - if ((vecMultiPeriodWorkspaceGroups.size() != 0) && - (vecWorkspaceGroups.size() != 0)) { + if (!vecMultiPeriodWorkspaceGroups.empty() && + !vecWorkspaceGroups.empty()) { throw std::invalid_argument( "The input contains a mix of multi-period and other workspaces."); } diff --git a/Framework/Algorithms/inc/MantidAlgorithms/BoostOptionalToAlgorithmProperty.h b/Framework/Algorithms/inc/MantidAlgorithms/BoostOptionalToAlgorithmProperty.h index 57466da0d2680fa2b3dfcf535d52276d142fe0e3..a4dc11db02f55d3692f4647b4b0a3d4e18284ae1 100644 --- a/Framework/Algorithms/inc/MantidAlgorithms/BoostOptionalToAlgorithmProperty.h +++ b/Framework/Algorithms/inc/MantidAlgorithms/BoostOptionalToAlgorithmProperty.h @@ -58,7 +58,7 @@ T checkForMandatoryInstrumentDefault( auto algProperty = alg->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getNumberParameter(idf_name); - if (defaults.size() == 0) { + if (defaults.empty()) { throw std::runtime_error("No data could be retrieved from the parameters " "and argument wasn't provided: " + propName); @@ -90,7 +90,7 @@ boost::optional<T> checkForOptionalInstrumentDefault( auto algProperty = alg->getPointerToProperty(propName); if (algProperty->isDefault()) { auto defaults = instrument->getNumberParameter(idf_name); - if (defaults.size() != 0) { + if (!defaults.empty()) { return boost::optional<T>(static_cast<T>(defaults[0])); } else { return boost::optional<T>(); diff --git a/Framework/Algorithms/src/AppendSpectra.cpp b/Framework/Algorithms/src/AppendSpectra.cpp index 1f67a73f282e9f37642c87b32cfc15f1b0572428..de4e838b51f467d09ef7b8659a4ed3ac3744e92a 100644 --- a/Framework/Algorithms/src/AppendSpectra.cpp +++ b/Framework/Algorithms/src/AppendSpectra.cpp @@ -148,7 +148,7 @@ void AppendSpectra::fixSpectrumNumbers(API::MatrixWorkspace_const_sptr ws1, // check if we're outside the spectra of the first workspace const std::string inputLabel = i < ws1len ? yAxisWS1->label(i) : yAxisWS2->label(i - ws1len); - outputTextAxis->setLabel(i, (inputLabel.size() > 0) ? inputLabel : ""); + outputTextAxis->setLabel(i, !inputLabel.empty() ? inputLabel : ""); } else if (isNumericAxis) { // check if we're outside the spectra of the first workspace diff --git a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp index 94a3f3b9663747446eede1a87d3d383784415d5f..7398d113b689e7b72f0b354e3b6480d2dc476ac6 100644 --- a/Framework/Algorithms/src/CreateLogTimeCorrection.cpp +++ b/Framework/Algorithms/src/CreateLogTimeCorrection.cpp @@ -69,7 +69,7 @@ void CreateLogTimeCorrection::exec() { string filename = getProperty("OutputFilename"); g_log.information() << "Output file name is " << filename << ".\n"; - if (filename.size() > 0) { + if (!filename.empty()) { writeCorrectionToFile(filename); } } diff --git a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp index 1c9d598fdcf5795192ccf8a03df5eeb2a253a08a..d8a9c964f6eec5a7dbddc0f8099bfd5367fc89df 100644 --- a/Framework/Algorithms/src/ExportTimeSeriesLog.cpp +++ b/Framework/Algorithms/src/ExportTimeSeriesLog.cpp @@ -123,7 +123,7 @@ void ExportTimeSeriesLog::exportLog(const std::string &logname, std::vector<Kernel::DateAndTime> times; std::vector<double> values; - if (logname.size() > 0) { + if (!logname.empty()) { // Log Kernel::TimeSeriesProperty<double> *tlog = dynamic_cast<Kernel::TimeSeriesProperty<double> *>( diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index ac3609283e093bef1ca01872d5350deab0ea66ef..b3f7e57ff38d746831bad33db3078b1c328bb6af 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -305,7 +305,7 @@ void FilterEvents::processAlgorithmProperties() { if (m_isSplittersRelativeTime) { // Using relative time std::string start_time_str = getProperty("FilterStartTime"); - if (start_time_str.size() > 0) { + if (!start_time_str.empty()) { // User specifies the filter starting time Kernel::DateAndTime temp_shift_time(start_time_str); m_filterStartTime = temp_shift_time; diff --git a/Framework/Algorithms/src/FindPeaks.cpp b/Framework/Algorithms/src/FindPeaks.cpp index e2e5d619df2a6118204f62bf8233b1e3fd92c932..1970805ca417c667bb99ec394bc53aafd6cc723d 100644 --- a/Framework/Algorithms/src/FindPeaks.cpp +++ b/Framework/Algorithms/src/FindPeaks.cpp @@ -983,7 +983,7 @@ void FindPeaks::fitSinglePeak(const API::MatrixWorkspace_sptr &input, std::string errmsg = estimatePeakParameters( vecX, vecY, i_min, i_max, vecbkgdparvalue, i_obscentre, est_height, est_fwhm, est_leftfwhm, est_rightfwhm); - if (errmsg.size() > 0) { + if (!errmsg.empty()) { // Unable to estimate peak i_obscentre = i_centre; est_fwhm = 1.; diff --git a/Framework/Algorithms/src/FitPeak.cpp b/Framework/Algorithms/src/FitPeak.cpp index f28a19783e16ea36e092fd53c7e50532bfc72472..cf3e596986d436d0cfe29dc55189f75c9a4d7ab6 100644 --- a/Framework/Algorithms/src/FitPeak.cpp +++ b/Framework/Algorithms/src/FitPeak.cpp @@ -264,7 +264,7 @@ bool FitOneSinglePeak::hasSetupToFitPeak(std::string &errmsg) { if (!m_dataWS) errmsg += "Data workspace "; - if (errmsg.size() > 0) { + if (!errmsg.empty()) { errmsg = "These parameters have not been set for fitting peak: " + errmsg; return false; } @@ -835,7 +835,7 @@ double FitOneSinglePeak::fitCompositeFunction( // Check fit result goodness = checkFittedPeak(peakfunc, goodness, errorreason); - if (errorreason.size() > 0) + if (!errorreason.empty()) m_sstream << "Error reason of fit peak+background composite: " << errorreason << "\n"; diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index fa2ec6a0e2cf0c4df440ec7aebff5e3bc67a3902..34eb203fba83d0de4d893b626884d338575f304b 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -216,7 +216,7 @@ void GenerateEventsFilter::processInOutWorkspaces() { // Output splitter information workspace std::string title = getProperty("TitleOfSplitters"); - if (title.size() == 0) { + if (title.empty()) { // Using default title = "Splitters"; } @@ -263,8 +263,8 @@ void GenerateEventsFilter::processInputTime() { std::string s_inptf = this->getProperty("StopTime"); // Default - bool defaultstart = (s_inpt0.size() == 0); - bool defaultstop = (s_inptf.size() == 0); + bool defaultstart = s_inpt0.empty(); + bool defaultstop = s_inptf.empty(); // Determine format bool instringformat = true; @@ -1674,7 +1674,7 @@ void GenerateEventsFilter::addNewTimeFilterSplitter( } // Information - if (info.size() > 0) { + if (!info.empty()) { API::TableRow row = m_filterInfoWS->appendRow(); row << wsindex << info; } diff --git a/Framework/Algorithms/src/GeneratePeaks.cpp b/Framework/Algorithms/src/GeneratePeaks.cpp index 7219781816ae7e087433a1a6036a311f16bd2352..e469338033b15314d3e1c65becbd9578ebef55ca 100644 --- a/Framework/Algorithms/src/GeneratePeaks.cpp +++ b/Framework/Algorithms/src/GeneratePeaks.cpp @@ -168,7 +168,7 @@ void GeneratePeaks::processAlgProperties(std::string &peakfunctype, std::string &bkgdfunctype) { // Function parameters std::string paramwsname = getPropertyValue("PeakParametersWorkspace"); - if (paramwsname.size() > 0) { + if (!paramwsname.empty()) { // Using parameter table workspace has a higher priority m_useFuncParamWS = true; m_funcParamWS = getProperty("PeakParametersWorkspace"); diff --git a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp index 9f4f0beb3356eaf24905c8d998f1e7bad3a5e277..24cf564fcb51efa91cbdf203a798b2e049a61936 100644 --- a/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp +++ b/Framework/Algorithms/src/GetDetOffsetsMultiPeaks.cpp @@ -303,7 +303,7 @@ void GetDetOffsetsMultiPeaks::processProperties() { // Fit windows std::string fitwinwsname = getPropertyValue("FitwindowTableWorkspace"); g_log.notice() << "FitWindowTableWorkspace name: " << fitwinwsname << "\n"; - if (fitwinwsname.size() > 0) { + if (!fitwinwsname.empty()) { // Use fit window workspace for each spectrum TableWorkspace_sptr fitwintablews = getProperty("FitwindowTableWorkspace"); importFitWindowTableWorkspace(fitwintablews); @@ -360,7 +360,7 @@ void GetDetOffsetsMultiPeaks::processProperties() { // Input resolution std::string reswsname = getPropertyValue("InputResolutionWorkspace"); - if (reswsname.size() == 0) + if (reswsname.empty()) m_hasInputResolution = false; else { m_inputResolutionWS = getProperty("InputResolutionWorkspace"); diff --git a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp index 504118a4a6b388ddc7dda0c025ca0e3e979d4cb8..e435683928198c3309f33f187686672ed2d50e1f 100644 --- a/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp +++ b/Framework/Algorithms/src/GetTimeSeriesLogInformation.cpp @@ -84,7 +84,7 @@ void GetTimeSeriesLogInformation::exec() { } string logname = getProperty("LogName"); - if (logname.size() == 0) + if (logname.empty()) throw runtime_error("Input log value cannot be an empty string. "); Kernel::Property *log = m_dataWS->run().getProperty(logname); diff --git a/Framework/Algorithms/src/PDCalibration.cpp b/Framework/Algorithms/src/PDCalibration.cpp index add9a37abc27229595f6933dcc463847bdd50b6a..22c16709e077d05d02039bc6c638d025c3af4a48 100644 --- a/Framework/Algorithms/src/PDCalibration.cpp +++ b/Framework/Algorithms/src/PDCalibration.cpp @@ -397,7 +397,7 @@ void PDCalibration::exec() { tof_vec.push_back(centre); } - if (d_vec.size() == 0) { + if (d_vec.empty()) { maskWS->setMaskedIndex(wkspIndex, true); continue; } else { diff --git a/Framework/Algorithms/src/Q1DWeighted.cpp b/Framework/Algorithms/src/Q1DWeighted.cpp index 64ec41eb576146da09c1a191fc05e2620e444c24..36fc5177d2c2f4530407f4927210575af9e9b409 100644 --- a/Framework/Algorithms/src/Q1DWeighted.cpp +++ b/Framework/Algorithms/src/Q1DWeighted.cpp @@ -335,7 +335,7 @@ void Q1DWeighted::exec() { } // set the output property std::string outputWSGroupName = getPropertyValue("WedgeWorkspace"); - if (outputWSGroupName.size() == 0) { + if (outputWSGroupName.empty()) { std::string outputWSName = getPropertyValue("OutputWorkspace"); outputWSGroupName = outputWSName + "_wedges"; setPropertyValue("WedgeWorkspace", outputWSGroupName); diff --git a/Framework/Algorithms/src/RemoveLowResTOF.cpp b/Framework/Algorithms/src/RemoveLowResTOF.cpp index 7c61455f5d634bbe91040deac14537de74b090f6..38766a9291431b3b2da65a61afde21efdaacff03 100644 --- a/Framework/Algorithms/src/RemoveLowResTOF.cpp +++ b/Framework/Algorithms/src/RemoveLowResTOF.cpp @@ -116,7 +116,7 @@ void RemoveLowResTOF::exec() { m_numberOfSpectra = m_inputWS->getNumberHistograms(); std::string lowreswsname = getPropertyValue("LowResTOFWorkspace"); - if (lowreswsname.size() > 0) + if (!lowreswsname.empty()) m_outputLowResTOF = true; else m_outputLowResTOF = false; diff --git a/Framework/Algorithms/src/RenameWorkspace.cpp b/Framework/Algorithms/src/RenameWorkspace.cpp index 67811ec24ec684e1d96261f2ccce642114e7a34d..5659b7e1e4f2cdba9228966ea89f0a51c131f877 100644 --- a/Framework/Algorithms/src/RenameWorkspace.cpp +++ b/Framework/Algorithms/src/RenameWorkspace.cpp @@ -112,7 +112,7 @@ void RenameWorkspace::exec() { if (monWS) { std::string monWSName = monWS->getName(); // rename the monitor workspace accordingly - if (monWSName.size() == 0) { + if (monWSName.empty()) { // workspace will always have name after added to ADS, so apparently not // the case AnalysisDataService::Instance().add(outputwsName + "_monitors", monWS); diff --git a/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h b/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h index c9d3a65b398adba66ce701aeee1d0b959a9bd52d..7f3ab7aeb958a6066c0ce66c776c767cee30f7b1 100644 --- a/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h +++ b/Framework/Crystal/inc/MantidCrystal/PeakHKLErrors.h @@ -124,7 +124,7 @@ public: if (attName == "OptRuns") { OptRuns = value.asString(); - if (OptRuns.size() < 1) + if (OptRuns.empty()) return; if (OptRuns.at(0) != '/') diff --git a/Framework/Crystal/src/LoadIsawPeaks.cpp b/Framework/Crystal/src/LoadIsawPeaks.cpp index 1b7f9d1021a785e8fe4d4fd6194113af7bbe97f3..c4bcc91c84823ea77a35350aad3440b221abf5b4 100644 --- a/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -115,7 +115,7 @@ std::string LoadIsawPeaks::ApplyCalibInfo(std::ifstream &in, ParameterMap_sptr parMap = instr->getParameterMap(); - while (in.good() && (startChar.size() < 1 || startChar != "7")) { + while (in.good() && (startChar.empty() || startChar != "7")) { readToEndOfLine(in, true); startChar = getWord(in, false); } @@ -144,7 +144,7 @@ std::string LoadIsawPeaks::ApplyCalibInfo(std::ifstream &in, readToEndOfLine(in, true); startChar = getWord(in, false); - while (in.good() && (startChar.size() < 1 || startChar != "5")) { + while (in.good() && (startChar.empty() || startChar != "5")) { readToEndOfLine(in, true); startChar = getWord(in, false); } @@ -159,7 +159,7 @@ std::string LoadIsawPeaks::ApplyCalibInfo(std::ifstream &in, std::string line; for (int i = 0; i < 16; i++) { std::string s = getWord(in, false); - if (s.size() < 1) { + if (s.empty()) { g_log.error() << "Not enough info to describe panel \n"; throw std::length_error("Not enough info to describe panel "); } diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp index 3a89da6152065ef8641b089e4c840c0e4e47b1e3..3654f822ad27f0302641f46325f950b519344413 100644 --- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp +++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp @@ -256,7 +256,7 @@ void OptimizeCrystalPlacement::exec() { message += "will be 'changed'"; g_log.notice(message); } - if (OptRunNums.size() > 0 && !omitRuns) + if (!OptRunNums.empty() && !omitRuns) FuncArg += ",OptRuns=" + OptRunNums; //------------- Add initial parameter values to FuncArg ----------- diff --git a/Framework/Crystal/src/PeakHKLErrors.cpp b/Framework/Crystal/src/PeakHKLErrors.cpp index eb8f22274e23c2fe64209795ab9a30501e922ea3..73524bfd5b6f026f1bb4dee5b51a47fcdc5888a3 100644 --- a/Framework/Crystal/src/PeakHKLErrors.cpp +++ b/Framework/Crystal/src/PeakHKLErrors.cpp @@ -65,10 +65,10 @@ void PeakHKLErrors::setUpOptRuns() { std::vector<std::string> OptRunNums; std::string OptRunstemp(OptRuns); - if (OptRuns.size() > 0 && OptRuns.at(0) == '/') + if (!OptRuns.empty() && OptRuns.at(0) == '/') OptRunstemp = OptRunstemp.substr(1, OptRunstemp.size() - 1); - if (OptRunstemp.size() > 0 && OptRunstemp.at(OptRunstemp.size() - 1) == '/') + if (!OptRunstemp.empty() && OptRunstemp.at(OptRunstemp.size() - 1) == '/') OptRunstemp = OptRunstemp.substr(0, OptRunstemp.size() - 1); boost::split(OptRunNums, OptRunstemp, boost::is_any_of("/")); diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index 8c40aa0a26096fff3518ee2164c1abb74800176e..bf9914cf6e1940bcc70df53dff1ce766d4cc3afe 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -1182,7 +1182,7 @@ void LeBailFit::parseBackgroundTableWorkspace(TableWorkspace_sptr bkgdparamws, // Remove extra white spaces boost::algorithm::trim(parname); - if (parname.size() > 0 && (parname[0] == 'A' || parname == "Bkpos")) { + if (!parname.empty() && (parname[0] == 'A' || parname == "Bkpos")) { // Insert parameter name starting with A or Bkpos (special case for // FullprofPolynomial) parmap.emplace(parname, parvalue); diff --git a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp index 4eb75a48b86ee98e36df10758e40a1cb89fbb2e6..0852d0eb29bdf79c82c97a3102fdde25fc36c410 100644 --- a/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp +++ b/Framework/CurveFitting/src/Algorithms/PlotPeakByLogValue.cpp @@ -545,7 +545,7 @@ PlotPeakByLogValue::makeNames() const { } else if (index.size() > 1 && index[0] == 'i') { // workspace index wi = boost::lexical_cast<int>(index.substr(1)); spec = -1; // undefined yet - } else if (index.size() > 0 && index[0] == 'v') { + } else if (!index.empty() && index[0] == 'v') { if (index.size() > 1) { // there is some text after 'v' tokenizer range(index.substr(1), ":", tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM); diff --git a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp index 811d5de0934e850f7656026da8f44d59282802b9..69288d58376741000e9fdb7ffa317385244dc6bb 100644 --- a/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp +++ b/Framework/CurveFitting/src/Algorithms/RefinePowderInstrumentParameters3.cpp @@ -276,7 +276,7 @@ void RefinePowderInstrumentParameters3::parseTableWorkspace( // If empty string, fit is default to be false bool fit = false; - if (fitq.size() > 0) { + if (!fitq.empty()) { if (fitq[0] == 'F' || fitq[0] == 'f') fit = true; } diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index 26f472a8e3a05dd35019170c62ef278d2b4bcb13..08545d6b91e0bf885ba1dd4cba5f4cd33ab7a69e 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -456,8 +456,7 @@ void ProcessBackground::selectBkgdPoints() { // explicitly string outbkgdparwsname = getPropertyValue("OutputBackgroundParameterWorkspace"); - if (outbkgdparwsname.size() > 0 && - outbkgdparwsname.compare("_dummy02") != 0) { + if (!outbkgdparwsname.empty() && outbkgdparwsname.compare("_dummy02") != 0) { // Will fit the selected background string bkgdfunctype = getPropertyValue("OutputBackgroundType"); fitBackgroundFunction(bkgdfunctype); @@ -692,7 +691,7 @@ ProcessBackground::filterForBackground(BackgroundFunction_sptr bkgdfunction) { // Optional output string userbkgdwsname = getPropertyValue("UserBackgroundWorkspace"); - if (userbkgdwsname.size() == 0) + if (userbkgdwsname.empty()) throw runtime_error("In mode SelectBackgroundPoints, " "UserBackgroundWorkspace must be given!"); diff --git a/Framework/DataHandling/src/ImggAggregateWavelengths.cpp b/Framework/DataHandling/src/ImggAggregateWavelengths.cpp index 797635f18381285d2b415070fbc3fd1c74dbe8ec..3d85d49a9507ade101a4295f1397d84201313ef4 100644 --- a/Framework/DataHandling/src/ImggAggregateWavelengths.cpp +++ b/Framework/DataHandling/src/ImggAggregateWavelengths.cpp @@ -692,7 +692,7 @@ ImggAggregateWavelengths::buildOutputSubdirNamesFromUniformBands( std::vector<std::string> outputSubdirs; // get number of available images from first effective subdirectory std::vector<Poco::Path> images; - for (size_t idx = 0; idx < inputSubDirs.size() && 0 == images.size(); ++idx) { + for (size_t idx = 0; idx < inputSubDirs.size() && images.empty(); ++idx) { images = findInputImages(inputSubDirs[idx]); } auto outRanges = splitSizeIntoRanges(images.size(), bands); diff --git a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp index 7abb622b8349d2a4cdcdfcb64cded3bd28bd75c6..e7805f49f3f681fea60acf2855ce21d49d6f9f7b 100644 --- a/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp +++ b/Framework/DataHandling/src/LoadDetectorsGroupingFile.cpp @@ -511,9 +511,9 @@ void LoadGroupXMLFile::parseXML() { std::string val_value = this->getAttributeValueByName(pNode, "val", valfound); std::string finalvalue; - if (valfound && value.size() > 0) + if (valfound && !value.empty()) finalvalue = value + ", " + val_value; - else if (value.size() == 0) + else if (value.empty()) finalvalue = val_value; else finalvalue = value; @@ -534,9 +534,9 @@ void LoadGroupXMLFile::parseXML() { std::string val_value = this->getAttributeValueByName(pNode, "val", valfound); std::string finalvalue; - if (valfound && value.size() > 0) + if (valfound && !value.empty()) finalvalue = value + ", " + val_value; - else if (value.size() == 0) + else if (value.empty()) finalvalue = val_value; else finalvalue = value; @@ -559,9 +559,9 @@ void LoadGroupXMLFile::parseXML() { std::string val_value = this->getAttributeValueByName(pNode, "val", valfound); std::string finalvalue; - if (valfound && value.size() > 0) + if (valfound && !value.empty()) finalvalue = value + ", " + val_value; - else if (value.size() == 0) + else if (value.empty()) finalvalue = val_value; else finalvalue = value; diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index fc4e2dd7ebc05cd5ea2759b4dbdc4a5143e6bf4c..1be3de61847257593af8a83867a5ed15e69052ac 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -865,7 +865,7 @@ void LoadEventNexus::init() { */ void LoadEventNexus::setTopEntryName() { std::string nxentryProperty = getProperty("NXentryName"); - if (nxentryProperty.size() > 0) { + if (!nxentryProperty.empty()) { m_top_entry_name = nxentryProperty; return; } diff --git a/Framework/DataHandling/src/LoadFullprofResolution.cpp b/Framework/DataHandling/src/LoadFullprofResolution.cpp index 6f566578d206431578a8e7e5c66c74cee281bf13..e2e3e810de2117f6d97e7ce20333189a4ff0edb5 100644 --- a/Framework/DataHandling/src/LoadFullprofResolution.cpp +++ b/Framework/DataHandling/src/LoadFullprofResolution.cpp @@ -254,7 +254,7 @@ void LoadFullprofResolution::loadFile(string filename, vector<string> &lines) { // display the line we gathered: boost::algorithm::trim(line); - if (line.size() > 0) + if (!line.empty()) lines.push_back(line); } @@ -653,7 +653,7 @@ void LoadFullprofResolution::parseBankLine(string line, double &cwl, << "'" << v[i] << "'\n"; string candidate = v[i]; boost::algorithm::trim(candidate); - if (candidate.size() > 0) { + if (!candidate.empty()) { cwl = atof(candidate.c_str()); break; } diff --git a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp index a17dee4002f9ff28921d619a67a3912403854261..239ea187ff49047152f221f36e53d16d585be4f9 100644 --- a/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/LoadGSASInstrumentFile.cpp @@ -226,7 +226,7 @@ void LoadGSASInstrumentFile::loadFile(string filename, vector<string> &lines) { // display the line we gathered: boost::algorithm::trim(line); - if (line.size() > 0) + if (!line.empty()) lines.push_back(line); } diff --git a/Framework/DataHandling/src/LoadLog.cpp b/Framework/DataHandling/src/LoadLog.cpp index 62a2025aa429f27917d783c779a82b9eb0f478be..96e1840d73f7309fd9c3e15b01b8495660373a34 100644 --- a/Framework/DataHandling/src/LoadLog.cpp +++ b/Framework/DataHandling/src/LoadLog.cpp @@ -357,7 +357,7 @@ bool LoadLog::LoadSNSText() { // Go back to start inLogFile.seekg(0); while (Mantid::Kernel::Strings::extractToEOL(inLogFile, aLine)) { - if (aLine.size() == 0) + if (aLine.empty()) break; if (SNSTextFormatColumns(aLine, cols)) { diff --git a/Framework/DataHandling/src/LoadMask.cpp b/Framework/DataHandling/src/LoadMask.cpp index 36f8d26745769b678c90e77f34c21fd8803becdc..8710f55f6a3dfdad3249ea64ecdcc4449e1494ad 100644 --- a/Framework/DataHandling/src/LoadMask.cpp +++ b/Framework/DataHandling/src/LoadMask.cpp @@ -164,7 +164,7 @@ void parseISISStringToVector(const std::string &ins, temps.insert(temps.begin() + 1, "-"); splitstrings.erase(splitstrings.begin() + index); for (size_t ic = 0; ic < 3; ic++) { - if (temps[ic].size() > 0) { + if (!temps[ic].empty()) { splitstrings.insert(splitstrings.begin() + index, temps[ic]); index++; } diff --git a/Framework/DataHandling/src/LoadSpiceAscii.cpp b/Framework/DataHandling/src/LoadSpiceAscii.cpp index b627d8292452dab5ba1850ef6cd955ed9f5ac40e..d0124230bb1eca10da4c2b6cd6f8ebd94d7b4eaa 100644 --- a/Framework/DataHandling/src/LoadSpiceAscii.cpp +++ b/Framework/DataHandling/src/LoadSpiceAscii.cpp @@ -236,7 +236,7 @@ void LoadSpiceAscii::parseSPICEAscii( // Strip boost::trim(line); // skip for empyt line - if (line.size() == 0) + if (line.empty()) continue; // Comment line for run information diff --git a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp index 67dec0804108200b2f81732527c4fda3a2a470a7..3602878d1211f4b597fa2cf5f6c8ce0e6b1426bc 100644 --- a/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp +++ b/Framework/DataHandling/src/LoadSpiceXML2DDet.cpp @@ -68,24 +68,24 @@ void SpiceXMLNode::setParameters(const std::string &nodetype, } // unit - if (nodeunit.size() > 0) { + if (!nodeunit.empty()) { m_unit = nodeunit; } // description - if (nodedescription.size() > 0) + if (!nodedescription.empty()) m_description = nodedescription; } /** Check whether XML has unit set */ -bool SpiceXMLNode::hasUnit() const { return (m_unit.size() > 0); } +bool SpiceXMLNode::hasUnit() const { return (!m_unit.empty()); } /** Check whether XML node has value set * @brief SpiceXMLNode::hasValue * @return */ -bool SpiceXMLNode::hasValue() const { return (m_value.size() > 0); } +bool SpiceXMLNode::hasValue() const { return (!m_value.empty()); } /** Is this node of string type? * @brief SpiceXMLNode::isString @@ -232,7 +232,7 @@ void LoadSpiceXML2DDet::processInputs() { // Retreive sample environment data from SPICE scan table workspace std::string spicetablewsname = getPropertyValue("SpiceTableWorkspace"); - if (spicetablewsname.size() > 0) + if (!spicetablewsname.empty()) m_hasScanTable = true; else m_hasScanTable = false; @@ -470,7 +470,7 @@ MatrixWorkspace_sptr LoadSpiceXML2DDet::createMatrixWorkspace( std::string &line = vecLines[i]; // Skip empty line - if (line.size() == 0) { + if (line.empty()) { g_log.debug() << "\tFound empty Line at " << i << "\n"; continue; } @@ -709,7 +709,7 @@ void LoadSpiceXML2DDet::loadInstrument(API::MatrixWorkspace_sptr matrixws, API::IAlgorithm_sptr loadinst = createChildAlgorithm("LoadInstrument"); loadinst->initialize(); loadinst->setProperty("Workspace", matrixws); - if (idffilename.size() > 0) { + if (!idffilename.empty()) { loadinst->setProperty("Filename", idffilename); } else loadinst->setProperty("InstrumentName", "HB3A"); diff --git a/Framework/DataHandling/src/LoadVulcanCalFile.cpp b/Framework/DataHandling/src/LoadVulcanCalFile.cpp index 7a66d7defd77d85ade19b6b82c064026dc9bdee3..edabe071e7b9df51bf673207937ccc7c2bdb4446 100644 --- a/Framework/DataHandling/src/LoadVulcanCalFile.cpp +++ b/Framework/DataHandling/src/LoadVulcanCalFile.cpp @@ -255,7 +255,7 @@ void LoadVulcanCalFile::setupGroupingWorkspace() { void LoadVulcanCalFile::setupMaskWorkspace() { // Skip if bad pixel file is not given - if (m_badPixFilename.size() == 0) + if (m_badPixFilename.empty()) return; // Open file diff --git a/Framework/DataHandling/src/MergeLogs.cpp b/Framework/DataHandling/src/MergeLogs.cpp index 6ec1beea82d23f2b02327fe10d09271554079ef4..b371ac206b0b5f977f42ab066075d46e7bf69bf0 100644 --- a/Framework/DataHandling/src/MergeLogs.cpp +++ b/Framework/DataHandling/src/MergeLogs.cpp @@ -39,7 +39,7 @@ void Merge2WorkspaceLogs::exec() { double logvalue2 = this->getProperty("LogValue2"); // 2. Check - if (logname1.size() == 0 || logname2.size() == 0 || mlogname.size() == 0) { + if (logname1.empty() || logname2.empty() || mlogname.empty()) { g_log.error() << "One or more than one log name is not given!\n"; throw std::invalid_argument("One or more than one log name is not give"); } diff --git a/Framework/DataHandling/src/PatchBBY.cpp b/Framework/DataHandling/src/PatchBBY.cpp index 8f3887424421e9e0439ab89077cb6fc8bb5da805..5f177a346cec5cb4c761b7b18f7a3da3836786c1 100644 --- a/Framework/DataHandling/src/PatchBBY.cpp +++ b/Framework/DataHandling/src/PatchBBY.cpp @@ -301,7 +301,7 @@ void PatchBBY::exec() { } std::string logContentNew = logContentNewBuffer.str(); - if (logContentNew.size() == 0) + if (logContentNew.empty()) throw std::invalid_argument("nothing to patch"); // merge log content diff --git a/Framework/DataHandling/src/SaveAscii2.cpp b/Framework/DataHandling/src/SaveAscii2.cpp index bd5d594f1bcb694298de522a5b93a8a4fccfd0c6..d2f0a5b002e7ea4566c2cb4a558da46dd021015f 100644 --- a/Framework/DataHandling/src/SaveAscii2.cpp +++ b/Framework/DataHandling/src/SaveAscii2.cpp @@ -129,7 +129,7 @@ void SaveAscii2::exec() { m_isCommonBins = m_ws->isCommonBins(); // checking for ragged workspace m_writeID = getProperty("WriteSpectrumID"); std::string metaDataString = getPropertyValue("SpectrumMetaData"); - if (metaDataString.size() != 0) { + if (!metaDataString.empty()) { m_metaData = stringListToVector(metaDataString); auto containsSpectrumNumber = findElementInUnorderedStringVector(m_metaData, "spectrumnumber"); @@ -256,7 +256,7 @@ void SaveAscii2::exec() { file << '\n'; } // populate the meta data map - if (m_metaData.size() > 0) { + if (!m_metaData.empty()) { populateAllMetaData(); } if (idx.empty()) { diff --git a/Framework/DataHandling/src/SaveFullprofResolution.cpp b/Framework/DataHandling/src/SaveFullprofResolution.cpp index cd37fcf95a5058d4bc5edfdf30c64535710d0888..0e508d349dcd80f9910cd4bd3486162629a7ee36 100644 --- a/Framework/DataHandling/src/SaveFullprofResolution.cpp +++ b/Framework/DataHandling/src/SaveFullprofResolution.cpp @@ -118,7 +118,7 @@ void SaveFullprofResolution::processProperties() { // Output file and operation m_outIrfFilename = getPropertyValue("OutputFilename"); - if (m_outIrfFilename.size() == 0) + if (m_outIrfFilename.empty()) throw runtime_error("Input file name invalid. "); m_append = getProperty("Append"); if (m_append) { diff --git a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp index d6ad78cf3ffa0eb46572c6229274ef34706b5bd0..8c98bf1e5ee7453d4890e8c9bee6ab544966af5a 100644 --- a/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp +++ b/Framework/DataHandling/src/SaveGSASInstrumentFile.cpp @@ -234,7 +234,7 @@ ChopperConfiguration::parseStringDbl(const string &instring) const { vector<double> vecdouble; for (auto &str : strs) { - if (str.size() > 0) { + if (!str.empty()) { double item = atof(str.c_str()); vecdouble.push_back(item); // cout << "[C] |" << strs[i] << "|" << item << "\n"; @@ -257,7 +257,7 @@ ChopperConfiguration::parseStringUnsignedInt(const string &instring) const { vector<unsigned int> vecinteger; for (auto &str : strs) { - if (str.size() > 0) { + if (!str.empty()) { int item = atoi(str.c_str()); if (item < 0) { throw runtime_error( diff --git a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc index 9e669e616e950e3bffad859a32d1c88f617ca7bc..4db8da03a56159193e041a491bd12370ffa2724b 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc +++ b/Framework/DataObjects/inc/MantidDataObjects/MDEventWorkspace.tcc @@ -921,7 +921,7 @@ TMDE(API::IMDWorkspace::LinePlot MDEventWorkspace) } // If everything was masked - if (line.x.size() == 0) { + if (line.x.empty()) { makeSinglePointWithNaN(line.x, line.y, line.e); } return line; diff --git a/Framework/DataObjects/src/MDHistoWorkspace.cpp b/Framework/DataObjects/src/MDHistoWorkspace.cpp index f950aa27beffee21ec1550517f91bdc4093b2f29..0b2c563a92242ce5dc0818927df67bcfac233a72 100644 --- a/Framework/DataObjects/src/MDHistoWorkspace.cpp +++ b/Framework/DataObjects/src/MDHistoWorkspace.cpp @@ -632,7 +632,7 @@ IMDWorkspace::LinePlot MDHistoWorkspace::getLinePoints( } // for each unique boundary // If all bins were masked - if (line.x.size() == 0) { + if (line.x.empty()) { this->makeSinglePointWithNaN(line.x, line.y, line.e); } } diff --git a/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp b/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp index aba6ceafb47dacbb3e2b738b03b7f7b71b01bf80..2a70dcc0792d92875125aa0f8e5de7f5fe04e598 100644 --- a/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp +++ b/Framework/Geometry/src/Crystal/SymmetryOperationSymbolParser.cpp @@ -98,7 +98,7 @@ std::string SymmetryOperationSymbolParser::getNormalizedIdentifier( if (matrix[r][c] < 0) { currentComponent << "-"; } else { - if (currentComponent.str().size() > 0) { + if (!currentComponent.str().empty()) { currentComponent << "+"; } } diff --git a/Framework/Geometry/src/Math/Acomp.cpp b/Framework/Geometry/src/Math/Acomp.cpp index aced68e7e39bf3bb7cb8ee1eeac980bd8564b3e5..1661ec2ac9644181684e299378d9e1e4de3116e1 100644 --- a/Framework/Geometry/src/Math/Acomp.cpp +++ b/Framework/Geometry/src/Math/Acomp.cpp @@ -459,7 +459,7 @@ Units are sorted after this function is returned. Express += iu; } } - if (Express.size() > 0) { + if (!Express.empty()) { Acomp AX; try { AX.setString(Express); diff --git a/Framework/Kernel/src/InstrumentInfo.cpp b/Framework/Kernel/src/InstrumentInfo.cpp index e4c30cefef1748e96f5a813328cc523257597769..5ddda927a7a31a8a57c39d19fbc616afcb3ba03e 100644 --- a/Framework/Kernel/src/InstrumentInfo.cpp +++ b/Framework/Kernel/src/InstrumentInfo.cpp @@ -174,7 +174,7 @@ InstrumentInfo::liveListenerInfo(std::string name) const { } bool InstrumentInfo::hasLiveListenerInfo() const { - return m_listeners.size() > 0; + return !m_listeners.empty(); } const std::vector<LiveListenerInfo> & diff --git a/Framework/Kernel/src/Material.cpp b/Framework/Kernel/src/Material.cpp index 622d0efa87f30690ead9203ba60095e59cf39a6f..30363639b86dd92f7e5d166aa6488e4fe5dacf8f 100644 --- a/Framework/Kernel/src/Material.cpp +++ b/Framework/Kernel/src/Material.cpp @@ -392,7 +392,7 @@ void Material::saveNexus(::NeXus::File *file, const std::string &group) const { // determine how the information will be stored std::string style = "formula"; // default is a chemical formula - if (m_chemicalFormula.size() == 0) { + if (m_chemicalFormula.empty()) { style = "empty"; } else if (m_chemicalFormula.size() == 1) { if (m_chemicalFormula[0].atom->symbol == "user") { diff --git a/Framework/Kernel/src/MultiFileNameParser.cpp b/Framework/Kernel/src/MultiFileNameParser.cpp index 2808204f2d7710674a35c1183d94e6856df0bb07..ee2697908883f01a640ce0939a9ef415f5761650 100644 --- a/Framework/Kernel/src/MultiFileNameParser.cpp +++ b/Framework/Kernel/src/MultiFileNameParser.cpp @@ -618,7 +618,7 @@ std::vector<std::vector<unsigned int>> generateRange(unsigned int from, */ void validateToken(const std::string &token) { // Each token must be non-empty. - if (token.size() == 0) + if (token.empty()) throw std::runtime_error("A comma-separated token is empty."); // Each token must begin and end with a numeric character. diff --git a/Framework/Kernel/src/RemoteJobManager.cpp b/Framework/Kernel/src/RemoteJobManager.cpp index 3f11a4bed3f9b67528401478255374a7478c5d76..df29071281e26c4cb02829c7441b8d88f92e41d0 100644 --- a/Framework/Kernel/src/RemoteJobManager.cpp +++ b/Framework/Kernel/src/RemoteJobManager.cpp @@ -225,7 +225,7 @@ void RemoteJobManager::initHTTPRequest(Poco::Net::HTTPRequest &req, path += extraPath; uri.setPath(path); - if (method == Poco::Net::HTTPRequest::HTTP_GET && queryString.size() > 0) { + if (method == Poco::Net::HTTPRequest::HTTP_GET && !queryString.empty()) { uri.setQuery(queryString); } diff --git a/Framework/LiveData/inc/MantidLiveData/SNSLiveEventDataListener.h b/Framework/LiveData/inc/MantidLiveData/SNSLiveEventDataListener.h index 82e025b3b54ae0f87acd56e9000e05fed252c51c..6396042255336735245f5b98118910180602c3d1 100644 --- a/Framework/LiveData/inc/MantidLiveData/SNSLiveEventDataListener.h +++ b/Framework/LiveData/inc/MantidLiveData/SNSLiveEventDataListener.h @@ -99,9 +99,9 @@ private: // complicated and I didn't want to be repeating the same tests in several // places... bool readyForInitPart2() { - if (m_instrumentXML.size() == 0) + if (m_instrumentXML.empty()) return false; - if (m_instrumentName.size() == 0) + if (m_instrumentName.empty()) return false; if (m_dataStartTime == Kernel::DateAndTime()) return false; diff --git a/Framework/LiveData/src/SNSLiveEventDataListener.cpp b/Framework/LiveData/src/SNSLiveEventDataListener.cpp index dcc75ff81ecb133857f0da9f4171a19b3f98cdee..839be0fbbae17c18d32ad53c9446abe6a2b6971c 100644 --- a/Framework/LiveData/src/SNSLiveEventDataListener.cpp +++ b/Framework/LiveData/src/SNSLiveEventDataListener.cpp @@ -1200,7 +1200,7 @@ bool SNSLiveEventDataListener::rxPacket(const ADARA::AnnotationPkt &pkt) { // if there's a comment in the packet, log it at the info level const std::string &comment = pkt.comment(); - if (comment.size() > 0) { + if (!comment.empty()) { g_log.information() << "Annotation: " << comment << '\n'; } diff --git a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp index 29299895cfadd7f8e28881b6b2a99f8e30b892b5..a1d9c67cac8b884bd4d9a3a9799cb49a35e55dc3 100644 --- a/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWSDExpToMomentum.cpp @@ -91,7 +91,7 @@ void ConvertCWSDExpToMomentum::exec() { // background std::string bkgdwsname = getPropertyValue("BackgroundWorkspace"); - if (bkgdwsname.size() > 0) { + if (!bkgdwsname.empty()) { m_removeBackground = true; m_backgroundWS = getProperty("BackgroundWorkspace"); // check background @@ -215,7 +215,7 @@ void ConvertCWSDExpToMomentum::addMDEvents(bool usevirtual) { // Check whether to add / or \ to m_dataDir std::string sep; - if (m_dataDir.size() > 0) { + if (!m_dataDir.empty()) { // Determine system #if _WIN64 const bool isWindows = true; @@ -542,7 +542,7 @@ bool ConvertCWSDExpToMomentum::getInputs(bool virtualinstrument, errmsg = errss.str(); - return (errmsg.size() == 0); + return (errmsg.empty()); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp index fb6aa7dc005b93cf7ed1d0fe65d7bc9275a67d94..8d3ad9c0fdb2c5fab94b19c6f5ecfceab3cac00c 100644 --- a/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp +++ b/Framework/MDAlgorithms/src/ConvertCWSDMDtoHKL.cpp @@ -106,7 +106,7 @@ void ConvertCWSDMDtoHKL::exec() { std::string qsamplefilename = getPropertyValue("QSampleFileName"); // Abort with an empty string - if (qsamplefilename.size() > 0) + if (!qsamplefilename.empty()) saveEventsToFile(qsamplefilename, vec_event_qsample, vec_event_signal, vec_event_det); @@ -117,7 +117,7 @@ void ConvertCWSDMDtoHKL::exec() { // Get file name std::string hklfilename = getPropertyValue("HKLFileName"); // Abort mission if no file name is given - if (hklfilename.size() > 0) + if (!hklfilename.empty()) saveEventsToFile(hklfilename, vec_event_hkl, vec_event_signal, vec_event_det); @@ -137,7 +137,7 @@ void ConvertCWSDMDtoHKL::exec() { void ConvertCWSDMDtoHKL::getUBMatrix() { std::string peakwsname = getPropertyValue("PeaksWorkspace"); - if (peakwsname.size() > 0 && + if (!peakwsname.empty() && AnalysisDataService::Instance().doesExist(peakwsname)) { // Get from peak works DataObjects::PeaksWorkspace_sptr peakws = getProperty("PeaksWorkspace"); @@ -222,7 +222,7 @@ void ConvertCWSDMDtoHKL::saveMDToFile( std::string filename = getPropertyValue("QSampleFileName"); // Abort with an empty string - if (filename.size() == 0) + if (filename.empty()) return; if (vec_event_qsample.size() != vec_event_signal.size()) throw std::runtime_error( diff --git a/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp b/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp index ddf4bdc9fca8e93ba2abe6f21f428021e7365a67..bcfb380c3351029af75f08f3c3fc0e85765dedc9 100644 --- a/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp +++ b/Framework/MDAlgorithms/src/GetSpiceDataRawCountsFromMD.cpp @@ -108,7 +108,7 @@ void GetSpiceDataRawCountsFromMD::exec() { ylabel, donormalize); } else if (mode.compare("Sample Log") == 0) { std::string samplelogname = getProperty("SampleLogName"); - if (samplelogname.size() == 0) + if (samplelogname.empty()) throw std::runtime_error( "For mode 'Sample Log', value of 'SampleLogName' must be specified."); exportSampleLogValue(datamdws, samplelogname, vecX, vecY, xlabel, ylabel); @@ -220,7 +220,7 @@ void GetSpiceDataRawCountsFromMD::exportIndividualDetCounts( std::vector<double> vecDetCounts; int runnumber = -1; bool get2theta = false; - if (xlabel.size() == 0) { + if (xlabel.empty()) { // xlabel is in default and thus use 2-theta for X get2theta = true; } @@ -305,7 +305,7 @@ void GetSpiceDataRawCountsFromMD::exportSampleLogValue( ylabel = samplelogname; // X values - if (xlabel.size() == 0) { + if (xlabel.empty()) { // default xlabel = "Pt."; } @@ -513,7 +513,7 @@ MatrixWorkspace_sptr GetSpiceDataRawCountsFromMD::createOutputWorkspace( // Set label outws->setYUnitLabel(ylabel); - if (xlabel.size() != 0) { + if (!xlabel.empty()) { try { outws->getAxis(0)->setUnit(xlabel); } catch (...) { diff --git a/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp b/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp index 4c724bcb83d0a2615662feb52351fe6496cc42e0..82ee67bace0ac3997e3dd46ad003be4ed13127bf 100644 --- a/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp +++ b/Framework/MDAlgorithms/src/IntegratePeaksCWSD.cpp @@ -125,7 +125,7 @@ void IntegratePeaksCWSD::processInputs() { // Input peaks std::vector<double> peak_center = getProperty("PeakCentre"); - if (peak_center.size() > 0) { + if (!peak_center.empty()) { // assigned peak center if (peak_center.size() != 3) throw std::invalid_argument("PeakCentre must have 3 elements."); @@ -187,7 +187,7 @@ void IntegratePeaksCWSD::processInputs() { // optional mask workspace std::string maskwsname = getPropertyValue("MaskWorkspace"); - if (maskwsname.size() > 0) { + if (!maskwsname.empty()) { // process mask workspace m_maskDets = true; m_maskWS = getProperty("MaskWorkspace"); @@ -254,7 +254,7 @@ void IntegratePeaksCWSD::simplePeakIntegration( // ... debug */ // Check whether this detector is masked - if (vecMaskedDetID.size() > 0) { + if (!vecMaskedDetID.empty()) { detid_t detid = mditer->getInnerDetectorID(iev); std::vector<detid_t>::const_iterator it; diff --git a/Framework/MDAlgorithms/src/MDWSDescription.cpp b/Framework/MDAlgorithms/src/MDWSDescription.cpp index 0852bcb43b7ad05c8d89e49ac4f823b0862c8a36..5c638c4b3925d6d24558de1e2a5dce19cffa72f5 100644 --- a/Framework/MDAlgorithms/src/MDWSDescription.cpp +++ b/Framework/MDAlgorithms/src/MDWSDescription.cpp @@ -322,7 +322,7 @@ void MDWSDescription::getMinMax(std::vector<double> &min, /** Method checks if the workspace is expected to be processed in powder mode */ bool MDWSDescription::isPowder() const { return (this->AlgID == "|Q|") || - (this->AlgID.size() == 0 && !m_InWS->sample().hasOrientedLattice()); + (this->AlgID.empty() && !m_InWS->sample().hasOrientedLattice()); } /** Returns symbolic representation of current Emode */ diff --git a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index 3a820ca51608c949db0a65499bd03db3ed511edf..d0f50931975c02fbf4e536eda7ef6bd143f9683b 100644 --- a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -177,7 +177,7 @@ void SlicingAlgorithm::makeBasisVectorFromString(const std::string &str) { // Get the entire name std::string name = Strings::strip(input.substr(0, n_first_comma)); - if (name.size() == 0) + if (name.empty()) throw std::invalid_argument("name should not be blank."); // Now remove the name and comma @@ -488,7 +488,7 @@ void SlicingAlgorithm::makeAlignedDimensionFromString(const std::string &str) { Strings::convert(strs[0], min); Strings::convert(strs[1], max); Strings::convert(strs[2], numBins); - if (name.size() == 0) + if (name.empty()) throw std::invalid_argument("Name should not be blank."); if (min >= max) throw std::invalid_argument("Min should be > max."); diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp index 3615761a57fa746af55722e8eaf3a327298a7f65..cc92119a4c67aa89fc64093d332f1f88962e56f5 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IAlgorithm.cpp @@ -186,7 +186,7 @@ std::string createDocString(IAlgorithm &self) { // Put in the quick overview message std::stringstream buffer; std::string temp = self.summary(); - if (temp.size() > 0) + if (!temp.empty()) buffer << temp << EOL << EOL; // get a sorted copy of the properties diff --git a/Framework/RemoteAlgorithms/src/SimpleJSON.cpp b/Framework/RemoteAlgorithms/src/SimpleJSON.cpp index 717da9b0cc1be054b38639d0c049872f401e03c1..46a29f8b15db4c4419d513adc2ef8c5224e3504d 100644 --- a/Framework/RemoteAlgorithms/src/SimpleJSON.cpp +++ b/Framework/RemoteAlgorithms/src/SimpleJSON.cpp @@ -663,9 +663,7 @@ string readUntilCloseChar(istream &istr) { "Stream unexpectedly ended without a closing char."); } - if ((value.size() > 0) || - (!isspace( - next))) // don't add white space to the start of the value string + if (!value.empty() || !isspace(next)) // don't add white space to the start of the value string { value += next; } diff --git a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp index 48a4c64186a2109292f7071e59d8b4025bf1130f..cc887c1618b4b161f70e12c79b31ef8e060e487d 100644 --- a/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp +++ b/Framework/RemoteJobManagers/src/MantidWebServiceAPIHelper.cpp @@ -211,7 +211,7 @@ void MantidWebServiceAPIHelper::initHTTPRequest(Poco::Net::HTTPRequest &req, path += extraPath; uri.setPath(path); - if (method == Poco::Net::HTTPRequest::HTTP_GET && queryString.size() > 0) { + if (method == Poco::Net::HTTPRequest::HTTP_GET && !queryString.empty()) { uri.setQuery(queryString); } diff --git a/Framework/RemoteJobManagers/src/SimpleJSON.cpp b/Framework/RemoteJobManagers/src/SimpleJSON.cpp index 0e422f961ee2754ca843962c183b1b38000f17a6..2db537681cbf9927f535e175aac9ff1a6ba572f5 100644 --- a/Framework/RemoteJobManagers/src/SimpleJSON.cpp +++ b/Framework/RemoteJobManagers/src/SimpleJSON.cpp @@ -663,9 +663,9 @@ string readUntilCloseChar(istream &istr) { "Stream unexpectedly ended without a closing char."); } - if ((value.size() > 0) || + if ((!value.empty()) || (!isspace( - next))) // don't add white space to the start of the value string + next))) // don't add white space to the start of the value string { value += next; } diff --git a/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/UncertainValueIO.h b/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/UncertainValueIO.h index 7b049d62bfa1853b344bdde96953a175a30039c5..86e4431667632c06c404df078de5c7791b47a6eb 100644 --- a/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/UncertainValueIO.h +++ b/Framework/SINQ/inc/MantidSINQ/PoldiUtilities/UncertainValueIO.h @@ -50,7 +50,7 @@ public: } static UncertainValue fromString(const std::string &uncertainValueString) { - if (uncertainValueString.size() == 0) { + if (uncertainValueString.empty()) { return UncertainValue(); } diff --git a/Framework/WorkflowAlgorithms/src/ComputeSensitivity.cpp b/Framework/WorkflowAlgorithms/src/ComputeSensitivity.cpp index 8b2111110b974a560f753c598444c139225004f5..029e32c04dd0fd62685b59a65a48fd3556e1d104 100644 --- a/Framework/WorkflowAlgorithms/src/ComputeSensitivity.cpp +++ b/Framework/WorkflowAlgorithms/src/ComputeSensitivity.cpp @@ -66,7 +66,7 @@ void ComputeSensitivity::exec() { // Set patch information so that the SANS sensitivity algorithm can // patch the sensitivity workspace const std::string patchWSName = getPropertyValue("PatchWorkspace"); - if (patchWSName.size() > 0) { + if (!patchWSName.empty()) { IAlgorithm_sptr patchAlg = createChildAlgorithm("EQSANSPatchSensitivity"); patchAlg->setPropertyValue("PatchWorkspace", patchWSName); if (!reductionManager->existsProperty("SensitivityPatchAlgorithm")) { diff --git a/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction.cpp b/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction.cpp index 8f32b6425f67ead1b93fe893db1cdeeac88bd23b..210550da3ac68846261b81aeae64b3fdef146ced 100644 --- a/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction.cpp +++ b/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction.cpp @@ -118,7 +118,7 @@ void EQSANSDarkCurrentSubtraction::exec() { std::string darkWSOutputName = getPropertyValue("OutputDarkCurrentWorkspace"); - if (!(darkWSOutputName.size() == 0)) + if (!darkWSOutputName.empty()) setProperty("OutputDarkCurrentWorkspace", darkWS); AnalysisDataService::Instance().addOrReplace(darkWSName, darkWS); reductionManager->declareProperty(Kernel::make_unique<WorkspaceProperty<>>( diff --git a/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp b/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp index 6bb8c14b3e8bddc327a9fc61cd4777c09bc3a443..a8f5e71cda0b1ad6bdc21adc838e78f5e22edcd6 100644 --- a/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp +++ b/Framework/WorkflowAlgorithms/src/EQSANSDarkCurrentSubtraction2.cpp @@ -133,7 +133,7 @@ void EQSANSDarkCurrentSubtraction2::exec() { std::string darkWSOutputName = getPropertyValue("OutputDarkCurrentWorkspace"); - if (!(darkWSOutputName.size() == 0)) + if (!darkWSOutputName.empty()) setProperty("OutputDarkCurrentWorkspace", darkWS); AnalysisDataService::Instance().addOrReplace(darkWSName, darkWS); reductionManager->declareProperty(Kernel::make_unique<WorkspaceProperty<>>( diff --git a/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp b/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp index 59c6490ef04c5887870946ec662113bb2dd2eb2c..5536ce88c958231de79e1af270742925215dbc01 100644 --- a/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp +++ b/Framework/WorkflowAlgorithms/src/EQSANSLoad.cpp @@ -442,12 +442,12 @@ void EQSANSLoad::exec() { // live data reduction (when it's implemented...) const std::string fileName = getPropertyValue("Filename"); EventWorkspace_sptr inputEventWS = getProperty("InputWorkspace"); - if (fileName.size() == 0 && !inputEventWS) { + if (fileName.empty() && !inputEventWS) { g_log.error() << "EQSANSLoad input error: Either a valid file path or an " "input workspace must be provided\n"; throw std::runtime_error("EQSANSLoad input error: Either a valid file path " "or an input workspace must be provided"); - } else if (fileName.size() > 0 && inputEventWS) { + } else if (!fileName.empty() && inputEventWS) { g_log.error() << "EQSANSLoad input error: Either a valid file path or an " "input workspace must be provided, but not both\n"; throw std::runtime_error("EQSANSLoad input error: Either a valid file path " @@ -607,7 +607,7 @@ void EQSANSLoad::exec() { // Process the config file bool use_config = getProperty("UseConfig"); - if (use_config && config_file.size() > 0) { + if (use_config && !config_file.empty()) { // Special case to force reading the beam center from the config file // We're adding this to be compatible with the original EQSANS load // written in python diff --git a/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp b/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp index 32d410265f42cfe2446488701acf2768ca7e3662..3645d5b40ac0cf2b3dd4d2e86b194295ecba11c7 100644 --- a/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp +++ b/Framework/WorkflowAlgorithms/src/EQSANSQ2D.cpp @@ -45,7 +45,7 @@ void EQSANSQ2D::exec() { // If the OutputWorkspace property was not given, use the // name of the input workspace as the base name for the output std::string outputWSName = getPropertyValue("OutputWorkspace"); - if (outputWSName.size() == 0) { + if (outputWSName.empty()) { outputWSName = inputWS->getName(); } diff --git a/Framework/WorkflowAlgorithms/src/HFIRDarkCurrentSubtraction.cpp b/Framework/WorkflowAlgorithms/src/HFIRDarkCurrentSubtraction.cpp index 812c1038fd67a9fed29c8d3355d9e48418c379f8..a0f760750bebbf7da06d0b1ca94908c8de101ba1 100644 --- a/Framework/WorkflowAlgorithms/src/HFIRDarkCurrentSubtraction.cpp +++ b/Framework/WorkflowAlgorithms/src/HFIRDarkCurrentSubtraction.cpp @@ -83,7 +83,7 @@ void HFIRDarkCurrentSubtraction::exec() { output_message += darkWSName + '\n'; } else { // Load the dark current if we don't have it already - if (darkWSName.size() == 0) { + if (darkWSName.empty()) { darkWSName = "__dark_current_" + path.getBaseName(); setPropertyValue("OutputDarkCurrentWorkspace", darkWSName); } diff --git a/Framework/WorkflowAlgorithms/src/RefReduction.cpp b/Framework/WorkflowAlgorithms/src/RefReduction.cpp index 0c26078d047abc4ffd87f746ff7cf36f17264ff7..acc38e5cb3ffbf679fa7b85c3d78d60fda7871a5 100644 --- a/Framework/WorkflowAlgorithms/src/RefReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/RefReduction.cpp @@ -478,7 +478,7 @@ IEventWorkspace_sptr RefReduction::loadData(const std::string dataRun, // If we can't find a workspace, find a file to load std::string path = FileFinder::Instance().getFullPath(dataRun); - if (path.size() == 0 || !Poco::File(path).exists()) { + if (path.empty() || !Poco::File(path).exists()) { try { std::vector<std::string> paths = FileFinder::Instance().findRuns(instrument + dataRun); @@ -488,7 +488,7 @@ IEventWorkspace_sptr RefReduction::loadData(const std::string dataRun, } } - if (path.size() == 0 || !Poco::File(path).exists()) { + if (path.empty() || !Poco::File(path).exists()) { try { std::vector<std::string> paths = FileFinder::Instance().findRuns(dataRun); diff --git a/Framework/WorkflowAlgorithms/src/SANSSensitivityCorrection.cpp b/Framework/WorkflowAlgorithms/src/SANSSensitivityCorrection.cpp index 350d754009aa463fc7d667115201af7ded44f47c..148c1418c4b0b06e821a1fe7d327e5637d7363f1 100644 --- a/Framework/WorkflowAlgorithms/src/SANSSensitivityCorrection.cpp +++ b/Framework/WorkflowAlgorithms/src/SANSSensitivityCorrection.cpp @@ -251,7 +251,7 @@ void SANSSensitivityCorrection::exec() { darkAlg->execute(); if (darkAlg->existsProperty("OutputMessage")) dark_result = darkAlg->getPropertyValue("OutputMessage"); - } else if (darkCurrentFile.size() > 0) { + } else if (!darkCurrentFile.empty()) { darkAlg->setProperty("Filename", darkCurrentFile); darkAlg->setProperty("PersistentCorrection", false); darkAlg->execute(); @@ -260,7 +260,7 @@ void SANSSensitivityCorrection::exec() { else dark_result = " Dark current subtracted\n"; } - } else if (darkCurrentFile.size() > 0) { + } else if (!darkCurrentFile.empty()) { // We need to subtract the dark current for the flood field but no // dark // current subtraction was set for the sample! Use the default dark @@ -356,7 +356,7 @@ void SANSSensitivityCorrection::exec() { } std::string floodWSOutputName = getPropertyValue("OutputSensitivityWorkspace"); - if (floodWSOutputName.size() == 0) { + if (floodWSOutputName.empty()) { setPropertyValue("OutputSensitivityWorkspace", floodWSName); AnalysisDataService::Instance().addOrReplace(floodWSName, floodWS); reductionManager->declareProperty( diff --git a/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp b/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp index 736a7be6042ccd0293c7ed63b55962424b4e35ad..f221e3d744c04eb29b1f1b038adae7edec8f9a47 100644 --- a/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp @@ -580,7 +580,7 @@ void SetupEQSANSReduction::init() { void SetupEQSANSReduction::exec() { // Reduction property manager const std::string reductionManagerName = getProperty("ReductionProperties"); - if (reductionManagerName.size() == 0) { + if (reductionManagerName.empty()) { g_log.error() << "ERROR: Reduction Property Manager name is empty\n"; return; } @@ -619,7 +619,7 @@ void SetupEQSANSReduction::exec() { normAlg->setProperty("NormaliseToBeam", false); } else if (boost::contains(normalization, "Monitor")) { loadMonitors = true; - if (monitorRefFile.size() == 0) { + if (monitorRefFile.empty()) { g_log.error() << "ERROR: normalize-to-monitor was turned ON but no " "reference data was selected\n"; } @@ -671,7 +671,7 @@ void SetupEQSANSReduction::exec() { // Store dark current algorithm const std::string darkCurrentFile = getPropertyValue("DarkCurrentFile"); - if (darkCurrentFile.size() > 0) { + if (!darkCurrentFile.empty()) { IAlgorithm_sptr darkAlg = createChildAlgorithm("EQSANSDarkCurrentSubtraction"); darkAlg->setProperty("Filename", darkCurrentFile); @@ -722,7 +722,7 @@ void SetupEQSANSReduction::exec() { if (!boost::iequals(centerMethod, "DirectBeam")) useDirectBeamMethod = false; const std::string beamCenterFile = getProperty("BeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { const double beamRadius = getProperty("BeamRadius"); IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); @@ -853,7 +853,7 @@ void SetupEQSANSReduction::setupSensitivity( const std::string reductionManagerName = getProperty("ReductionProperties"); const std::string sensitivityFile = getPropertyValue("SensitivityFile"); - if (sensitivityFile.size() > 0) { + if (!sensitivityFile.empty()) { const bool useSampleDC = getProperty("UseDefaultDC"); const std::string sensitivityDarkCurrentFile = getPropertyValue("SensitivityDarkCurrentFile"); @@ -887,7 +887,7 @@ void SetupEQSANSReduction::setupSensitivity( const double sensitivityBeamRadius = getProperty("SensitivityBeamCenterRadius"); bool useDirectBeam = boost::iequals(centerMethod, "DirectBeam"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", useDirectBeam); @@ -975,7 +975,7 @@ void SetupEQSANSReduction::setupTransmission( } else if (boost::iequals(centerMethod, "DirectBeam")) { const std::string beamCenterFile = getProperty("TransmissionBeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", true); @@ -1004,7 +1004,7 @@ void SetupEQSANSReduction::setupBackground( const std::string reductionManagerName = getProperty("ReductionProperties"); // Background const std::string backgroundFile = getPropertyValue("BackgroundFiles"); - if (backgroundFile.size() > 0) + if (!backgroundFile.empty()) reductionManager->declareProperty( Kernel::make_unique<PropertyWithValue<std::string>>("BackgroundFiles", backgroundFile)); @@ -1066,7 +1066,7 @@ void SetupEQSANSReduction::setupBackground( } else if (boost::iequals(centerMethod, "DirectBeam")) { const std::string beamCenterFile = getProperty("BckTransmissionBeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", true); diff --git a/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp b/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp index 22352ea734293426161bf6389cab1f4b19a979c3..87ad6e0318f1cd0cc1067b8e3899f6b6c7564e63 100644 --- a/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp @@ -629,7 +629,7 @@ void SetupHFIRReduction::init() { void SetupHFIRReduction::exec() { // Reduction property manager const std::string reductionManagerName = getProperty("ReductionProperties"); - if (reductionManagerName.size() == 0) { + if (reductionManagerName.empty()) { g_log.error() << "ERROR: Reduction Property Manager name is empty\n"; return; } @@ -691,7 +691,7 @@ void SetupHFIRReduction::exec() { if (!boost::iequals(centerMethod, "DirectBeam")) useDirectBeamMethod = false; const std::string beamCenterFile = getProperty("BeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { const double beamRadius = getProperty("BeamRadius"); IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); @@ -713,7 +713,7 @@ void SetupHFIRReduction::exec() { // Store dark current algorithm const std::string darkCurrentFile = getPropertyValue("DarkCurrentFile"); - if (darkCurrentFile.size() > 0) { + if (!darkCurrentFile.empty()) { IAlgorithm_sptr darkAlg = createChildAlgorithm("HFIRDarkCurrentSubtraction"); darkAlg->setProperty("Filename", darkCurrentFile); @@ -890,7 +890,7 @@ void SetupHFIRReduction::setupSensitivity( const std::string reductionManagerName = getProperty("ReductionProperties"); const std::string sensitivityFile = getPropertyValue("SensitivityFile"); - if (sensitivityFile.size() > 0) { + if (!sensitivityFile.empty()) { const bool useSampleDC = getProperty("UseDefaultDC"); const std::string sensitivityDarkCurrentFile = getPropertyValue("SensitivityDarkCurrentFile"); @@ -945,7 +945,7 @@ void SetupHFIRReduction::setupSensitivity( const double sensitivityBeamRadius = getProperty("SensitivityBeamCenterRadius"); bool useDirectBeam = boost::iequals(centerMethod, "DirectBeam"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", useDirectBeam); @@ -979,7 +979,7 @@ void SetupHFIRReduction::setupBackground( const std::string reductionManagerName = getProperty("ReductionProperties"); // Background const std::string backgroundFile = getPropertyValue("BackgroundFiles"); - if (backgroundFile.size() > 0) + if (!backgroundFile.empty()) reductionManager->declareProperty( Kernel::make_unique<PropertyWithValue<std::string>>("BackgroundFiles", backgroundFile)); @@ -1037,7 +1037,7 @@ void SetupHFIRReduction::setupBackground( } else if (boost::iequals(centerMethod, "DirectBeam")) { const std::string beamCenterFile = getProperty("BckTransmissionBeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", true); @@ -1150,7 +1150,7 @@ void SetupHFIRReduction::setupTransmission( } else if (boost::iequals(centerMethod, "DirectBeam")) { const std::string beamCenterFile = getProperty("TransmissionBeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", true); diff --git a/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp b/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp index 3a4297a17addf6045899a4f9308132194d4a28eb..45f57173cdcc0f17969997a63037efad89ab061e 100644 --- a/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp +++ b/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp @@ -483,7 +483,7 @@ void SetupILLD33Reduction::init() { void SetupILLD33Reduction::exec() { // Reduction property manager const std::string reductionManagerName = getProperty("ReductionProperties"); - if (reductionManagerName.size() == 0) { + if (reductionManagerName.empty()) { g_log.error() << "ERROR: Reduction Property Manager name is empty\n"; return; } @@ -532,7 +532,7 @@ void SetupILLD33Reduction::exec() { // Store dark current algorithm const std::string darkCurrentFile = getPropertyValue("DarkCurrentFile"); - if (darkCurrentFile.size() > 0) { + if (!darkCurrentFile.empty()) { IAlgorithm_sptr darkAlg = createChildAlgorithm("EQSANSDarkCurrentSubtraction"); darkAlg->setProperty("Filename", darkCurrentFile); @@ -583,7 +583,7 @@ void SetupILLD33Reduction::exec() { if (!boost::iequals(centerMethod, "DirectBeam")) useDirectBeamMethod = false; const std::string beamCenterFile = getProperty("BeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { const double beamRadius = getProperty("BeamRadius"); IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); @@ -703,7 +703,7 @@ void SetupILLD33Reduction::setupSensitivity( const std::string reductionManagerName = getProperty("ReductionProperties"); const std::string sensitivityFile = getPropertyValue("SensitivityFile"); - if (sensitivityFile.size() > 0) { + if (!sensitivityFile.empty()) { const bool useSampleDC = getProperty("UseDefaultDC"); const std::string sensitivityDarkCurrentFile = getPropertyValue("SensitivityDarkCurrentFile"); @@ -737,7 +737,7 @@ void SetupILLD33Reduction::setupSensitivity( const double sensitivityBeamRadius = getProperty("SensitivityBeamCenterRadius"); bool useDirectBeam = boost::iequals(centerMethod, "DirectBeam"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", useDirectBeam); @@ -824,7 +824,7 @@ void SetupILLD33Reduction::setupTransmission( } else if (boost::iequals(centerMethod, "DirectBeam")) { const std::string beamCenterFile = getProperty("TransmissionBeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", true); @@ -854,7 +854,7 @@ void SetupILLD33Reduction::setupBackground( const std::string reductionManagerName = getProperty("ReductionProperties"); // Background const std::string backgroundFile = getPropertyValue("BackgroundFiles"); - if (backgroundFile.size() > 0) + if (!backgroundFile.empty()) reductionManager->declareProperty( Kernel::make_unique<PropertyWithValue<std::string>>("BackgroundFiles", backgroundFile)); @@ -915,7 +915,7 @@ void SetupILLD33Reduction::setupBackground( } else if (boost::iequals(centerMethod, "DirectBeam")) { const std::string beamCenterFile = getProperty("BckTransmissionBeamCenterFile"); - if (beamCenterFile.size() > 0) { + if (!beamCenterFile.empty()) { IAlgorithm_sptr ctrAlg = createChildAlgorithm("SANSBeamFinder"); ctrAlg->setProperty("Filename", beamCenterFile); ctrAlg->setProperty("UseDirectBeamMethod", true);