Skip to content

Commit

Permalink
Change the name of the constant to make windows happy
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Feb 10, 2023
1 parent 600cd47 commit 9a1ecef
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Framework/Kernel/src/TimeSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Kernel {

namespace {
// every value less than zero is ignore
constexpr int IGNORE{-1};
constexpr int IGNORE_VALUE{-1};
// default value for the output is zero
constexpr int DEFAULT_VALUE{0};

Expand Down Expand Up @@ -51,9 +51,9 @@ void TimeSplitter::addROI(const Types::Core::DateAndTime &start, const Types::Co
clearAndReplace(start, stop, value);
} else if ((stop < m_roi_map.begin()->first) || (start > m_roi_map.rbegin()->first)) {
// adding to one end or the other
if (value > IGNORE) { // only add non-ignore values
if (value > IGNORE_VALUE) { // only add non-ignore values
m_roi_map.insert({start, value});
m_roi_map.insert({stop, IGNORE});
m_roi_map.insert({stop, IGNORE_VALUE});
}
} else {
// do the interesting version
Expand All @@ -71,7 +71,7 @@ void TimeSplitter::addROI(const Types::Core::DateAndTime &start, const Types::Co

// the end is one past the "stop"
auto stopIterator = m_roi_map.upper_bound(stop);
if ((stopIterator != m_roi_map.end()) && (stopValue == IGNORE))
if ((stopIterator != m_roi_map.end()) && (stopValue == IGNORE_VALUE))
stopIterator++; // move to the one after

const bool atStart = (startIterator == m_roi_map.begin());
Expand All @@ -80,7 +80,7 @@ void TimeSplitter::addROI(const Types::Core::DateAndTime &start, const Types::Co
m_roi_map.erase(startIterator, stopIterator);

// put in the new elements
if ((value > IGNORE) || (!atStart)) {
if ((value > IGNORE_VALUE) || (!atStart)) {
if (value != this->valueAtTime(start)) {
m_roi_map.insert({start, value});
}
Expand All @@ -95,8 +95,8 @@ void TimeSplitter::addROI(const Types::Core::DateAndTime &start, const Types::Co
m_roi_map.insert({stop, stopValue});
}

// verify this ends with IGNORE
if (m_roi_map.rbegin()->second != IGNORE) {
// verify this ends with IGNORE_VALUE
if (m_roi_map.rbegin()->second != IGNORE_VALUE) {
throw std::runtime_error("Something went wrong in TimeSplitter::addROI");
}
}
Expand All @@ -107,18 +107,18 @@ void TimeSplitter::clearAndReplace(const Types::Core::DateAndTime &start, const
m_roi_map.clear();
if (value >= 0) {
m_roi_map.insert({start, value});
m_roi_map.insert({stop, IGNORE});
m_roi_map.insert({stop, IGNORE_VALUE});
}
}

int TimeSplitter::valueAtTime(const Types::Core::DateAndTime &time) const {
if (m_roi_map.empty())
return IGNORE;
return IGNORE_VALUE;
if (time < m_roi_map.begin()->first)
return IGNORE;
return IGNORE_VALUE;

// this method can be used when the object is in an unusual state and doesn't
// end with IGNORE
// end with IGNORE_VALUE

// find location that is greater than or equal to the requested time and give
// back previous value
Expand All @@ -129,7 +129,7 @@ int TimeSplitter::valueAtTime(const Types::Core::DateAndTime &time) const {
} else if (location == m_roi_map.begin()) {
// iterator is greater than the first value in the map b/c equal is already
// handled asked for a time outside of the map
return IGNORE;
return IGNORE_VALUE;
} else {
// go to the value before
location--;
Expand All @@ -146,7 +146,7 @@ std::vector<int> TimeSplitter::outputWorkspaceIndices() const {

// copy all of the (not ignore) output workspace indices
for (const auto iter : m_roi_map) {
if (iter.second > IGNORE)
if (iter.second > IGNORE_VALUE)
outputSet.insert(iter.second);
}

Expand All @@ -161,8 +161,8 @@ std::vector<int> TimeSplitter::outputWorkspaceIndices() const {
*/
TimeROI TimeSplitter::getTimeROI(const int workspaceIndex) {
TimeROI output;
// only build a result if this is not the IGNORE
if (workspaceIndex > IGNORE) {
// only build a result if this is not the IGNORE_VALUE
if (workspaceIndex > IGNORE_VALUE) {
using map_value_type = std::map<DateAndTime, int>::value_type;
auto indexFinder = [workspaceIndex](const map_value_type &value) { return value.second == workspaceIndex; };
// find the first place this workspace index exists
Expand Down

0 comments on commit 9a1ecef

Please # to comment.