7#if GCC_VERSION >= 40800
11#if GCC_VERSION >= 40800
23#include <boost/algorithm/string/regex.hpp>
31 auto isDate = std::make_shared<Kernel::DateValidator>();
35 declareProperty(
"InvestigationName",
"",
"The name of the investigation to search for.");
36 declareProperty(
"Instrument",
"",
"The name of the instrument used in the investigation.");
37 declareProperty(
"RunRange",
"",
38 "The range of runs to search for related "
39 "investigations. Must be in the format "
40 "0000-0000 or 0000:0000.");
41 declareProperty(
"StartDate",
"", isDate,
42 "The start date for the range of "
43 "investigations to be searched. The "
44 "format must be DD/MM/YYYY.");
45 declareProperty(
"EndDate",
"", isDate,
46 "The end date for the range of "
47 "investigations to be searched. The "
48 "format must be DD/MM/YYYY.");
49 declareProperty(
"Keywords",
"",
"A comma separated list of words to search for in the investigation.");
50 declareProperty(
"InvestigationId",
"",
"The ID of the investigation.");
51 declareProperty(
"InvestigatorSurname",
"",
"The surname of the investigator associated to the investigation.");
52 declareProperty(
"SampleName",
"",
"The name of the sample used in the investigation.");
53 declareProperty(
"DataFileName",
"",
"The name of the data file in the investigation.");
54 declareProperty(
"InvestigationType",
"",
"The type of the investigation.");
55 declareProperty(
"MyData",
false,
56 "If set to true, only search in "
57 "investigations of which you are an "
58 "investigator, e.g. 'My Data'.");
62 declareProperty(
"CountOnly",
false,
"Boolean option to perform COUNT search only. This is used for paging.");
63 declareProperty<int>(
"Limit", 100,
64 "The maximum amount of search results to "
65 "return. Adds a LIMIT clause to the "
66 "query. This is used for paging.");
67 declareProperty<int>(
"Offset", 0,
"The location to begin returning results from. This is used for paging.");
69 declareProperty(
"Session",
"",
"The session information of the catalog search in.");
73 "The name of the workspace that will be created to store the "
75 declareProperty<int64_t>(
"NumberOfSearchResults", 0,
76 "The number of search results returned for the "
77 "INPUT. Performs a COUNT query to determine this. "
78 "This is used for paging.",
97 setProperty(
"NumberOfSearchResults", catalogs->getNumberOfSearchResults(params));
133 std::vector<std::string> runNumbers;
135 boost::algorithm::split_regex(runNumbers, runRange, boost::regex(
"-|:"));
137 double startRange = 0;
141 if (!runNumbers.at(0).empty()) {
142 startRange = boost::lexical_cast<double>(runNumbers.at(0));
145 endRange = boost::lexical_cast<double>(runNumbers.at(0));
150 if (runNumbers.size() == 2) {
152 if (!runNumbers.at(1).empty()) {
153 endRange = boost::lexical_cast<double>(runNumbers.at(1));
156 if (startRange == 0) {
157 startRange = boost::lexical_cast<double>(runNumbers.at(1));
162 if (startRange > endRange) {
163 throw std::runtime_error(
"Run end number cannot be lower than run start number.");
#define DECLARE_ALGORITHM(classname)
IPeaksWorkspace_sptr workspace
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
This class is used in Catalog Search service to set/get all the inputs to search for.
void setKeywords(const std::string &keywords)
Set the keywords to search for.
void setSampleName(const std::string &sampleName)
Set the sample name to search for.
void setInvestigationId(const std::string &)
Set the investigation id to search for.
time_t getTimevalue(const std::string &inputDate)
Saves the start/end date times to time_t value.
void setRunEnd(const double &endRun)
Set the end run to search for.
void setDatafileName(const std::string &datafileName)
Set the datafile name to search for.
void setInvestigatorSurName(const std::string &investigatorName)
Set the investigators name to search for.
void setInvestigationName(const std::string &instName)
Set the investigation name to search for.
void setInstrument(const std::string &instrName)
Set the instrument to search for.
void setRunStart(const double &startRun)
Set the start run to search for.
void setStartDate(const time_t &startDate)
Set the start date to search for.
void setEndDate(const time_t &endDate)
Set the end date to search for.
void setInvestigationType(const std::string &invstType)
Set the investigation type to search for.
void setMyData(bool flag)
Set the "my data only" flag to search only user's data if true.
This class is responsible for searching the catalog using the properties specified.
void getInputProperties(CatalogSearchParam ¶ms)
Get all inputs for the algorithm.
void exec() override
Overwrites Algorithm exec method.
void setRunRanges(std::string &runRange, CatalogSearchParam ¶ms)
Parse the run-range input field, split it into start and end run, and set related parameters.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
@ Output
An output workspace.