20using namespace Kernel;
39 "Workspace to copy logs from.");
41 "Workspace to copy logs to.");
44 std::vector<std::string> strategies{
"WipeExisting",
"MergeKeepExisting",
"MergeReplaceExisting"};
46 auto strategiesValidator = std::make_shared<StringListValidator>(strategies);
47 declareProperty(
"MergeStrategy",
"MergeReplaceExisting", strategiesValidator,
48 "The type of merge strategy to use on the logs");
59 const Run &inputRun = inputWs->run();
63 Run &outputRun = outputWs->mutableRun();
65 const std::string mode =
getProperty(
"MergeStrategy");
67 if (mode ==
"WipeExisting") {
69 }
else if (mode ==
"MergeKeepExisting") {
71 }
else if (mode ==
"MergeReplaceExisting") {
74 throw std::runtime_error(
"Cannot copy logs using unknown merge strategy");
77 if (!outputWs->getName().empty())
78 setProperty(
"OutputWorkspace", outputWs->getName());
86 for (
auto prop : inputLogs) {
100 for (
auto prop : inputLogs) {
116 for (
auto &outputLog : outputLogs) {
121 for (
auto inputLog : inputLogs) {
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void addLogData(Kernel::Property *p)
Add a log entry.
bool hasProperty(const std::string &name) const
Does the property exist on the object.
Kernel::Property * getLogData(const std::string &name) const
Access a single log entry.
void removeLogData(const std::string &name, const bool delproperty=true)
Remove a named log entry.
This class stores information regarding an experimental run as a series of log entries.
A property class for workspaces.
void mergeReplaceExisting(const std::vector< Kernel::Property * > &inputLogs, API::Run &outputRun)
appends new logs and overwrites existing logs.
void init() override
Initialize the algorithm's properties.
int version() const override
Algorithm's version for identification.
void exec() override
Execute the algorithm.
void mergeKeepExisting(const std::vector< Kernel::Property * > &inputLogs, API::Run &outputRun)
appends new logs but leaves exisitng logs untouched.
const std::string name() const override
Algorithm's name for identification.
const std::string category() const override
Algorithm's category for identification.
void wipeExisting(const std::vector< Kernel::Property * > &inputLogs, API::Run &outputRun)
appends new logs and removes all existing logs.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
@ InOut
Both an input & output workspace.
@ Input
An input workspace.