@@ -11,6 +11,38 @@ using namespace nx::core;
1111
1212namespace
1313{
14+ /* *
15+ * @brief InsertThreshold
16+ * @param numItems
17+ * @param currentArrayPtr
18+ * @param unionOperator
19+ * @param newArrayPtr
20+ * @param inverse
21+ */
22+ template <typename T>
23+ void InsertThreshold (std::vector<T>& currentVector, nx::core::IArrayThreshold::UnionOperator unionOperator, std::vector<T>& newVector, bool inverse, T trueValue, T falseValue)
24+ {
25+ usize numItems = currentVector.size ();
26+
27+ for (usize i = 0 ; i < numItems; i++)
28+ {
29+ // invert the current comparison if necessary
30+ if (inverse)
31+ {
32+ newVector[i] = (newVector[i] == trueValue) ? falseValue : trueValue;
33+ }
34+
35+ if (nx::core::IArrayThreshold::UnionOperator::Or == unionOperator)
36+ {
37+ currentVector[i] = (currentVector[i] == trueValue || newVector[i] == trueValue) ? trueValue : falseValue;
38+ }
39+ else if (currentVector[i] == falseValue || newVector[i] == falseValue)
40+ {
41+ currentVector[i] = falseValue;
42+ }
43+ }
44+ }
45+
1446/* *
1547 * @brief Consolidate all assignment calls to a single method to prevent unintended diverging behavior.
1648 * @param arrayThreshold Current threshold to pull settings from.
@@ -104,38 +136,6 @@ struct ExecuteThresholdHelper
104136 }
105137};
106138
107- /* *
108- * @brief InsertThreshold
109- * @param numItems
110- * @param currentArrayPtr
111- * @param unionOperator
112- * @param newArrayPtr
113- * @param inverse
114- */
115- template <typename T>
116- void InsertThreshold (std::vector<T>& currentVector, nx::core::IArrayThreshold::UnionOperator unionOperator, std::vector<T>& newVector, bool inverse, T trueValue, T falseValue)
117- {
118- usize numItems = currentVector.size ();
119-
120- for (usize i = 0 ; i < numItems; i++)
121- {
122- // invert the current comparison if necessary
123- if (inverse)
124- {
125- newVector[i] = (newVector[i] == trueValue) ? falseValue : trueValue;
126- }
127-
128- if (nx::core::IArrayThreshold::UnionOperator::Or == unionOperator)
129- {
130- currentVector[i] = (currentVector[i] == trueValue || newVector[i] == trueValue) ? trueValue : falseValue;
131- }
132- else if (currentVector[i] == falseValue || newVector[i] == falseValue)
133- {
134- currentVector[i] = falseValue;
135- }
136- }
137- }
138-
139139template <typename T>
140140void ThresholdValue (const ArrayThreshold& comparisonValue, const DataStructure& dataStructure, std::vector<T>& outputResultVector, int32_t & err, bool replaceInput, T trueValue, T falseValue)
141141{
0 commit comments