Commit 1473c74e authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Refs #14764. Ran clang-tidy on Mantid Framework.

parent 4759f476
......@@ -206,7 +206,7 @@ const std::vector<std::string> Algorithm::categories() const {
Poco::StringTokenizer tokenizer(category(), categorySeparator(),
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
Poco::StringTokenizer::Iterator h = tokenizer.begin();
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
res.push_back(*h);
......
......@@ -39,7 +39,7 @@ AlgorithmFactoryImpl::create(const std::string &name,
if (version < 0) {
if (version == -1) // get latest version since not supplied
{
VersionMap::const_iterator it = m_vmap.find(name);
auto it = m_vmap.find(name);
if (!name.empty()) {
if (it == m_vmap.end())
throw std::runtime_error("Algorithm not registered " + name);
......@@ -53,7 +53,7 @@ AlgorithmFactoryImpl::create(const std::string &name,
try {
return this->createAlgorithm(name, local_version);
} catch (Kernel::Exception::NotFoundError &) {
VersionMap::const_iterator it = m_vmap.find(name);
auto it = m_vmap.find(name);
if (it == m_vmap.end())
throw std::runtime_error("algorithm not registered " + name);
else {
......@@ -79,7 +79,7 @@ void AlgorithmFactoryImpl::unsubscribe(const std::string &algorithmName,
try {
Kernel::DynamicFactory<Algorithm>::unsubscribe(key);
// Update version map accordingly
VersionMap::iterator it = m_vmap.find(algorithmName);
auto it = m_vmap.find(algorithmName);
if (it != m_vmap.end()) {
int highest_version = it->second;
if (highest_version > 1 &&
......@@ -223,7 +223,7 @@ AlgorithmFactoryImpl::getKeys(bool includeHidden) const {
*/
int AlgorithmFactoryImpl::highestVersion(
const std::string &algorithmName) const {
VersionMap::const_iterator viter = m_vmap.find(algorithmName);
auto viter = m_vmap.find(algorithmName);
if (viter != m_vmap.end())
return viter->second;
else {
......@@ -394,7 +394,7 @@ void AlgorithmFactoryImpl::fillHiddenCategories(
Poco::StringTokenizer tokenizer(categoryString, ";",
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
Poco::StringTokenizer::Iterator h = tokenizer.begin();
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
categorySet->insert(*h);
......
......@@ -169,7 +169,7 @@ AlgorithmHistory::getChildAlgorithmHistory(const size_t index) const {
throw std::out_of_range(
"AlgorithmHistory::getAlgorithmHistory() - Index out of range");
}
AlgorithmHistories::const_iterator start = m_childHistories.begin();
auto start = m_childHistories.begin();
std::advance(start, index);
return *start;
}
......@@ -273,7 +273,7 @@ void AlgorithmHistory::saveNexus(::NeXus::File *file, int &algCount) const {
file->writeData("data", algData.str());
// child algorithms
AlgorithmHistories::const_iterator histIter = m_childHistories.begin();
auto histIter = m_childHistories.begin();
for (; histIter != m_childHistories.end(); ++histIter) {
(*histIter)->saveNexus(file, algCount);
}
......
......@@ -149,7 +149,7 @@ void AlgorithmManagerImpl::setMaxAlgorithms(int n) {
*/
IAlgorithm_sptr AlgorithmManagerImpl::getAlgorithm(AlgorithmID id) const {
Mutex::ScopedLock _lock(this->m_managedMutex);
for (std::deque<IAlgorithm_sptr>::const_iterator a = m_managed_algs.begin();
for (auto a = m_managed_algs.begin();
a != m_managed_algs.end(); ++a) {
if ((**a).getAlgorithmID() == id)
return *a;
......
......@@ -148,7 +148,7 @@ void AlgorithmProxy::addObserver(const Poco::AbstractObserver &observer) const {
*/
void AlgorithmProxy::removeObserver(
const Poco::AbstractObserver &observer) const {
std::vector<const Poco::AbstractObserver *>::iterator o = std::find(
auto o = std::find(
m_externalObservers.begin(), m_externalObservers.end(), &observer);
if (o != m_externalObservers.end())
m_externalObservers.erase(o);
......@@ -282,7 +282,7 @@ void AlgorithmProxy::dropWorkspaceReferences() {
void AlgorithmProxy::addObservers() {
if (!m_alg)
return;
std::vector<const Poco::AbstractObserver *>::reverse_iterator o =
auto o =
m_externalObservers.rbegin();
for (; o != m_externalObservers.rend(); ++o)
m_alg->addObserver(**o);
......@@ -314,7 +314,7 @@ const std::vector<std::string> AlgorithmProxy::categories() const {
Poco::StringTokenizer tokenizer(category(), categorySeparator(),
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
Poco::StringTokenizer::Iterator h = tokenizer.begin();
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
res.push_back(*h);
......
......@@ -33,7 +33,7 @@ CompositeDomainMD::CompositeDomainMD(IMDWorkspace_const_sptr ws,
* Destructor.
*/
CompositeDomainMD::~CompositeDomainMD() {
std::vector<FunctionDomainMD *>::iterator it = m_domains.begin();
auto it = m_domains.begin();
for (; it != m_domains.end(); ++it) {
delete *it;
}
......
......@@ -419,7 +419,7 @@ void CompositeFunction::removeFunction(size_t i) {
}
// Shift down the function indeces for parameters
for (std::vector<size_t>::iterator it = m_IFunction.begin();
for (auto it = m_IFunction.begin();
it != m_IFunction.end();) {
if (*it == i) {
......@@ -475,7 +475,7 @@ void CompositeFunction::replaceFunction(size_t i, IFunction_sptr f) {
// Modify function indeces: The new function may have different number of
// parameters
{
std::vector<size_t>::iterator itFun =
auto itFun =
std::find(m_IFunction.begin(), m_IFunction.end(), i);
if (itFun != m_IFunction.end()) // functions must have at least 1 parameter
{
......
......@@ -50,7 +50,7 @@ CoordTransform::applyVMD(const Mantid::Kernel::VMD &inputVector) const {
if (inputVector.getNumDims() != inD)
throw std::runtime_error("CoordTransform::apply(): inputVector has the "
"wrong number of coordinates!");
coord_t *outArray = new coord_t[outD];
auto outArray = new coord_t[outD];
this->apply(inputVector.getBareArray(), outArray);
VMD out(outD, outArray);
delete[] outArray;
......
......@@ -83,7 +83,7 @@ void ExperimentInfo::copyExperimentInfoFrom(const ExperimentInfo *other) {
/** Clone this ExperimentInfo class into a new one
*/
ExperimentInfo *ExperimentInfo::cloneExperimentInfo() const {
ExperimentInfo *out = new ExperimentInfo();
auto out = new ExperimentInfo();
out->copyExperimentInfoFrom(this);
return out;
}
......@@ -1138,9 +1138,9 @@ void ExperimentInfo::readParameterMap(const std::string &parameterStr) {
options += Poco::StringTokenizer::TOK_TRIM;
Poco::StringTokenizer splitter(parameterStr, "|", options);
Poco::StringTokenizer::Iterator iend = splitter.end();
auto iend = splitter.end();
// std::string prev_name;
for (Poco::StringTokenizer::Iterator itr = splitter.begin(); itr != iend;
for (auto itr = splitter.begin(); itr != iend;
++itr) {
Poco::StringTokenizer tokens(*itr, ";");
if (tokens.count() < 4)
......
......@@ -71,7 +71,7 @@ void Expression::add_operators(const std::vector<std::string> &ops) {
char j = 0;
tokenizer tkz(m_operators->binary[i], " ",
tokenizer::TOK_IGNORE_EMPTY | tokenizer::TOK_TRIM);
for (tokenizer::Iterator it = tkz.begin(); it != tkz.end(); it++) {
for (auto it = tkz.begin(); it != tkz.end(); it++) {
m_operators->precedence[*it] = i + 1;
m_operators->op_number[*it] = j++;
}
......@@ -90,7 +90,7 @@ void Expression::add_operators(const std::vector<std::string> &ops) {
void Expression::add_unary(const std::set<std::string> &ops) {
m_operators->unary = ops;
for (std::set<std::string>::const_iterator it = ops.begin(); it != ops.end();
for (auto it = ops.begin(); it != ops.end();
++it) {
for (std::string::const_iterator c = it->begin(); c != it->end(); ++c) {
m_operators->symbols.insert(*c);
......@@ -499,7 +499,7 @@ std::set<std::string> Expression::getVariables() const {
out.insert(s);
}
} else {
for (iterator e = begin(); e != end(); ++e) {
for (auto e = begin(); e != end(); ++e) {
if (e->isFunct()) {
std::set<std::string> tout = e->getVariables();
out.insert(tout.begin(), tout.end());
......@@ -521,7 +521,7 @@ void Expression::renameAll(const std::string &oldName,
if (!isFunct() && name() == oldName) {
rename(newName);
} else {
std::vector<Expression>::iterator e = m_terms.begin();
auto e = m_terms.begin();
for (; e != m_terms.end(); ++e) {
e->renameAll(oldName, newName);
}
......
......@@ -126,7 +126,7 @@ std::string FileFinderImpl::getFullPath(const std::string &filename,
const std::vector<std::string> &searchPaths =
Kernel::ConfigService::Instance().getDataSearchDirs();
std::vector<std::string>::const_iterator it = searchPaths.begin();
auto it = searchPaths.begin();
for (; it != searchPaths.end(); ++it) {
// On windows globbing is note working properly with network drives
// for example a network drive containing a $
......@@ -479,7 +479,7 @@ FileFinderImpl::findRun(const std::string &hintstr,
tolower);
if (!archiveOpt.empty() && archiveOpt != "off" &&
!facility.archiveSearch().empty()) {
std::vector<std::string>::const_iterator it =
auto it =
facility.archiveSearch().begin();
for (; it != facility.archiveSearch().end(); ++it) {
g_log.debug() << "get archive search for the facility..." << *it
......@@ -602,7 +602,7 @@ FileFinderImpl::findRuns(const std::string &hintstr) const {
Poco::StringTokenizer hints(hint, ",",
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
Poco::StringTokenizer::Iterator h = hints.begin();
auto h = hints.begin();
for (; h != hints.end(); ++h) {
// Quick check for a filename
......@@ -686,7 +686,7 @@ FileFinderImpl::getArchivePath(const std::vector<IArchiveSearch_sptr> &archs,
const std::set<std::string> &filenames,
const std::vector<std::string> &exts) const {
std::string path = "";
std::vector<IArchiveSearch_sptr>::const_iterator it = archs.begin();
auto it = archs.begin();
for (; it != archs.end(); ++it) {
try {
path = (*it)->getArchivePath(filenames, exts);
......@@ -751,7 +751,7 @@ FileFinderImpl::getPath(const std::vector<IArchiveSearch_sptr> &archs,
}
for (auto ext = extensions.begin(); ext != extensions.end(); ++ext) {
std::set<std::string>::const_iterator it = filenames.begin();
auto it = filenames.begin();
for (; it != filenames.end(); ++it) {
path = getFullPath(*it + *ext);
try {
......
......@@ -227,9 +227,9 @@ bool FileProperty::extsMatchRunFiles() {
Kernel::FacilityInfo facilityInfo =
Kernel::ConfigService::Instance().getFacility();
const std::vector<std::string> facilityExts = facilityInfo.extensions();
std::vector<std::string>::const_iterator facilityExtsBegin =
auto facilityExtsBegin =
facilityExts.begin();
std::vector<std::string>::const_iterator facilityExtsEnd =
auto facilityExtsEnd =
facilityExts.end();
const std::vector<std::string> allowedExts = this->allowedValues();
......
......@@ -83,7 +83,7 @@ IFunction_sptr FunctionFactoryImpl::createSimple(
}
const std::vector<Expression> &terms = expr.terms();
std::vector<Expression>::const_iterator term = terms.begin();
auto term = terms.begin();
if (term->name() != "=")
inputError(expr.str());
......@@ -146,7 +146,7 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite(
}
const std::vector<Expression> &terms = expr.terms();
std::vector<Expression>::const_iterator it = terms.begin();
auto it = terms.begin();
const Expression &term = it->bracketsRemoved();
CompositeFunction_sptr cfun;
......@@ -166,7 +166,7 @@ CompositeFunction_sptr FunctionFactoryImpl::createComposite(
inputError(expr.str());
}
} else if (term.name() == ",") {
std::vector<Expression>::const_iterator firstTerm = term.terms().begin();
auto firstTerm = term.terms().begin();
if (firstTerm->name() == "=") {
if (firstTerm->terms()[0].name() == "composite") {
cfun = boost::dynamic_pointer_cast<CompositeFunction>(
......
......@@ -10,7 +10,7 @@ HistoryView::HistoryView(const WorkspaceHistory &wsHist)
: m_wsHist(wsHist), m_historyItems() {
// add all of the top level algorithms to the view by default
const auto algorithms = wsHist.getAlgorithmHistories();
AlgorithmHistories::const_iterator iter = algorithms.begin();
auto iter = algorithms.begin();
for (; iter != algorithms.end(); ++iter) {
HistoryItem item(*iter);
m_historyItems.push_back(item);
......
......@@ -109,7 +109,7 @@ void IFunction::functionDeriv(const FunctionDomain &domain,
*/
ParameterTie *IFunction::tie(const std::string &parName,
const std::string &expr, bool isDefault) {
ParameterTie *ti = new ParameterTie(this, parName, expr, isDefault);
auto ti = new ParameterTie(this, parName, expr, isDefault);
addTie(ti);
this->fix(getParameterIndex(*ti));
return ti;
......@@ -257,7 +257,7 @@ const std::vector<std::string> IFunction::categories() const {
Poco::StringTokenizer tokenizer(category(), categorySeparator(),
Poco::StringTokenizer::TOK_TRIM |
Poco::StringTokenizer::TOK_IGNORE_EMPTY);
Poco::StringTokenizer::Iterator h = tokenizer.begin();
auto h = tokenizer.begin();
for (; h != tokenizer.end(); ++h) {
res.push_back(*h);
......
......@@ -395,8 +395,8 @@ void LogManager::loadNexus(::NeXus::File *file, const std::string &group,
std::map<std::string, std::string> entries;
file->getEntries(entries);
std::map<std::string, std::string>::iterator it = entries.begin();
std::map<std::string, std::string>::iterator it_end = entries.end();
auto it = entries.begin();
auto it_end = entries.end();
for (; it != it_end; ++it) {
// Get the name/class pair
const std::pair<std::string, std::string> &name_class = *it;
......
......@@ -146,7 +146,7 @@ Mantid::Geometry::VecIMDDimension_const_sptr
MDGeometry::getNonIntegratedDimensions() const {
using namespace Mantid::Geometry;
VecIMDDimension_const_sptr vecCollapsedDimensions;
std::vector<Mantid::Geometry::IMDDimension_sptr>::const_iterator it =
auto it =
this->m_dimensions.begin();
for (; it != this->m_dimensions.end(); ++it) {
IMDDimension_sptr current = (*it);
......
......@@ -519,7 +519,7 @@ void MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
// Allow multiple detectors per workspace index, or,
// If only one is allowed, then this has thrown already
for (std::set<detid_t>::const_iterator it = detList.begin();
for (auto it = detList.begin();
it != detList.end(); ++it) {
int index = *it + offset;
if (index < 0 || index >= outSize) {
......@@ -550,7 +550,7 @@ void MatrixWorkspace::getIndicesFromSpectra(
indexList.clear();
indexList.reserve(this->getNumberHistograms());
std::vector<specid_t>::const_iterator iter = spectraList.begin();
auto iter = spectraList.begin();
while (iter != spectraList.end()) {
for (size_t i = 0; i < this->getNumberHistograms(); ++i) {
if (this->getSpectrum(i)->getSpectrumNo() == *iter) {
......@@ -625,8 +625,8 @@ void MatrixWorkspace::getIndicesFromDetectorIDs(
void MatrixWorkspace::getSpectraFromDetectorIDs(
const std::vector<detid_t> &detIdList,
std::vector<specid_t> &spectraList) const {
std::vector<detid_t>::const_iterator it_start = detIdList.begin();
std::vector<detid_t>::const_iterator it_end = detIdList.end();
auto it_start = detIdList.begin();
auto it_end = detIdList.end();
spectraList.clear();
......@@ -1016,7 +1016,7 @@ void MatrixWorkspace::maskWorkspaceIndex(const std::size_t index) {
spec->clearData();
const std::set<detid_t> dets = spec->getDetectorIDs();
for (std::set<detid_t>::const_iterator iter = dets.begin();
for (auto iter = dets.begin();
iter != dets.end(); ++iter) {
try {
if (const Geometry::Detector *det =
......@@ -1085,7 +1085,7 @@ void MatrixWorkspace::flagMasked(const size_t &spectrumIndex,
// First get a reference to the list for this spectrum (or create a new
// list)
MaskList &binList = m_masks[spectrumIndex];
MaskList::iterator it = binList.find(binIndex);
auto it = binList.find(binIndex);
if (it != binList.end()) {
binList.erase(it);
}
......@@ -1113,7 +1113,7 @@ bool MatrixWorkspace::hasMaskedBins(const size_t &workspaceIndex) const {
*/
const MatrixWorkspace::MaskList &
MatrixWorkspace::maskedBins(const size_t &workspaceIndex) const {
std::map<int64_t, MaskList>::const_iterator it = m_masks.find(workspaceIndex);
auto it = m_masks.find(workspaceIndex);
// Throw if there are no masked bins for this spectrum. The caller should
// check first using hasMaskedBins!
if (it == m_masks.end()) {
......@@ -1238,7 +1238,7 @@ size_t MatrixWorkspace::binIndexOf(const double xValue,
throw std::out_of_range("MatrixWorkspace::binIndexOf - X value lower than "
"lowest in current range.");
}
MantidVec::const_iterator lowit =
auto lowit =
std::lower_bound(xValues.begin(), xValues.end(), xValue);
if (lowit == xValues.end()) {
throw std::out_of_range("MatrixWorkspace::binIndexOf - X value greater "
......@@ -1438,11 +1438,11 @@ private:
boost::shared_ptr<const Mantid::Geometry::IMDDimension>
MatrixWorkspace::getDimension(size_t index) const {
if (index == 0) {
MWXDimension *dimension = new MWXDimension(this, xDimensionId);
auto dimension = new MWXDimension(this, xDimensionId);
return boost::shared_ptr<const Mantid::Geometry::IMDDimension>(dimension);
} else if (index == 1) {
Axis *yAxis = this->getAxis(1);
MWDimension *dimension = new MWDimension(yAxis, yDimensionId);
auto dimension = new MWDimension(yAxis, yDimensionId);
return boost::shared_ptr<const Mantid::Geometry::IMDDimension>(dimension);
} else
throw std::invalid_argument("MatrixWorkspace only has 2 dimensions.");
......@@ -1567,7 +1567,7 @@ signal_t MatrixWorkspace::getSignalAtCoord(
if (wi < nhist) {
const MantidVec &X = this->readX(wi);
MantidVec::const_iterator it = std::lower_bound(X.begin(), X.end(), x);
auto it = std::lower_bound(X.begin(), X.end(), x);
if (it == X.end()) {
// Out of range
return std::numeric_limits<double>::quiet_NaN();
......
......@@ -76,7 +76,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
WorkspaceNameType workspaces =
sourceAlg->getProperty(this->m_workspacePropertyName);
WorkspaceNameType::iterator it = workspaces.begin();
auto it = workspaces.begin();
// Inspect all the input workspaces in the ArrayProperty input.
while (it != workspaces.end()) {
......@@ -93,7 +93,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
WorkspaceVector outWorkspaces;
sourceAlg->findWorkspaceProperties(inWorkspaces, outWorkspaces);
UNUSED_ARG(outWorkspaces);
WorkspaceVector::iterator it = inWorkspaces.begin();
auto it = inWorkspaces.begin();
while (it != inWorkspaces.end()) {
tryAddInputWorkspaceToInputGroups(*it, vecWorkspaceGroups);
++it;
......
......@@ -154,7 +154,7 @@ std::vector<std::string> MultipleFileProperty::flattenFileNames(
const std::vector<std::vector<std::string>> &fileNames) {
std::vector<std::string> flattenedFileNames;
std::vector<std::vector<std::string>>::const_iterator it = fileNames.begin();
auto it = fileNames.begin();
for (; it != fileNames.end(); ++it) {
flattenedFileNames.insert(flattenedFileNames.end(), it->begin(), it->end());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment