-
Notifications
You must be signed in to change notification settings - Fork 122
/
CatalogGetDataSets.cpp
41 lines (38 loc) · 1.53 KB
/
CatalogGetDataSets.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
32
33
34
35
36
37
38
39
40
41
// 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 "MantidICat/CatalogGetDataSets.h"
#include "MantidAPI/CatalogManager.h"
#include "MantidAPI/ITableWorkspace.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/WorkspaceProperty.h"
#include "MantidKernel/MandatoryValidator.h"
namespace Mantid {
namespace ICat {
DECLARE_ALGORITHM(CatalogGetDataSets)
/// Initialisation methods
void CatalogGetDataSets::init() {
declareProperty("InvestigationId", "",
std::make_shared<Kernel::MandatoryValidator<std::string>>(),
"ID of the selected investigation");
declareProperty("Session", "",
"The session information of the catalog to use.");
declareProperty(
std::make_unique<API::WorkspaceProperty<API::ITableWorkspace>>(
"OutputWorkspace", "", Kernel::Direction::Output),
"The name of the workspace to store the results.");
}
/// exec methods
void CatalogGetDataSets::exec() {
auto workspace =
API::WorkspaceFactory::Instance().createTable("TableWorkspace");
API::CatalogManager::Instance()
.getCatalog(getPropertyValue("Session"))
->getDataSets(getProperty("InvestigationId"), workspace);
setProperty("OutputWorkspace", workspace);
}
} // namespace ICat
} // namespace Mantid