-
Notifications
You must be signed in to change notification settings - Fork 122
/
DeleteWorkspace.cpp
31 lines (27 loc) · 1.1 KB
/
DeleteWorkspace.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAlgorithms/DeleteWorkspace.h"
#include "MantidAPI/AnalysisDataService.h"
namespace Mantid {
namespace Algorithms {
// Register the algorithm
DECLARE_ALGORITHM(DeleteWorkspace)
/// Initialize the algorithm properties
void DeleteWorkspace::init() {
declareProperty(std::make_unique<API::WorkspaceProperty<API::Workspace>>("Workspace", "", Kernel::Direction::Input),
"Name of the workspace to delete.");
}
/// Execute the algorithm
void DeleteWorkspace::exec() {
using API::AnalysisDataService;
using API::AnalysisDataServiceImpl;
AnalysisDataServiceImpl &dataStore = AnalysisDataService::Instance();
const std::string wsName = getProperty("Workspace");
dataStore.remove(wsName); // Logs if it doesn't exist
}
} // namespace Algorithms
} // namespace Mantid