Skip to content

Commit

Permalink
Removed unused includes + added const to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiMacielPereira committed May 10, 2024
1 parent 3ca6d6d commit 5046005
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions Framework/API/inc/MantidAPI/ISISInstrumentDataCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/IArchiveSearch.h"
#include <string>

namespace Mantid {
Expand All @@ -19,11 +18,11 @@ namespace API {
class MANTID_API_DLL ISISInstrumentDataCache {
public:
ISISInstrumentDataCache(const std::string &path) : m_dataCachePath(path) {}
std::string getFileParentDirectoryPath(std::string filename);
std::string getFileParentDirectoryPath(std::string filename) const;

private:
std::pair<std::string, std::string> validateInstrumentAndNumber(std::string filename);
std::pair<std::string, std::string> splitIntoInstrumentAndNumber(std::string filename);
std::pair<std::string, std::string> validateInstrumentAndNumber(std::string filename) const;
std::pair<std::string, std::string> splitIntoInstrumentAndNumber(std::string filename) const;
std::string m_dataCachePath;
};
} // namespace API
Expand Down
7 changes: 3 additions & 4 deletions Framework/API/src/ISISInstrumentDataCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
#include "MantidKernel/Logger.h"
#include <fstream>
#include <json/reader.h>
#include <json/value.h>

namespace {
Mantid::Kernel::Logger g_log("ISISInstrumentDataCache");
} // namespace

std::string Mantid::API::ISISInstrumentDataCache::getFileParentDirectoryPath(std::string fileName) {
std::string Mantid::API::ISISInstrumentDataCache::getFileParentDirectoryPath(std::string fileName) const {
g_log.debug() << "ISISInstrumentDataCache::getFileParentDirectoryPath(" << fileName << ")" << std::endl;

auto [instrName, runNumber] = validateInstrumentAndNumber(fileName);
Expand Down Expand Up @@ -41,7 +40,7 @@ std::string Mantid::API::ISISInstrumentDataCache::getFileParentDirectoryPath(std
}

std::pair<std::string, std::string>
Mantid::API::ISISInstrumentDataCache::validateInstrumentAndNumber(std::string fileName) {
Mantid::API::ISISInstrumentDataCache::validateInstrumentAndNumber(std::string fileName) const {

// Check if suffix eg. -add is present in filename
std::string suffix = FileFinder::Instance().extractAllowedSuffix(fileName);
Expand All @@ -66,7 +65,7 @@ Mantid::API::ISISInstrumentDataCache::validateInstrumentAndNumber(std::string fi
}

std::pair<std::string, std::string>
Mantid::API::ISISInstrumentDataCache::splitIntoInstrumentAndNumber(std::string fileName) {
Mantid::API::ISISInstrumentDataCache::splitIntoInstrumentAndNumber(std::string fileName) const {

// Find the last non-digit as the instrument name can contain numbers
const auto itRev = std::find_if(fileName.rbegin(), fileName.rend(), std::not_fn(isdigit));
Expand Down

0 comments on commit 5046005

Please sign in to comment.