Commit c67a6f25 authored by Nick Draper's avatar Nick Draper
Browse files

Updates following code review

parent af309c2b
......@@ -44,7 +44,7 @@ class MANTID_API_DLL LogManager {
public:
// Gets the correct log name for the matching invalid values log for a given
// log name
static std::string getInvalidValuesFilterLogName(const std::string logName);
static std::string getInvalidValuesFilterLogName(const std::string& logName);
LogManager();
LogManager(const LogManager &other);
......@@ -189,12 +189,12 @@ public:
void clearLogs();
// returns true if the log has a matching invalid values log filter
bool hasInvalidValuesFilter(const std::string logName) const;
bool hasInvalidValuesFilter(const std::string& logName) const;
// returns the invalid values log if the log has a matching invalid values log
// filter
Kernel::TimeSeriesProperty<bool> *
getInvalidValuesFilter(const std::string logName) const;
getInvalidValuesFilter(const std::string& logName) const;
bool operator==(const LogManager &other) const;
bool operator!=(const LogManager &other) const;
......
......@@ -555,19 +555,19 @@ void LogManager::clearLogs() { m_manager->clear(); }
/// Gets the correct log name for the matching invalid values log for a given
/// log name
std::string
LogManager::getInvalidValuesFilterLogName(const std::string logName) {
LogManager::getInvalidValuesFilterLogName(const std::string& logName) {
return PropertyManager::getInvalidValuesFilterLogName(logName);
}
/// returns true if the log has a matching invalid values log filter
bool LogManager::hasInvalidValuesFilter(const std::string logName) const {
bool LogManager::hasInvalidValuesFilter(const std::string& logName) const {
return hasProperty(getInvalidValuesFilterLogName(logName));
}
/// returns the invalid values log if the log has a matching invalid values log
/// filter
Kernel::TimeSeriesProperty<bool> *
LogManager::getInvalidValuesFilter(const std::string logName) const {
LogManager::getInvalidValuesFilter(const std::string& logName) const {
try {
auto log = getLogData(getInvalidValuesFilterLogName(logName));
if (auto tsp = dynamic_cast<TimeSeriesProperty<bool> *>(log)) {
......
......@@ -295,11 +295,10 @@ std::unique_ptr<Kernel::Property> createTimeSeries(::NeXus::File &file,
*/
std::unique_ptr<Kernel::Property>
createTimeSeriesValidityFilter(::NeXus::File &file,
const std::unique_ptr<Kernel::Property> &prop,
const Kernel::Property &prop,
Kernel::Logger &log) {
;
auto tsProp = dynamic_cast<Kernel::ITimeSeriesProperty *>(prop.get());
auto times = tsProp->timesAsVector();
const auto tsProp = dynamic_cast<const Kernel::ITimeSeriesProperty *>(&prop);
const auto times = tsProp->timesAsVector();
std::vector<int> values;
std::vector<bool> boolValues;
// Now the the validity of the values
......@@ -347,8 +346,8 @@ createTimeSeriesValidityFilter(::NeXus::File &file,
}
}
if (invalidDataFound) {
log.warning() << "Some \"" << prop->name() << "\" log data is invalid!\n";
auto tspName = API::LogManager::getInvalidValuesFilterLogName(prop->name());
log.warning() << "Some \"" << prop.name() << "\" log data is invalid!\n";
const auto tspName = API::LogManager::getInvalidValuesFilterLogName(prop.name());
auto tsp = std::make_unique<TimeSeriesProperty<bool>>(tspName);
tsp->create(times, boolValues);
log.debug() << " done reading \"value_valid\" array\n";
......@@ -850,7 +849,7 @@ void LoadNexusLogs::loadNXLog(
if (overwritelogs || !(workspace->run().hasProperty(entry_name))) {
auto logValue = createTimeSeries(file, entry_name, freqStart, g_log);
auto validityLogValue =
createTimeSeriesValidityFilter(file, logValue, g_log);
createTimeSeriesValidityFilter(file, *logValue, g_log);
if (validityLogValue) {
appendEndTimeLog(validityLogValue.get(), workspace->run());
workspace->mutableRun().addProperty(std::move(validityLogValue),
......@@ -915,7 +914,7 @@ void LoadNexusLogs::loadSELog(
logValue = createTimeSeries(file, propName, freqStart, g_log);
auto validityLogValue =
createTimeSeriesValidityFilter(file, logValue, g_log);
createTimeSeriesValidityFilter(file, *logValue, g_log);
if (validityLogValue) {
appendEndTimeLog(validityLogValue.get(), workspace->run());
workspace->mutableRun().addProperty(std::move(validityLogValue));
......
......@@ -44,10 +44,10 @@ public:
static const std::string INVALID_VALUES_SUFFIX;
// Gets the correct log name for the matching invalid values log for a given
// log name
static std::string getInvalidValuesFilterLogName(const std::string logName);
static std::string getInvalidValuesFilterLogName(const std::string& logName);
static std::string
getLogNameFromInvalidValuesFilter(const std::string logName);
static bool isAnInvalidValuesFilterLog(const std::string logName);
getLogNameFromInvalidValuesFilter(const std::string& logName);
static bool isAnInvalidValuesFilterLog(const std::string& logName);
PropertyManager();
PropertyManager(const PropertyManager &);
......
......@@ -41,11 +41,11 @@ const std::string PropertyManager::INVALID_VALUES_SUFFIX = "_invalid_values";
/// Gets the correct log name for the matching invalid values log for a given
/// log name
std::string
PropertyManager::getInvalidValuesFilterLogName(const std::string logName) {
PropertyManager::getInvalidValuesFilterLogName(const std::string& logName) {
return logName + PropertyManager::INVALID_VALUES_SUFFIX;
}
std::string
PropertyManager::getLogNameFromInvalidValuesFilter(const std::string logName) {
PropertyManager::getLogNameFromInvalidValuesFilter(const std::string& logName) {
std::string retVal = "";
if (PropertyManager::isAnInvalidValuesFilterLog(logName)) {
retVal = logName.substr(
......@@ -53,7 +53,7 @@ PropertyManager::getLogNameFromInvalidValuesFilter(const std::string logName) {
}
return retVal;
}
bool PropertyManager::isAnInvalidValuesFilterLog(const std::string logName) {
bool PropertyManager::isAnInvalidValuesFilterLog(const std::string& logName) {
const auto fullString = logName;
const auto ending = PropertyManager::INVALID_VALUES_SUFFIX;
if (fullString.length() >= ending.length()) {
......@@ -220,7 +220,7 @@ void PropertyManager::filterByProperty(
if (this->existsProperty(PropertyManager::getInvalidValuesFilterLogName(
currentProp->name()))) {
// add the filter to the passed in filters
std::unique_ptr<LogFilter> logFilter =
auto logFilter =
std::make_unique<LogFilter>(filter);
auto filterProp =
getPointerToProperty(PropertyManager::getInvalidValuesFilterLogName(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment