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 getPath(const std::vector<IArchiveSearch_sptr> &archs, const std::set<std::string> &filenames,
40 const std::vector<std::string> &exts) const;
42 std::string makeFileName(const std::string &hint, const Kernel::InstrumentInfo &instrument) const;
43 void setCaseSensitive(const bool cs);
44 bool getCaseSensitive() const;
45 std::vector<IArchiveSearch_sptr> getArchiveSearch(const Kernel::FacilityInfo &facility) const;
46 std::string findRun(const std::string &hintstr, const std::vector<std::string> &exts = {},
47 const bool useExtsOnly = false) const;
48 std::vector<std::string> findRuns(const std::string &hintstr, const std::vector<std::string> &exts = {},
49 const bool useExtsOnly = false) const;
51 const Kernel::InstrumentInfo getInstrument(const std::string &hint) const;
53 std::string getExtension(const std::string &filename, const std::vector<std::string> &exts) const;
54 void getUniqueExtensions(const std::vector<std::string> &extensionsToAdd, std::vector<std::string> &uniqueExts) const;
55
56private:
58
60 static const std::string ALLOWED_SUFFIX;
68 std::string validateRuns(const std::string &searchText) const;
69 std::string extractAllowedSuffix(std::string &userString) const;
70 std::pair<std::string, std::string> toInstrumentAndNumber(const std::string &hint) const;
71 std::string getArchivePath(const std::vector<IArchiveSearch_sptr> &archs, const std::set<std::string> &filenames,
72 const std::vector<std::string> &exts) const;
73 std::string toUpper(const std::string &src) const;
76};
77
79} // namespace API
80} // namespace Mantid
81
82namespace Mantid {
83namespace Kernel {
84EXTERN_MANTID_API template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<Mantid::API::FileFinderImpl>;
85}
86} // 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:75
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:60
A class that holds information about a facility.
Definition: FacilityInfo.h:36
A class that holds information about an instrument.
Manage the lifetime of a class intended to be a singleton.
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...