Add toolbox for radar display control

This commit is contained in:
Dan Paulat 2021-11-04 22:25:06 -05:00
parent cd5d60bc0b
commit 7c606b85ff
8 changed files with 325 additions and 6 deletions

View file

@ -0,0 +1,35 @@
#pragma once
#include <scwx/util/iterator.hpp>
#include <string>
namespace scwx
{
namespace common
{
const std::string LEVEL2_GROUP_ID = "L2";
enum class Level2Product
{
Reflectivity,
Velocity,
SpectrumWidth,
DifferentialReflectivity,
DifferentialPhase,
CorrelationCoefficient,
ClutterFilterPowerRemoved,
Unknown
};
typedef util::Iterator<Level2Product,
Level2Product::Reflectivity,
Level2Product::ClutterFilterPowerRemoved>
Level2ProductIterator;
const std::string& GetLevel2Name(Level2Product product);
const std::string& GetLevel2Description(Level2Product product);
const Level2Product GetLevel2Product(const std::string& id);
} // namespace common
} // namespace scwx

View file

@ -0,0 +1,35 @@
#pragma once
#include <type_traits>
namespace scwx
{
namespace util
{
template<typename T, T beginValue, T endValue>
class Iterator
{
typedef typename std::underlying_type<T>::type value_t;
int value_;
public:
Iterator(const T& v) : value_(static_cast<value_t>(v)) {}
Iterator() : value_(static_cast<value_t>(beginValue)) {}
Iterator operator++()
{
++value_;
return *this;
}
T operator*() { return static_cast<T>(value_); }
Iterator begin() { return *this; } // Default constructor
Iterator end()
{
static const Iterator endIterator = ++Iterator(endValue);
return endIterator;
}
bool operator!=(const Iterator& i) { return value_ != i.value_; }
};
} // namespace util
} // namespace scwx