Mantid
|
LogFilterGenerator : utility to generate a LogFilter, to filter by running status or period. More...
#include <LogFilterGenerator.h>
Public Types | |
enum class | FilterType { None , Status , Period , StatusAndPeriod } |
Types of filter that can be used. More... | |
Public Member Functions | |
std::unique_ptr< Mantid::Kernel::LogFilter > | generateFilter (const std::string &logName) const |
Generate log filter from given workspace and log name. More... | |
LogFilterGenerator (const FilterType filterType, const Mantid::API::MatrixWorkspace_const_sptr &workspace) | |
Constructor taking workspace. More... | |
LogFilterGenerator (const FilterType filterType, const Mantid::API::Run &run) | |
Constructor taking run object. More... | |
Private Member Functions | |
void | filterByPeriod (Mantid::Kernel::LogFilter *filter) const |
Filter log by period. More... | |
void | filterByStatus (Mantid::Kernel::LogFilter *filter) const |
Filter log by "running" status. More... | |
Mantid::Kernel::Property * | getLogData (const std::string &logName, bool warnIfNotFound=true) const |
Get log data from workspace. More... | |
Private Attributes | |
const FilterType | m_filterType |
Type of filter. More... | |
const Mantid::API::Run | m_run |
Run object containing logs. More... | |
LogFilterGenerator : utility to generate a LogFilter, to filter by running status or period.
This was refactored out of MantidUI::importNumSeriesLog
Definition at line 24 of file LogFilterGenerator.h.
|
strong |
Types of filter that can be used.
Enumerator | |
---|---|
None | |
Status | |
Period | |
StatusAndPeriod |
Definition at line 27 of file LogFilterGenerator.h.
Mantid::API::LogFilterGenerator::LogFilterGenerator | ( | const FilterType | filterType, |
const Mantid::API::MatrixWorkspace_const_sptr & | workspace | ||
) |
Constructor taking workspace.
Constructor.
filterType | :: [input] Filter by status, period, both or neither |
workspace | :: [input] Workspace containing log data |
Definition at line 28 of file LogFilterGenerator.cpp.
Mantid::API::LogFilterGenerator::LogFilterGenerator | ( | const FilterType | filterType, |
const Mantid::API::Run & | run | ||
) |
Constructor taking run object.
Constructor.
filterType | :: [input] Filter by status, period, both or neither |
run | :: [input] Run containing log data |
Definition at line 37 of file LogFilterGenerator.cpp.
|
private |
Filter log by period.
Adds filters to the given LogFilter based on the first "period *" log in the workspace.
If no such log is present, does nothing.
filter | :: [input, output] LogFilter to which filter will be added |
Definition at line 108 of file LogFilterGenerator.cpp.
References Mantid::Kernel::LogFilter::addFilter(), Mantid::API::g_log, Mantid::API::LogManager::getLogData(), m_run, and Mantid::Kernel::Logger::warning().
Referenced by generateFilter().
|
private |
Filter log by "running" status.
Adds a filter to the given LogFilter based on the "running" status log of the workspace.
If that log is not present, does nothing. If the filter records start later than the data, add a value of "not running" at the start.
filter | :: [input, output] LogFilter to which filter will be added |
Definition at line 83 of file LogFilterGenerator.cpp.
References Mantid::Kernel::LogFilter::addFilter(), Mantid::Kernel::TimeSeriesProperty< TYPE >::addValue(), Mantid::Kernel::LogFilter::data(), getLogData(), and Mantid::Kernel::TimeSeriesProperty< TYPE >::valueAsCorrectMap().
Referenced by generateFilter().
std::unique_ptr< LogFilter > Mantid::API::LogFilterGenerator::generateFilter | ( | const std::string & | logName | ) | const |
Generate log filter from given workspace and log name.
logName | :: [input] Name of log to generate filter for |
Definition at line 45 of file LogFilterGenerator.cpp.
References filterByPeriod(), filterByStatus(), getLogData(), m_filterType, None, Period, Status, and StatusAndPeriod.
|
private |
Get log data from workspace.
logName | :: [input] Name of log to get |
warnIfNotFound | :: If true log a warning if the sample log is not found, otherwise do not log a warning |
Definition at line 136 of file LogFilterGenerator.cpp.
References Mantid::API::g_log, Mantid::API::LogManager::getLogData(), m_run, and Mantid::Kernel::Logger::warning().
Referenced by filterByStatus(), and generateFilter().
|
private |
|
private |
Run object containing logs.
Definition at line 48 of file LogFilterGenerator.h.
Referenced by filterByPeriod(), and getLogData().