Mantid
Loading...
Searching...
No Matches
ScriptBuilder.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 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//----------------------------------------------------------------------
13#include "MantidAPI/DllConfig.h"
17
18#include <sstream>
19
20namespace Mantid {
21namespace API {
22
31class MANTID_API_DLL ScriptBuilder {
32public:
33 ScriptBuilder(const std::shared_ptr<HistoryView> &view, std::string versionSpecificity = "old",
34 bool appendTimestamp = false, std::vector<std::string> ignoreTheseAlgs = {},
35 std::vector<std::vector<std::string>> ignoreTheseAlgProperties = {}, bool appendExecCount = false);
36 virtual ~ScriptBuilder() = default;
38 const std::string build();
39
40private:
41 void writeHistoryToStream(std::ostringstream &os, std::vector<HistoryItem>::const_iterator &iter, int depth = 1);
42 void buildChildren(std::ostringstream &os, std::vector<HistoryItem>::const_iterator &iter, int depth = 1);
43 const std::string buildCommentString(const AlgorithmHistory &algHistory);
44 const std::string buildAlgorithmString(const AlgorithmHistory &algHistory);
45 const std::string buildPropertyString(const Mantid::Kernel::PropertyHistory &propHistory, const std::string &algName);
46 void createStringForAlg(std::ostringstream &os, std::shared_ptr<const Mantid::API::AlgorithmHistory> &algHistory);
47
48 const std::vector<HistoryItem> m_historyItems;
49 std::string m_output;
52 std::vector<std::string> m_algsToIgnore;
53 std::vector<std::vector<std::string>> m_propertiesToIgnore;
55};
56
57} // namespace API
58} // namespace Mantid
This class stores information about the Command History used by algorithms on a workspace.
This class build a sttring which cana be executed as a python script.
Definition: ScriptBuilder.h:31
std::vector< std::vector< std::string > > m_propertiesToIgnore
Definition: ScriptBuilder.h:53
std::vector< std::string > m_algsToIgnore
Definition: ScriptBuilder.h:52
virtual ~ScriptBuilder()=default
const std::vector< HistoryItem > m_historyItems
Definition: ScriptBuilder.h:48
std::string m_versionSpecificity
Definition: ScriptBuilder.h:50
This class stores information about the parameters used by an algorithm.
Helper class which provides the Collimation Length for SANS instruments.