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 <map>
15#include <set>
16
17namespace Mantid {
18
19namespace DataHandling {
23class MANTID_DATAHANDLING_DLL DownloadInstrument : public API::Algorithm {
24public:
26 virtual ~DownloadInstrument() = default;
27
28 const std::string name() const override;
29 int version() const override;
30 const std::vector<std::string> seeAlso() const override { return {"LoadInstrument", "UpdateScriptRepository"}; }
31 const std::string category() const override;
32 const std::string summary() const override;
33
34protected:
35 // Convenience typedef
36 using StringToStringMap = std::map<std::string, std::string>;
37
38private:
39 void init() override;
40 void exec() override;
41 virtual Kernel::InternetHelper::HTTPStatus doDownloadFile(const std::string &urlFile,
42 const std::string &localFilePath = "",
43 const StringToStringMap &headers = StringToStringMap());
44 StringToStringMap getFileShas(const std::string &directoryPath);
45 const std::string getDownloadableRepoUrl(const std::string &filename) const;
46 StringToStringMap processRepository();
47 std::string getValueOrDefault(const StringToStringMap &mapping, const std::string &key,
48 const std::string &defaultValue) const;
49
50 size_t removeOrphanedFiles(const std::string &directoryPath,
51 const std::unordered_set<std::string> &filenamesToKeep) const;
52
54};
55
56} // namespace DataHandling
57} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
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
const std::string getDownloadableRepoUrl(const std::string &filename) const
ProxyInfo : Container for carrying around network proxy information.
Definition: ProxyInfo.h:17
Helper class which provides the Collimation Length for SANS instruments.