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

LogParser parses the instrument log files to select records corresponding to 'RUNNING' instrument status. More...

#include <LogParser.h>

Public Member Functions

Kernel::PropertycreateAllPeriodsLog () const
 Creates a TimeSeriesProperty<int> with all data periods. More...
 
Kernel::PropertycreateCurrentPeriodLog (const int &period) const
 Creates a log value for the current period. More...
 
Kernel::TimeSeriesProperty< bool > * createPeriodLog (int period) const
 Creates a TimeSeriesProperty<bool> showing times when a particular period was active. More...
 
Kernel::TimeSeriesProperty< bool > * createRunningLog () const
 Creates a TimeSeriesProperty<bool> with running status. More...
 
 LogParser (const Kernel::Property *log)
 Create given the icpevent log property. More...
 
int nPeriods () const
 Number of periods. More...
 

Static Public Member Functions

static Kernel::PropertycreateLogProperty (const std::string &logFName, const std::string &name)
 Creates a TimeSeriesProperty of either double or string type depending on the log data Returns a pointer to the created property. More...
 
static const std::string currentPeriodLogName ()
 Returns the name of the log that contains the current period number. More...
 
static const std::string currentPeriodLogName (const int period)
 Returns the name of the log that contains given period filter. More...
 
static bool isICPEventLogNewStyle (const std::multimap< Types::Core::DateAndTime, std::string > &logm)
 Check if the icp log commands are in the new style. More...
 
static const std::string periodsLogName ()
 Returns the name of the log that contains all of the periods. More...
 
static const std::string statusLogName ()
 Returns the name of the log created that defines the status during a run. More...
 

Private Types

using CommandMap = std::map< std::string, commands >
 Typedef for a map of string commands to an enum of strongly typed commands. More...
 
enum class  commands {
  NONE = 0 , BEGIN , END , CHANGE_PERIOD ,
  ABORT
}
 Available commands. More...
 

Private Member Functions

CommandMap createCommandMap (bool newStyle) const
 Creates a map of all available old-style commands. More...
 
void parseNewStyleCommands (const std::multimap< Types::Core::DateAndTime, std::string > &logm, Kernel::TimeSeriesProperty< int > *periods, Kernel::TimeSeriesProperty< bool > *status)
 Parse the icp event log with new style commands. More...
 
void parseOldStyleCommands (const std::multimap< Types::Core::DateAndTime, std::string > &logm, Kernel::TimeSeriesProperty< int > *periods, Kernel::TimeSeriesProperty< bool > *status)
 Parse the icp event log with old style commands. More...
 
void tryParsePeriod (const std::string &scom, const Types::Core::DateAndTime &time, std::istringstream &idata, Kernel::TimeSeriesProperty< int > *const periods)
 Try to parse period data. More...
 

Private Attributes

int m_nOfPeriods
 Number of periods. More...
 
std::shared_ptr< Kernel::Propertym_periods
 TimeSeriesProperty<int> containing data periods. Created by LogParser. More...
 
std::shared_ptr< Kernel::TimeSeriesProperty< bool > > m_status
 TimeSeriesProperty<bool> containing running status. Created by LogParser. More...
 

Detailed Description

LogParser parses the instrument log files to select records corresponding to 'RUNNING' instrument status.

It determines the values of the logged variables at the beginning and the end of each RUNNING interval and keeps track of changes within the interval.

Definition at line 41 of file LogParser.h.

Member Typedef Documentation

◆ CommandMap

using Mantid::Kernel::LogParser::CommandMap = std::map<std::string, commands>
private

Typedef for a map of string commands to an enum of strongly typed commands.

Definition at line 93 of file LogParser.h.

Member Enumeration Documentation

◆ commands

enum class Mantid::Kernel::LogParser::commands
strongprivate

Available commands.

Enumerator
NONE 
BEGIN 
END 
CHANGE_PERIOD 
ABORT 

Definition at line 89 of file LogParser.h.

Constructor & Destructor Documentation

◆ LogParser()

Mantid::Kernel::LogParser::LogParser ( const Kernel::Property log)

Member Function Documentation

◆ createAllPeriodsLog()

Kernel::Property * Mantid::Kernel::LogParser::createAllPeriodsLog ( ) const

Creates a TimeSeriesProperty<int> with all data periods.

Ctreates a TimeSeriesProperty<int> with all data periods.

Definition at line 275 of file LogParser.cpp.

References m_periods.

◆ createCommandMap()

LogParser::CommandMap Mantid::Kernel::LogParser::createCommandMap ( bool  newStyle) const
private

Creates a map of all available old-style commands.

Common creational method for generating a command map.

Better ensures that the same command mapping is available for any constructor.

Parameters
newStyleCommand style selector.
Returns
fully constructed command map.

Definition at line 127 of file LogParser.cpp.

References ABORT, BEGIN, CHANGE_PERIOD, and END.

Referenced by LogParser().

◆ createCurrentPeriodLog()

Kernel::Property * Mantid::Kernel::LogParser::createCurrentPeriodLog ( const int &  period) const

Creates a log value for the current period.

Create a log vale for the current period.

Parameters
periodThe period number to create the log entry for.

Definition at line 268 of file LogParser.cpp.

References currentPeriodLogName().

◆ createLogProperty()

Kernel::Property * Mantid::Kernel::LogParser::createLogProperty ( const std::string &  logFName,
const std::string &  name 
)
static

Creates a TimeSeriesProperty of either double or string type depending on the log data Returns a pointer to the created property.

Reads in log data from a log file and stores them in a TimeSeriesProperty.

Parameters
logFName:: The name of the log file
name:: The name of the property
Returns
A pointer to the created property.

Definition at line 38 of file LogParser.cpp.

References Mantid::Geometry::d, Mantid::Kernel::Logger::error(), Mantid::Kernel::Strings::extractToEOL(), Mantid::Kernel::DateAndTimeHelpers::g_log, tmp, and Mantid::Kernel::Logger::warning().

Referenced by Mantid::DataHandling::LoadLog::loadTwoColumnLogFile().

◆ createPeriodLog()

Kernel::TimeSeriesProperty< bool > * Mantid::Kernel::LogParser::createPeriodLog ( int  period) const

Creates a TimeSeriesProperty<bool> showing times when a particular period was active.

Parameters
period:: The data period
Returns
times requested period was active

Definition at line 242 of file LogParser.cpp.

References Mantid::Kernel::TimeSeriesProperty< TYPE >::addValue(), currentPeriodLogName(), and m_periods.

◆ createRunningLog()

Kernel::TimeSeriesProperty< bool > * Mantid::Kernel::LogParser::createRunningLog ( ) const

Creates a TimeSeriesProperty<bool> with running status.

Definition at line 278 of file LogParser.cpp.

References m_status.

◆ currentPeriodLogName() [1/2]

static const std::string Mantid::Kernel::LogParser::currentPeriodLogName ( )
inlinestatic

Returns the name of the log that contains the current period number.

Definition at line 44 of file LogParser.h.

Referenced by Mantid::DataHandling::ISISRunLogs::applyLogFiltering(), createCurrentPeriodLog(), and createPeriodLog().

◆ currentPeriodLogName() [2/2]

const std::string Mantid::Kernel::LogParser::currentPeriodLogName ( const int  period)
static

Returns the name of the log that contains given period filter.

Definition at line 258 of file LogParser.cpp.

◆ isICPEventLogNewStyle()

bool Mantid::Kernel::LogParser::isICPEventLogNewStyle ( const std::multimap< Types::Core::DateAndTime, std::string > &  logm)
static

Check if the icp log commands are in the new style.

The new style is the one that uses START_COLLECTION and STOP_COLLECTION commands for changing periods and running status.

Parameters
logm:: A log map created from a icp-event log.

Definition at line 295 of file LogParser.cpp.

Referenced by LogParser().

◆ nPeriods()

int Mantid::Kernel::LogParser::nPeriods ( ) const
inline

Number of periods.

Definition at line 64 of file LogParser.h.

◆ parseNewStyleCommands()

void Mantid::Kernel::LogParser::parseNewStyleCommands ( const std::multimap< Types::Core::DateAndTime, std::string > &  logm,
Kernel::TimeSeriesProperty< int > *  periods,
Kernel::TimeSeriesProperty< bool > *  status 
)
private

Parse the icp event log with new style commands.

◆ parseOldStyleCommands()

void Mantid::Kernel::LogParser::parseOldStyleCommands ( const std::multimap< Types::Core::DateAndTime, std::string > &  logm,
Kernel::TimeSeriesProperty< int > *  periods,
Kernel::TimeSeriesProperty< bool > *  status 
)
private

Parse the icp event log with old style commands.

◆ periodsLogName()

static const std::string Mantid::Kernel::LogParser::periodsLogName ( )
inlinestatic

◆ statusLogName()

static const std::string Mantid::Kernel::LogParser::statusLogName ( )
inlinestatic

◆ tryParsePeriod()

void Mantid::Kernel::LogParser::tryParsePeriod ( const std::string &  scom,
const Types::Core::DateAndTime &  time,
std::istringstream &  idata,
Kernel::TimeSeriesProperty< int > *const  periods 
)
private

Try to parse period data.

Try to pass the periods.

Parameters
scom: The command corresponding to a change in period.
time: The time
idata: stream of input data
periods: periods data to update

Definition at line 158 of file LogParser.cpp.

References Mantid::Kernel::TimeSeriesProperty< TYPE >::addValue(), and m_nOfPeriods.

Referenced by LogParser().

Member Data Documentation

◆ m_nOfPeriods

int Mantid::Kernel::LogParser::m_nOfPeriods
private

Number of periods.

Definition at line 102 of file LogParser.h.

Referenced by LogParser(), and tryParsePeriod().

◆ m_periods

std::shared_ptr<Kernel::Property> Mantid::Kernel::LogParser::m_periods
private

TimeSeriesProperty<int> containing data periods. Created by LogParser.

Definition at line 96 of file LogParser.h.

Referenced by createAllPeriodsLog(), createPeriodLog(), and LogParser().

◆ m_status

std::shared_ptr<Kernel::TimeSeriesProperty<bool> > Mantid::Kernel::LogParser::m_status
private

TimeSeriesProperty<bool> containing running status. Created by LogParser.

Definition at line 99 of file LogParser.h.

Referenced by createRunningLog(), and LogParser().


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