25 #ifndef INCLUDED_IdentifierHelpers_h_GUID_B6F81E02_BE7B_4382_12E5_87296135997D 26 #define INCLUDED_IdentifierHelpers_h_GUID_B6F81E02_BE7B_4382_12E5_87296135997D 32 #include <boost/assert.hpp> 46 auto currentSize = brightnesses.size();
47 if (currentSize > n) {
48 auto excess = currentSize - n;
49 auto newBegin = brightnesses.begin();
50 std::advance(newBegin, excess);
51 brightnesses.erase(brightnesses.begin(), newBegin);
52 if (brightnesses.size() > n) {
53 throw std::logic_error(
"MATH FAIL");
57 while (brightnesses.size() > n) {
58 brightnesses.pop_front();
65 inline BrightnessMinMax
68 BOOST_ASSERT_MSG(!brightnesses.empty(),
"Must be a non-empty list!");
69 auto extremaIterators =
70 std::minmax_element(begin(brightnesses), end(brightnesses));
71 return std::make_pair(*extremaIterators.first,
72 *extremaIterators.second);
82 ret.resize(brightnesses.size());
87 [threshold](Brightness val) {
88 if (val >= threshold) {
100 #endif // INCLUDED_IdentifierHelpers_h_GUID_B6F81E02_BE7B_4382_12E5_87296135997D LedPatternWrapped getBitsUsingThreshold(const BrightnessList &brightnesses, float threshold)
Helper for implementations of LedIdentifier to turn a brightness list into a boolean list based on th...
Definition: IdentifierHelpers.h:79
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
void truncateBrightnessListTo(BrightnessList &brightnesses, size_t n)
Helper for implementations of LedIdentifier to truncate the passed-in brightness list to the maximum ...
Definition: IdentifierHelpers.h:43
t_< detail::transform_< List, Fun >> transform
Given a list and an alias class, apply the alias class to each element in the list and return the res...
Definition: Transform.h:54
std::string LedPatternWrapped
Pattern repeated almost twice.
Definition: BasicTypes.h:48
BrightnessMinMax findMinMaxBrightness(const BrightnessList &brightnesses)
Helper function for implementations of LedIdentifier to find the minimum and maximum values in a non-...
Definition: IdentifierHelpers.h:66