Mantid
Loading...
Searching...
No Matches
DownloadInstrument.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 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
10#include "MantidDataHandling/DllConfig.h"
13
14#include <filesystem>
15#include <map>
16#include <set>
17
18namespace Mantid {
19
20namespace DataHandling {
24class MANTID_DATAHANDLING_DLL DownloadInstrument : public API::Algorithm {
25public:
27 const std::string name() const override;
28 int version() const override;
29 const std::vector<std::string> seeAlso() const override { return {"LoadInstrument", "UpdateScriptRepository"}; }
30 const std::string category() const override;
31 const std::string summary() const override;
32
33protected:
34 // Convenience typedef
35 using StringToStringMap = std::map<std::string, std::string>;
36
37private:
38 void init() override;
39 void exec() override;
40 virtual Kernel::InternetHelper::HTTPStatus doDownloadFile(const std::string &urlFile,
41 const std::string &localFilePath = "",
42 const StringToStringMap &headers = StringToStringMap());
43 StringToStringMap getFileShas(const std::filesystem::path &directoryPath);
44 StringToStringMap processRepository();
45 std::string getValueOrDefault(const StringToStringMap &mapping, const std::string &key,
46 const std::string &defaultValue) const;
47
48 size_t removeOrphanedFiles(const std::filesystem::path &directoryPath,
49 const std::unordered_set<std::string> &filenamesToKeep) const;
50
52};
53
54} // namespace DataHandling
55} // namespace Mantid
std::string name
Definition Run.cpp:60
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
DownloadInstrument : Downloads one or more instrument files to the local instrument cache from the in...
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
std::map< std::string, std::string > StringToStringMap
ProxyInfo : Container for carrying around network proxy information.
Definition ProxyInfo.h:17
Helper class which provides the Collimation Length for SANS instruments.