Mantid
Loading...
Searching...
No Matches
CompositeCatalog.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 +
8
9#include <stdexcept>
10
11namespace Mantid::API {
13
18void CompositeCatalog::add(const ICatalog_sptr &catalog) { m_catalogs.emplace_back(catalog); }
19
27CatalogSession_sptr CompositeCatalog::login(const std::string &username, const std::string &password,
28 const std::string &endpoint, const std::string &facility) {
29 UNUSED_ARG(username);
30 UNUSED_ARG(password);
31 UNUSED_ARG(endpoint);
32 UNUSED_ARG(facility);
33 throw std::runtime_error("You cannot log into multiple catalogs at the same time.");
34}
35
40 for (auto &catalog : m_catalogs) {
41 catalog->logout();
42 }
43}
44
54void CompositeCatalog::search(const ICat::CatalogSearchParam &inputs, ITableWorkspace_sptr &outputws, const int &offset,
55 const int &limit) {
56 for (auto &catalog : m_catalogs) {
57 catalog->search(inputs, outputws, offset, limit);
58 }
59}
60
66 int64_t numberOfSearchResults = 0;
67 for (auto &catalog : m_catalogs) {
68 numberOfSearchResults += catalog->getNumberOfSearchResults(inputs);
69 }
70 return numberOfSearchResults;
71}
72
79 for (auto &catalog : m_catalogs) {
80 catalog->myData(outputws);
81 }
82}
83
90void CompositeCatalog::getDataSets(const std::string &investigationId, ITableWorkspace_sptr &outputws) {
91 for (auto &catalog : m_catalogs) {
92 catalog->getDataSets(investigationId, outputws);
93 }
94}
95
102void CompositeCatalog::getDataFiles(const std::string &investigationId, ITableWorkspace_sptr &outputws) {
103 for (auto &catalog : m_catalogs) {
104 catalog->getDataFiles(investigationId, outputws);
105 }
106}
107
112void CompositeCatalog::listInstruments(std::vector<std::string> &instruments) {
113 for (auto &catalog : m_catalogs) {
114 catalog->listInstruments(instruments);
115 }
116}
117
122void CompositeCatalog::listInvestigationTypes(std::vector<std::string> &invstTypes) {
123 for (auto &catalog : m_catalogs) {
124 catalog->listInvestigationTypes(invstTypes);
125 }
126}
127
132 for (auto &catalog : m_catalogs) {
133 catalog->keepAlive();
134 }
135}
136} // namespace Mantid::API
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
void logout() override
Log the user out of the catalog system.
void keepAlive() override
Keep current session alive.
void listInstruments(std::vector< std::string > &instruments) override
Get instruments list.
void myData(ITableWorkspace_sptr &outputws) override
Show the logged in user's investigations search results.
void getDataSets(const std::string &investigationId, ITableWorkspace_sptr &outputws) override
Get datasets.
int64_t getNumberOfSearchResults(const ICat::CatalogSearchParam &inputs) override
Obtain the number of results returned by the search method.
void search(const ICat::CatalogSearchParam &inputs, ITableWorkspace_sptr &outputws, const int &offset, const int &limit) override
Search the catalog for data.
void listInvestigationTypes(std::vector< std::string > &invstTypes) override
Get investigationtypes list.
void getDataFiles(const std::string &investigationId, ITableWorkspace_sptr &outputws) override
Get datafiles.
void add(const ICatalog_sptr &catalog)
Adds a catalog to the list of catalogs (m_catalogs)
CatalogSession_sptr login(const std::string &username, const std::string &password, const std::string &endpoint, const std::string &facility) override
Log the user into the catalog system.
std::list< ICatalog_sptr > m_catalogs
This class is used in Catalog Search service to set/get all the inputs to search for.
std::shared_ptr< CatalogSession > CatalogSession_sptr
std::shared_ptr< ICatalog > ICatalog_sptr
Definition: ICatalog.h:55
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace