Mantid
Loading...
Searching...
No Matches
RemoveWorkspaceHistory.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
10
11using namespace Mantid::Kernel;
12using namespace Mantid::API;
13
14namespace Mantid::Algorithms {
15
16// Register the algorithm into the AlgorithmFactory
17DECLARE_ALGORITHM(RemoveWorkspaceHistory)
18
19
20const std::string RemoveWorkspaceHistory::name() const { return "RemoveWorkspaceHistory"; }
21
23int RemoveWorkspaceHistory::version() const { return 1; }
24
26const std::string RemoveWorkspaceHistory::category() const { return "Utility\\Workspaces"; }
27
29const std::string RemoveWorkspaceHistory::summary() const {
30 return "Removes all algorithm history records from a given workspace.";
31}
32
36 declareProperty(std::make_unique<WorkspaceProperty<Workspace>>("Workspace", "", Direction::InOut),
37 "Workspace to remove the algorithm history from.");
38}
39
43 Workspace_sptr ws = getProperty("Workspace");
44 ws->history().clearHistory();
45}
46
47} // namespace Mantid::Algorithms
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
Definition: Algorithm.cpp:1913
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Definition: Algorithm.cpp:2076
A property class for workspaces.
int version() const override
Algorithm's version for identification.
const std::string summary() const override
Algorithm's summary for identification.
void init() override
Initialize the algorithm's properties.
const std::string category() const override
Algorithm's category for identification.
void exec() override
Execute the algorithm.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
STL namespace.
@ InOut
Both an input & output workspace.
Definition: Property.h:55