Mantid
Loading...
Searching...
No Matches
FileFinder.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/DllConfig.h"
15
16#include <set>
17#include <vector>
18
19namespace Mantid {
20//---------------------------------------------------------------------------
21// Forward declarations
22//---------------------------------------------------------------------------
23namespace Kernel {
24class InstrumentInfo;
25class FacilityInfo;
26} // namespace Kernel
27namespace API {
28
36class MANTID_API_DLL FileFinderImpl {
37public:
38 std::string getFullPath(const std::string &filename, const bool ignoreDirs = false) const;
39 std::string extractAllowedSuffix(std::string &userString) const;
40 const API::Result<std::string> getPath(const std::vector<IArchiveSearch_sptr> &archs,
41 const std::set<std::string> &filenames,
42 const std::vector<std::string> &exts) const;
44 std::string makeFileName(const std::string &hint, const Kernel::InstrumentInfo &instrument) const;
45 void setCaseSensitive(const bool cs);
46 bool getCaseSensitive() const;
47 static std::vector<IArchiveSearch_sptr> getArchiveSearch(const Kernel::FacilityInfo &facility);
48 const API::Result<std::string> findRun(const std::string &hintstr, const std::vector<std::string> &exts = {},
49 const bool useExtsOnly = false) const;
50 std::vector<std::string> findRuns(const std::string &hintstr, const std::vector<std::string> &exts = {},
51 const bool useExtsOnly = false) const;
53 const Kernel::InstrumentInfo getInstrument(const std::string &hint, const bool returnDefaultIfNotFound = true) const;
55 std::string getExtension(const std::string &filename, const std::vector<std::string> &exts) const;
56 void getUniqueExtensions(const std::vector<std::string> &extensionsToAdd, std::vector<std::string> &uniqueExts) const;
57 std::pair<std::string, std::string> toInstrumentAndNumber(const std::string &hint) const;
58
59private:
61
63 static const std::string ALLOWED_SUFFIX;
71 std::string validateRuns(const std::string &searchText) const;
72 const API::Result<std::string> getISISInstrumentDataCachePath(const std::string &cachePathToSearch,
73 const std::set<std::string> &filenames,
74 const std::vector<std::string> &exts) const;
75 const API::Result<std::string> getArchivePath(const std::vector<IArchiveSearch_sptr> &archs,
76 const std::set<std::string> &filenames,
77 const std::vector<std::string> &exts) const;
78 std::string toUpper(const std::string &src) const;
81};
82
84} // namespace API
85} // namespace Mantid
86
87namespace Mantid {
88namespace Kernel {
89EXTERN_MANTID_API template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<Mantid::API::FileFinderImpl>;
90}
91} // namespace Mantid
This class finds data files given an instrument name (optionally) and a run number.
Definition FileFinder.h:36
FileFinderImpl(const FileFinderImpl &)
Copy constructor.
int m_globOption
glob option - set to case sensitive or insensitive
Definition FileFinder.h:80
FileFinderImpl & operator=(const FileFinderImpl &)
Assignment operator.
static const std::string ALLOWED_SUFFIX
a string that is allowed at the end of any run number
Definition FileFinder.h:63
A class that holds information about a facility.
A class that holds information about an instrument.
Manage the lifetime of a class intended to be a singleton.
Mantid::Kernel::SingletonHolder< FileFinderImpl > FileFinder
Definition FileFinder.h:83
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...