Travis Hunter e6bf1fea9b
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc-13, g++-13, ubuntu-latest) (push) Has been cancelled
Revert "Merge pull request #20 from cthunter01/propagator"
This reverts commit 6280d9fb0184275843a8f4406c7293e41e65a639, reversing
changes made to 3c9c8b8c6a2b2e7430ff09efdc2cc0c1996b16ca.
2025-04-16 18:23:28 -06:00

44 lines
976 B
C++

#ifndef UTILS_BIN_H
#define UTILS_BIN_H
/// \cond
// C headers
// C++ headers
#include <utility>
#include <vector>
// 3rd party headers
/// \endcond
namespace utils {
/**
* @brief This is a utility class that operates as a map. Instead of a regular map
* this one maps a range of key values to a single value. Like a bin, where
* each key represents the bottom of the bin, and the next key represents the
* bottom of the next bin, etc. When dereferencing the BinMap, it checks for
* where the passed in key falls and returns the value in that bin.
*
* @todo Make this class behave more like a proper STL container. Templetize it for one
*
*/
class Bin
{
public:
Bin();
Bin(Bin&& o);
~Bin();
void insert(const std::pair<double, double>& toInsert);
double operator[](double key);
double getBinBase(double key);
private:
std::vector<std::pair<double, double>> bins;
};
} // namespace utils
#endif // UTILS_BIN_H