Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::API::LogFilterGenerator Class Reference

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::LogFiltergenerateFilter (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::PropertygetLogData (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...
 

Detailed Description

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.

Member Enumeration Documentation

◆ FilterType

Types of filter that can be used.

Enumerator
None 
Status 
Period 
StatusAndPeriod 

Definition at line 27 of file LogFilterGenerator.h.

Constructor & Destructor Documentation

◆ LogFilterGenerator() [1/2]

Mantid::API::LogFilterGenerator::LogFilterGenerator ( const FilterType  filterType,
const Mantid::API::MatrixWorkspace_const_sptr workspace 
)

Constructor taking workspace.

Constructor.

Parameters
filterType:: [input] Filter by status, period, both or neither
workspace:: [input] Workspace containing log data

Definition at line 28 of file LogFilterGenerator.cpp.

◆ LogFilterGenerator() [2/2]

Mantid::API::LogFilterGenerator::LogFilterGenerator ( const FilterType  filterType,
const Mantid::API::Run run 
)

Constructor taking run object.

Constructor.

Parameters
filterType:: [input] Filter by status, period, both or neither
run:: [input] Run containing log data

Definition at line 37 of file LogFilterGenerator.cpp.

Member Function Documentation

◆ filterByPeriod()

void Mantid::API::LogFilterGenerator::filterByPeriod ( Mantid::Kernel::LogFilter filter) const
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.

Parameters
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().

◆ filterByStatus()

void Mantid::API::LogFilterGenerator::filterByStatus ( Mantid::Kernel::LogFilter filter) const
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.

Parameters
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().

◆ generateFilter()

std::unique_ptr< LogFilter > Mantid::API::LogFilterGenerator::generateFilter ( const std::string &  logName) const

Generate log filter from given workspace and log name.

Parameters
logName:: [input] Name of log to generate filter for
Returns
:: LogFilter with selected options

Definition at line 45 of file LogFilterGenerator.cpp.

References filterByPeriod(), filterByStatus(), getLogData(), m_filterType, None, Period, Status, and StatusAndPeriod.

◆ getLogData()

Property * Mantid::API::LogFilterGenerator::getLogData ( const std::string &  logName,
bool  warnIfNotFound = true 
) const
private

Get log data from workspace.

Parameters
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
Returns
:: Pointer to log, or null if log does not exist in workspace

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().

Member Data Documentation

◆ m_filterType

const FilterType Mantid::API::LogFilterGenerator::m_filterType
private

Type of filter.

Definition at line 46 of file LogFilterGenerator.h.

Referenced by generateFilter().

◆ m_run

const Mantid::API::Run Mantid::API::LogFilterGenerator::m_run
private

Run object containing logs.

Definition at line 48 of file LogFilterGenerator.h.

Referenced by filterByPeriod(), and getLogData().


The documentation for this class was generated from the following files: