Loading...
Searching...
No Matches
ranges.hpp
Go to the documentation of this file.
//
// Copyright 2010-2012 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <type_traits>
#include <string>
#include <vector>
namespace uhd {
class UHD_API range_t
{
public:
range_t(double value = 0);
range_t(double start, double stop, double step = 0);
double start(void) const;
double stop(void) const;
double step(void) const;
std::string to_pp_string(void) const;
bool operator==(const range_t& other) const;
bool operator!=(const range_t& other) const;
private:
double _start, _stop, _step;
};
struct UHD_API meta_range_t : public std::vector<range_t>
{
meta_range_t(void);
template <typename InputIterator>
meta_range_t(InputIterator first, InputIterator last)
: std::vector<range_t>(first, last)
{ /* NOP */
// This is to avoid people accidentally doing silly things like:
// meta_range_t(0, 0)
// which probably was supposed to call meta_range_t(double, double, double)
// but actually calls this constructor.
static_assert(!std::is_integral<typename std::decay<InputIterator>::type>::value,
"You can't pass integers to meta_range_t's constructor!");
}
meta_range_t(double start, double stop, double step = 0);
double start(void) const;
double stop(void) const;
double step(void) const;
double clip(double value, bool clip_step = false) const;
meta_range_t as_monotonic() const;
std::string to_pp_string(void) const;
};
typedef meta_range_t gain_range_t;
typedef meta_range_t freq_range_t;
} // namespace uhd
uhd::range_t
Definition ranges.hpp:22
uhd::range_t::range_t
range_t(double value=0)
uhd::range_t::operator!=
bool operator!=(const range_t &other) const
Inequality operator.
uhd::range_t::to_pp_string
std::string to_pp_string(void) const
Convert this range to a printable string.
uhd::range_t::stop
double stop(void) const
Get the stop value for this range.
uhd::range_t::start
double start(void) const
Get the start value for this range.
uhd::range_t::range_t
range_t(double start, double stop, double step=0)
uhd::range_t::operator==
bool operator==(const range_t &other) const
Equality operator.
uhd::range_t::step
double step(void) const
Get the step value for this range.
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
std
STL namespace.
uhd
Definition build_info.hpp:12
uhd::freq_range_t
meta_range_t freq_range_t
Definition ranges.hpp:131
uhd::gain_range_t
meta_range_t gain_range_t
Definition ranges.hpp:130
uhd::meta_range_t
Definition ranges.hpp:66
uhd::meta_range_t::stop
double stop(void) const
Get the overall stop value for this meta-range.
uhd::meta_range_t::as_monotonic
meta_range_t as_monotonic() const
uhd::meta_range_t::step
double step(void) const
Get the overall step value for this meta-range.
uhd::meta_range_t::meta_range_t
meta_range_t(InputIterator first, InputIterator last)
Definition ranges.hpp:77
uhd::meta_range_t::to_pp_string
std::string to_pp_string(void) const
Convert this meta-range to a printable string.
uhd::meta_range_t::meta_range_t
meta_range_t(double start, double stop, double step=0)
uhd::meta_range_t::meta_range_t
meta_range_t(void)
A default constructor for an empty meta-range.
uhd::meta_range_t::start
double start(void) const
Get the overall start value for this meta-range.
uhd::meta_range_t::clip
double clip(double value, bool clip_step=false) const