Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
39a6998d
Commit
39a6998d
authored
Mar 20, 2020
by
David Fairbrother
Browse files
Fix Cppcheck warnings for 1.90
parent
a200387f
Changes
117
Hide whitespace changes
Inline
Side-by-side
Framework/API/src/Expression.cpp
View file @
39a6998d
...
@@ -117,8 +117,8 @@ Expression &Expression::operator=(const Expression &expr) {
...
@@ -117,8 +117,8 @@ Expression &Expression::operator=(const Expression &expr) {
m_funct
=
expr
.
m_funct
;
m_funct
=
expr
.
m_funct
;
m_op
=
expr
.
m_op
;
m_op
=
expr
.
m_op
;
m_terms
=
expr
.
m_terms
;
m_terms
=
expr
.
m_terms
;
//
m_expr = expr.m_expr;
m_expr
=
expr
.
m_expr
;
//
m_tokens = expr.m_tokens;
m_tokens
=
expr
.
m_tokens
;
return
*
this
;
return
*
this
;
}
}
...
...
Framework/API/src/IFunction.cpp
View file @
39a6998d
...
@@ -559,10 +559,11 @@ std::vector<std::string> IFunction::getParameterNames() const {
...
@@ -559,10 +559,11 @@ std::vector<std::string> IFunction::getParameterNames() const {
* @param handler :: A new handler
* @param handler :: A new handler
*/
*/
void
IFunction
::
setHandler
(
std
::
unique_ptr
<
FunctionHandler
>
handler
)
{
void
IFunction
::
setHandler
(
std
::
unique_ptr
<
FunctionHandler
>
handler
)
{
m_handler
=
std
::
move
(
handler
);
if
(
handler
&&
handler
->
function
().
get
()
!=
this
)
{
if
(
handler
&&
handler
->
function
().
get
()
!=
this
)
{
throw
std
::
runtime_error
(
"Function handler points to a different function"
);
throw
std
::
runtime_error
(
"Function handler points to a different function"
);
}
}
m_handler
=
std
::
move
(
handler
);
m_handler
->
init
();
m_handler
->
init
();
}
}
...
@@ -661,6 +662,7 @@ private:
...
@@ -661,6 +662,7 @@ private:
/// @param attr :: The attribute to copy from.
/// @param attr :: The attribute to copy from.
IFunction
::
Attribute
&
IFunction
::
Attribute
::
operator
=
(
const
Attribute
&
attr
)
{
IFunction
::
Attribute
&
IFunction
::
Attribute
::
operator
=
(
const
Attribute
&
attr
)
{
m_data
=
attr
.
m_data
;
m_data
=
attr
.
m_data
;
m_quoteValue
=
attr
.
m_quoteValue
;
return
*
this
;
return
*
this
;
}
}
...
...
Framework/API/src/IndexProperty.cpp
View file @
39a6998d
...
@@ -78,7 +78,6 @@ Indexing::SpectrumIndexSet IndexProperty::getIndices() const {
...
@@ -78,7 +78,6 @@ Indexing::SpectrumIndexSet IndexProperty::getIndices() const {
static_cast
<
Indexing
::
SpectrumNumber
>
(
static_cast
<
int32_t
>
(
max
)));
static_cast
<
Indexing
::
SpectrumNumber
>
(
static_cast
<
int32_t
>
(
max
)));
}
}
}
else
{
}
else
{
// cppcheck-suppress constArgument
MSVC_DIAG_OFF
(
4244
);
MSVC_DIAG_OFF
(
4244
);
switch
(
type
)
{
switch
(
type
)
{
case
IndexType
::
WorkspaceIndex
:
case
IndexType
::
WorkspaceIndex
:
...
...
Framework/API/src/MatrixWorkspace.cpp
View file @
39a6998d
...
@@ -1940,8 +1940,6 @@ MatrixWorkspace::findY(double value,
...
@@ -1940,8 +1940,6 @@ MatrixWorkspace::findY(double value,
if
(
std
::
isnan
(
value
))
{
if
(
std
::
isnan
(
value
))
{
for
(
int64_t
i
=
idx
.
first
;
i
<
numHists
;
++
i
)
{
for
(
int64_t
i
=
idx
.
first
;
i
<
numHists
;
++
i
)
{
const
auto
&
Y
=
this
->
y
(
i
);
const
auto
&
Y
=
this
->
y
(
i
);
// https://trac.cppcheck.net/ticket/9237 if init buggy with cppcheck
// cppcheck-suppress stlIfFind
if
(
auto
it
=
std
::
find_if
(
std
::
next
(
Y
.
begin
(),
idx
.
second
),
Y
.
end
(),
if
(
auto
it
=
std
::
find_if
(
std
::
next
(
Y
.
begin
(),
idx
.
second
),
Y
.
end
(),
[](
double
v
)
{
return
std
::
isnan
(
v
);
});
[](
double
v
)
{
return
std
::
isnan
(
v
);
});
it
!=
Y
.
end
())
{
it
!=
Y
.
end
())
{
...
@@ -1952,7 +1950,6 @@ MatrixWorkspace::findY(double value,
...
@@ -1952,7 +1950,6 @@ MatrixWorkspace::findY(double value,
}
else
{
}
else
{
for
(
int64_t
i
=
idx
.
first
;
i
<
numHists
;
++
i
)
{
for
(
int64_t
i
=
idx
.
first
;
i
<
numHists
;
++
i
)
{
const
auto
&
Y
=
this
->
y
(
i
);
const
auto
&
Y
=
this
->
y
(
i
);
// cppcheck-suppress stlIfFind
if
(
auto
it
=
std
::
find
(
std
::
next
(
Y
.
begin
(),
idx
.
second
),
Y
.
end
(),
value
);
if
(
auto
it
=
std
::
find
(
std
::
next
(
Y
.
begin
(),
idx
.
second
),
Y
.
end
(),
value
);
it
!=
Y
.
end
())
{
it
!=
Y
.
end
())
{
out
=
{
i
,
std
::
distance
(
Y
.
begin
(),
it
)};
out
=
{
i
,
std
::
distance
(
Y
.
begin
(),
it
)};
...
...
Framework/API/src/ParamFunction.cpp
View file @
39a6998d
...
@@ -150,7 +150,7 @@ double ParamFunction::getParameter(const std::string &name) const {
...
@@ -150,7 +150,7 @@ double ParamFunction::getParameter(const std::string &name) const {
*/
*/
bool
ParamFunction
::
hasParameter
(
const
std
::
string
&
name
)
const
{
bool
ParamFunction
::
hasParameter
(
const
std
::
string
&
name
)
const
{
return
std
::
find
(
m_parameterNames
.
cbegin
(),
m_parameterNames
.
cend
(),
name
)
!=
return
std
::
find
(
m_parameterNames
.
cbegin
(),
m_parameterNames
.
cend
(),
name
)
!=
m_parameterNames
.
end
();
m_parameterNames
.
c
end
();
}
}
/**
/**
...
...
Framework/API/test/AlgorithmFactoryTest.h
View file @
39a6998d
...
@@ -186,7 +186,7 @@ public:
...
@@ -186,7 +186,7 @@ public:
foundAlg
=
(
"Cat"
==
descItr
->
category
)
&&
foundAlg
=
(
"Cat"
==
descItr
->
category
)
&&
(
"ToyAlgorithm"
==
descItr
->
name
)
&&
(
"ToyAlgorithm"
==
descItr
->
name
)
&&
(
"Dog"
==
descItr
->
alias
)
&&
(
1
==
descItr
->
version
);
(
"Dog"
==
descItr
->
alias
)
&&
(
1
==
descItr
->
version
);
descItr
++
;
++
descItr
;
}
}
TS_ASSERT
(
foundAlg
);
TS_ASSERT
(
foundAlg
);
...
...
Framework/API/test/FunctionPropertyTest.h
View file @
39a6998d
...
@@ -104,7 +104,6 @@ public:
...
@@ -104,7 +104,6 @@ public:
void
test_Shared_Pointer
()
{
void
test_Shared_Pointer
()
{
FunctionProperty
prop
(
"fun"
);
FunctionProperty
prop
(
"fun"
);
std
::
string
error
;
boost
::
shared_ptr
<
FunctionPropertyTest_Function
>
fun_p
(
boost
::
shared_ptr
<
FunctionPropertyTest_Function
>
fun_p
(
new
FunctionPropertyTest_Function
);
new
FunctionPropertyTest_Function
);
TS_ASSERT
(
fun_p
);
TS_ASSERT
(
fun_p
);
...
...
Framework/API/test/LogManagerTest.h
View file @
39a6998d
...
@@ -555,8 +555,7 @@ private:
...
@@ -555,8 +555,7 @@ private:
LogManager
runInfo
;
LogManager
runInfo
;
const
std
::
string
name
=
"T_prop"
;
const
std
::
string
name
=
"T_prop"
;
runInfo
.
addProperty
<
T
>
(
name
,
value
);
runInfo
.
addProperty
<
T
>
(
name
,
value
);
int
result
(
-
1
);
int
result
=
runInfo
.
getPropertyAsIntegerValue
(
name
);
result
=
runInfo
.
getPropertyAsIntegerValue
(
name
);
TS_ASSERT_THROWS_NOTHING
(
result
=
runInfo
.
getPropertyAsIntegerValue
(
name
));
TS_ASSERT_THROWS_NOTHING
(
result
=
runInfo
.
getPropertyAsIntegerValue
(
name
));
TS_ASSERT_EQUALS
(
value
,
static_cast
<
T
>
(
result
));
TS_ASSERT_EQUALS
(
value
,
static_cast
<
T
>
(
result
));
}
}
...
@@ -580,12 +579,11 @@ public:
...
@@ -580,12 +579,11 @@ public:
}
}
void
test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times
()
{
void
test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times
()
{
double
value
(
0.0
);
for
(
size_t
i
=
0
;
i
<
20000
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
20000
;
++
i
)
{
value
=
m_testRun
.
getPropertyAsSingleValue
(
m_propName
);
// This has an observable side-effect of calling, so we don't need
// to store its return value
m_testRun
.
getPropertyAsSingleValue
(
m_propName
);
}
}
// Enure variable is used so that it is not optimised away by the compiler
value
+=
1.0
;
}
}
LogManager
m_testRun
;
LogManager
m_testRun
;
...
...
Framework/API/test/MultiDomainFunctionTest.h
View file @
39a6998d
...
@@ -324,7 +324,6 @@ public:
...
@@ -324,7 +324,6 @@ public:
void
test_attribute_domain_range
()
{
void
test_attribute_domain_range
()
{
multi
.
clearDomainIndices
();
multi
.
clearDomainIndices
();
multi
.
setLocalAttributeValue
(
0
,
"domains"
,
"0-2"
);
multi
.
setLocalAttributeValue
(
0
,
"domains"
,
"0-2"
);
return
;
multi
.
setLocalAttributeValue
(
1
,
"domains"
,
"i"
);
multi
.
setLocalAttributeValue
(
1
,
"domains"
,
"i"
);
multi
.
setLocalAttributeValue
(
2
,
"domains"
,
"i"
);
multi
.
setLocalAttributeValue
(
2
,
"domains"
,
"i"
);
...
...
Framework/API/test/RunTest.h
View file @
39a6998d
...
@@ -632,10 +632,8 @@ public:
...
@@ -632,10 +632,8 @@ public:
void
test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times
()
{
void
test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times
()
{
double
value
(
0.0
);
double
value
(
0.0
);
for
(
size_t
i
=
0
;
i
<
20000
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
20000
;
++
i
)
{
value
=
m_testRun
.
getPropertyAsSingleValue
(
m_propName
);
m_testRun
.
getPropertyAsSingleValue
(
m_propName
);
}
}
// Enure variable is used so that it is not optimised away by the compiler
value
+=
1.0
;
}
}
Run
m_testRun
;
Run
m_testRun
;
...
...
Framework/Algorithms/src/ConjoinXRuns.cpp
View file @
39a6998d
...
@@ -404,7 +404,7 @@ void ConjoinXRuns::exec() {
...
@@ -404,7 +404,7 @@ void ConjoinXRuns::exec() {
<<
". Reason:
\"
"
<<
e
.
what
()
<<
"
\"
. Skipping.
\n
"
;
<<
". Reason:
\"
"
<<
e
.
what
()
<<
"
\"
. Skipping.
\n
"
;
sampleLogsBehaviour
.
resetSampleLogs
(
temp
);
sampleLogsBehaviour
.
resetSampleLogs
(
temp
);
// remove the skipped one from the list
// remove the skipped one from the list
m_inputWS
.
erase
(
it
);
it
=
m_inputWS
.
erase
(
it
);
--
it
;
--
it
;
}
else
{
}
else
{
throw
std
::
invalid_argument
(
e
);
throw
std
::
invalid_argument
(
e
);
...
...
Framework/Algorithms/src/CorrectKiKf.cpp
View file @
39a6998d
...
@@ -220,11 +220,10 @@ void CorrectKiKf::execEvent() {
...
@@ -220,11 +220,10 @@ void CorrectKiKf::execEvent() {
PARALLEL_FOR_IF
(
Kernel
::
threadSafe
(
*
outputWS
))
PARALLEL_FOR_IF
(
Kernel
::
threadSafe
(
*
outputWS
))
for
(
int64_t
i
=
0
;
i
<
numHistograms
;
++
i
)
{
for
(
int64_t
i
=
0
;
i
<
numHistograms
;
++
i
)
{
PARALLEL_START_INTERUPT_REGION
PARALLEL_START_INTERUPT_REGION
double
Efi
=
0
;
// Now get the detector object for this histogram to check if monitor
// Now get the detector object for this histogram to check if monitor
// or to get Ef for indirect geometry
// or to get Ef for indirect geometry
if
(
emodeStr
==
"Indirect"
)
{
if
(
emodeStr
==
"Indirect"
)
{
double
Efi
=
0
;
if
(
efixedProp
!=
EMPTY_DBL
())
{
if
(
efixedProp
!=
EMPTY_DBL
())
{
Efi
=
efixedProp
;
Efi
=
efixedProp
;
// If a DetectorGroup is present should provide a value as a property
// If a DetectorGroup is present should provide a value as a property
...
...
Framework/Algorithms/src/CreateGroupingWorkspace.cpp
View file @
39a6998d
...
@@ -432,7 +432,6 @@ void CreateGroupingWorkspace::exec() {
...
@@ -432,7 +432,6 @@ void CreateGroupingWorkspace::exec() {
sortnames
=
true
;
sortnames
=
true
;
GroupNames
=
""
;
GroupNames
=
""
;
int
maxRecurseDepth
=
this
->
getProperty
(
"MaxRecursionDepth"
);
int
maxRecurseDepth
=
this
->
getProperty
(
"MaxRecursionDepth"
);
// cppcheck-suppress syntaxError
// cppcheck-suppress syntaxError
PRAGMA_OMP
(
parallel
for
schedule
(
dynamic
,
1
)
)
PRAGMA_OMP
(
parallel
for
schedule
(
dynamic
,
1
)
)
for
(
int
num
=
0
;
num
<
300
;
++
num
)
{
for
(
int
num
=
0
;
num
<
300
;
++
num
)
{
...
...
Framework/Algorithms/src/DiffractionFocussing2.cpp
View file @
39a6998d
...
@@ -590,11 +590,10 @@ void DiffractionFocussing2::determineRebinParameters() {
...
@@ -590,11 +590,10 @@ void DiffractionFocussing2::determineRebinParameters() {
nGroups
=
group2minmax
.
size
();
// Number of unique groups
nGroups
=
group2minmax
.
size
();
// Number of unique groups
double
Xmin
,
Xmax
,
step
;
const
int64_t
xPoints
=
nPoints
+
1
;
const
int64_t
xPoints
=
nPoints
+
1
;
// Iterator over all groups to create the new X vectors
// Iterator over all groups to create the new X vectors
for
(
gpit
=
group2minmax
.
begin
();
gpit
!=
group2minmax
.
end
();
gpit
++
)
{
for
(
gpit
=
group2minmax
.
begin
();
gpit
!=
group2minmax
.
end
();
++
gpit
)
{
double
Xmin
,
Xmax
,
step
;
Xmin
=
(
gpit
->
second
).
first
;
Xmin
=
(
gpit
->
second
).
first
;
Xmax
=
(
gpit
->
second
).
second
;
Xmax
=
(
gpit
->
second
).
second
;
...
...
Framework/Algorithms/src/FitPeaks.cpp
View file @
39a6998d
...
@@ -1771,7 +1771,6 @@ double FitPeaks::fitFunctionSD(
...
@@ -1771,7 +1771,6 @@ double FitPeaks::fitFunctionSD(
errorid
<<
": "
<<
e
.
what
();
errorid
<<
": "
<<
e
.
what
();
g_log
.
warning
()
<<
"While fitting "
+
errorid
.
str
();
g_log
.
warning
()
<<
"While fitting "
+
errorid
.
str
();
return
DBL_MAX
;
// probably the wrong thing to do
return
DBL_MAX
;
// probably the wrong thing to do
throw
std
::
runtime_error
(
"While fitting "
+
errorid
.
str
());
}
}
// Retrieve result
// Retrieve result
...
@@ -1847,7 +1846,6 @@ double FitPeaks::fitFunctionMD(API::IFunction_sptr fit_function,
...
@@ -1847,7 +1846,6 @@ double FitPeaks::fitFunctionMD(API::IFunction_sptr fit_function,
double
chi2
=
DBL_MAX
;
double
chi2
=
DBL_MAX
;
if
(
fitStatus
==
"success"
)
{
if
(
fitStatus
==
"success"
)
{
chi2
=
fit
->
getProperty
(
"OutputChi2overDoF"
);
chi2
=
fit
->
getProperty
(
"OutputChi2overDoF"
);
fit_function
=
fit
->
getProperty
(
"Function"
);
}
}
return
chi2
;
return
chi2
;
...
@@ -1883,9 +1881,8 @@ double FitPeaks::fitFunctionHighBackground(
...
@@ -1883,9 +1881,8 @@ double FitPeaks::fitFunctionHighBackground(
createMatrixWorkspace
(
vec_x
,
vec_y
,
vec_e
);
createMatrixWorkspace
(
vec_x
,
vec_y
,
vec_e
);
// Fit peak with background
// Fit peak with background
double
cost
=
fitFunctionSD
(
fit
,
peakfunction
,
bkgdfunc
,
reduced_bkgd_ws
,
0
,
fitFunctionSD
(
fit
,
peakfunction
,
bkgdfunc
,
reduced_bkgd_ws
,
0
,
vec_x
.
front
(),
vec_x
.
front
(),
vec_x
.
back
(),
expected_peak_center
,
vec_x
.
back
(),
expected_peak_center
,
observe_peak_shape
,
false
);
observe_peak_shape
,
false
);
// add the reduced background back
// add the reduced background back
bkgdfunc
->
setParameter
(
0
,
bkgdfunc
->
getParameter
(
0
)
+
bkgdfunc
->
setParameter
(
0
,
bkgdfunc
->
getParameter
(
0
)
+
...
@@ -1893,9 +1890,9 @@ double FitPeaks::fitFunctionHighBackground(
...
@@ -1893,9 +1890,9 @@ double FitPeaks::fitFunctionHighBackground(
bkgdfunc
->
setParameter
(
1
,
bkgdfunc
->
getParameter
(
1
)
+
bkgdfunc
->
setParameter
(
1
,
bkgdfunc
->
getParameter
(
1
)
+
high_bkgd_function
->
getParameter
(
1
));
high_bkgd_function
->
getParameter
(
1
));
cost
=
fitFunctionSD
(
fit
,
peakfunction
,
bkgdfunc
,
m_inputMatrixWS
,
ws_index
,
double
cost
=
fitFunctionSD
(
fit
,
peakfunction
,
bkgdfunc
,
m_inputMatrixWS
,
vec_x
.
front
(),
vec_x
.
back
(),
expected_peak_center
,
false
,
ws_index
,
vec_x
.
front
(),
vec_x
.
back
(),
false
);
expected_peak_center
,
false
,
false
);
return
cost
;
return
cost
;
}
}
...
...
Framework/Algorithms/src/GenerateEventsFilter.cpp
View file @
39a6998d
...
@@ -456,10 +456,9 @@ void GenerateEventsFilter::setFilterByTimeOnly() {
...
@@ -456,10 +456,9 @@ void GenerateEventsFilter::setFilterByTimeOnly() {
int64_t
curtime_ns
=
m_startTime
.
totalNanoseconds
();
int64_t
curtime_ns
=
m_startTime
.
totalNanoseconds
();
int
wsindex
=
0
;
int
wsindex
=
0
;
while
(
curtime_ns
<
m_stopTime
.
totalNanoseconds
())
{
while
(
curtime_ns
<
m_stopTime
.
totalNanoseconds
())
{
int64_t
deltatime_ns
;
for
(
size_t
id
=
0
;
id
<
numtimeintervals
;
++
id
)
{
for
(
size_t
id
=
0
;
id
<
numtimeintervals
;
++
id
)
{
// get next time interval value
// get next time interval value
deltatime_ns
=
vec_dtimens
[
id
];
int64_t
deltatime_ns
=
vec_dtimens
[
id
];
// Calculate next.time
// Calculate next.time
int64_t
nexttime_ns
=
curtime_ns
+
deltatime_ns
;
int64_t
nexttime_ns
=
curtime_ns
+
deltatime_ns
;
bool
breaklater
=
false
;
bool
breaklater
=
false
;
...
@@ -831,7 +830,6 @@ void GenerateEventsFilter::makeFilterBySingleValue(
...
@@ -831,7 +830,6 @@ void GenerateEventsFilter::makeFilterBySingleValue(
// Initialize control parameters
// Initialize control parameters
bool
lastGood
=
false
;
bool
lastGood
=
false
;
bool
isGood
=
false
;
time_duration
tol
=
DateAndTime
::
durationFromSeconds
(
TimeTolerance
);
time_duration
tol
=
DateAndTime
::
durationFromSeconds
(
TimeTolerance
);
int
numgood
=
0
;
int
numgood
=
0
;
DateAndTime
lastTime
,
currT
;
DateAndTime
lastTime
,
currT
;
...
@@ -844,8 +842,8 @@ void GenerateEventsFilter::makeFilterBySingleValue(
...
@@ -844,8 +842,8 @@ void GenerateEventsFilter::makeFilterBySingleValue(
currT
=
m_dblLog
->
nthTime
(
i
);
currT
=
m_dblLog
->
nthTime
(
i
);
// A good value?
// A good value?
isGood
=
identifyLogEntry
(
i
,
currT
,
lastGood
,
min
,
max
,
startTime
,
stopTime
,
bool
isGood
=
identifyLogEntry
(
i
,
currT
,
lastGood
,
min
,
max
,
startTime
,
filterIncrease
,
filterDecrease
);
stopTime
,
filterIncrease
,
filterDecrease
);
if
(
isGood
)
if
(
isGood
)
numgood
++
;
numgood
++
;
...
@@ -1219,7 +1217,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
...
@@ -1219,7 +1217,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
double
currValue
=
m_dblLog
->
nthValue
(
i
);
double
currValue
=
m_dblLog
->
nthValue
(
i
);
// Filter out by time and direction (optional)
// Filter out by time and direction (optional)
bool
intime
=
true
;
if
(
currTime
<
startTime
)
{
if
(
currTime
<
startTime
)
{
// case i. Too early, do nothing
// case i. Too early, do nothing
createsplitter
=
false
;
createsplitter
=
false
;
...
@@ -1254,130 +1251,127 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
...
@@ -1254,130 +1251,127 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
prevDirection
=
direction
;
prevDirection
=
direction
;
// Examine log value for filter
// Examine log value for filter
if
(
intime
)
{
// Determine whether direction is fine
// Determine whether direction is fine
bool
correctdir
=
true
;
bool
correctdir
=
true
;
if
(
filterIncrease
&&
filterDecrease
)
{
if
(
filterIncrease
&&
filterDecrease
)
{
// Both direction is fine
// Both direction is fine
correctdir
=
true
;
}
else
{
// Filter out one direction
if
(
filterIncrease
&&
direction
>
0
)
correctdir
=
true
;
correctdir
=
true
;
}
else
{
else
if
(
filterDecrease
&&
direction
<
0
)
// Filter out one direction
correctdir
=
true
;
if
(
filterIncrease
&&
direction
>
0
)
else
if
(
direction
==
0
)
correctdir
=
true
;
throw
runtime_error
(
"Direction is not determined."
);
else
if
(
filterDecrease
&&
direction
<
0
)
else
correctdir
=
true
;
correctdir
=
false
;
else
if
(
direction
==
0
)
}
// END-IF-ELSE: Direction
throw
runtime_error
(
"Direction is not determined."
);
else
// Treat the log entry based on: changing direction (+ time range)
correctdir
=
false
;
if
(
correctdir
)
{
}
// END-IF-ELSE: Direction
// Check this value whether it falls into any range
size_t
index
=
searchValue
(
logvalueranges
,
currValue
);
// Treat the log entry based on: changing direction (+ time range)
if
(
correctdir
)
{
bool
valueWithinMinMax
=
true
;
// Check this value whether it falls into any range
if
(
index
>
logvalueranges
.
size
())
{
size_t
index
=
searchValue
(
logvalueranges
,
currValue
);
// Out of range
valueWithinMinMax
=
false
;
bool
valueWithinMinMax
=
true
;
}
if
(
index
>
logvalueranges
.
size
())
{
// Out of range
valueWithinMinMax
=
false
;
}
if
(
g_log
.
is
(
Logger
::
Priority
::
PRIO_DEBUG
))
{
if
(
g_log
.
is
(
Logger
::
Priority
::
PRIO_DEBUG
))
{
stringstream
dbss
;
stringstream
dbss
;
dbss
<<
"[DBx257] Examine Log Index "
<<
i
dbss
<<
"[DBx257] Examine Log Index "
<<
i
<<
", Value = "
<<
currValue
<<
", Value = "
<<
currValue
<<
", Data Range Index = "
<<
index
<<
", Data Range Index = "
<<
index
<<
"; "
<<
"; "
<<
"Group Index = "
<<
indexwsindexmap
[
index
/
2
]
<<
"Group Index = "
<<
indexwsindexmap
[
index
/
2
]
<<
" (log value range vector size = "
<<
logvalueranges
.
size
()
<<
" (log value range vector size = "
<<
logvalueranges
.
size
()
<<
"): "
;
<<
"): "
;
if
(
index
==
0
)
if
(
index
==
0
)
dbss
<<
logvalueranges
[
index
]
<<
", "
<<
logvalueranges
[
index
+
1
];
dbss
<<
logvalueranges
[
index
]
<<
", "
<<
logvalueranges
[
index
+
1
];
else
if
(
index
==
logvalueranges
.
size
())
else
if
(
index
==
logvalueranges
.
size
())
dbss
<<
logvalueranges
[
index
-
1
]
<<
", "
<<
logvalueranges
[
index
];
dbss
<<
logvalueranges
[
index
-
1
]
<<
", "
<<
logvalueranges
[
index
];
else
if
(
valueWithinMinMax
)
else
if
(
valueWithinMinMax
)
dbss
<<
logvalueranges
[
index
-
1
]
<<
", "
<<
logvalueranges
[
index
]
dbss
<<
logvalueranges
[
index
-
1
]
<<
", "
<<
logvalueranges
[
index
]
<<
", "
<<
logvalueranges
[
index
+
1
];
<<
", "
<<
logvalueranges
[
index
+
1
];
g_log
.
debug
(
dbss
.
str
());
g_log
.
debug
(
dbss
.
str
());
}
}
if
(
valueWithinMinMax
)
{
if
(
valueWithinMinMax
)
{
if
(
index
%
2
==
0
)
{
if
(
index
%
2
==
0
)
{
// [Situation] Falls in the interval
// [Situation] Falls in the interval
currindex
=
indexwsindexmap
[
index
/
2
];
currindex
=
indexwsindexmap
[
index
/
2
];
if
(
currindex
!=
lastindex
&&
start
.
totalNanoseconds
()
==
0
)
{
if
(
currindex
!=
lastindex
&&
start
.
totalNanoseconds
()
==
0
)
{
// Group index is different from last and start is not set up: new
// Group index is different from last and start is not set up: new
// a region!
// a region!
newsplitter
=
true
;
newsplitter
=
true
;
}
else
if
(
currindex
!=
lastindex
&&
start
.
totalNanoseconds
()
>
0
)
{
}
else
if
(
currindex
!=
lastindex
&&
start
.
totalNanoseconds
()
>
0
)
{
// Group index is different from last and start is set up: close
// Group index is different from last and start is set up: close
// a region and new a region
// a region and new a region
stop
=
currTime
;
createsplitter
=
true
;
newsplitter
=
true
;
}
else
if
(
currindex
==
lastindex
&&
start
.
totalNanoseconds
()
>
0
)
{
// Still of the group index
if
(
i
==
iend
)
{
// Last entry in this section of log. Need to flag to close the
// pair
stop
=
currTime
;
stop
=
currTime
;
createsplitter
=
true
;
createsplitter
=
true
;
newsplitter
=
true
;
newsplitter
=
false
;
}
else
if
(
currindex
==
lastindex
&&
start
.
totalNanoseconds
()
>
0
)
{
// Still of the group index
if
(
i
==
iend
)
{
// Last entry in this section of log. Need to flag to close the
// pair
stop
=
currTime
;
createsplitter
=
true
;
newsplitter
=
false
;
}
else
{
// Do nothing
;
}
}
else
{
}
else
{
// An impossible situation
// Do nothing
std
::
stringstream
errmsg
;
;
double
lastvalue
=
m_dblLog
->
nthValue
(
i
-
1
);
errmsg
<<
"Impossible to have currindex == lastindex == "
<<
currindex
<<
", while start is not init. Log Index = "
<<
i
<<
"
\t
value = "
<<
currValue
<<
"
\t
, Index = "
<<
index
<<
" in range "
<<
logvalueranges
[
index
]
<<
", "
<<
logvalueranges
[
index
+
1
]
<<
"; Last value = "
<<
lastvalue
;
throw
std
::
runtime_error
(
errmsg
.
str
());
}
}
}
// [In-bound: Inside interval]
}
else
{
else
{
// An impossible situation
// [Situation] Fall between interval (which is not likley happen)
std
::
stringstream
errmsg
;
currindex
=
-
1
;
double
lastvalue
=
m_dblLog
->
nthValue
(
i
-
1
);
g_log
.
warning
()
errmsg
<<
"Impossible to have currindex == lastindex == "
<<
"Not likely to happen! Current value = "
<<
currValue
<<
currindex
<<
" is within value range but its index = "
<<
index
<<
", while start is not init. Log Index = "
<<
i
<<
" has no map to group index. "
<<
"
\t
value = "
<<
currValue
<<
"
\t
, Index = "
<<
index
<<
"
\n
"
;
<<
" in range "
<<
logvalueranges
[
index
]
<<
", "
if
(
start
.
totalNanoseconds
()
>
0
)
{
<<
logvalueranges
[
index
+
1
]
// Close the interval pair if it has been started.
<<
"; Last value = "
<<
lastvalue
;
stop
=
currTime
;
throw
std
::
runtime_error
(
errmsg
.
str
());
createsplitter
=
true
;
}
}
}
// [In-bound: Inside interval]
}
// [In-bound: Between interval]
else
{
}
else
{
// [Situation] Fall between interval (which is not likley happen)
// Out of a range: check whether there is a splitter started
currindex
=
-
1
;
currindex
=
-
1
;
g_log
.
warning
()
<<
"Not likely to happen! Current value = "
<<
currValue
<<
" is within value range but its index = "
<<
index
<<
" has no map to group index. "
<<
"
\n
"
;
if
(
start
.
totalNanoseconds
()
>
0
)
{