USRP Hardware Driver and USRP Manual  Version: 4.4.0.HEAD-0-g5fac246b
UHD and USRP Manual
ranges.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2012 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #pragma once
9 
10 #include <uhd/config.hpp>
11 #include <string>
12 #include <type_traits>
13 #include <vector>
14 
15 namespace uhd {
16 
22 {
23 public:
29  range_t(double value = 0);
30 
38  range_t(double start, double stop, double step = 0);
39 
41  double start(void) const;
42 
44  double stop(void) const;
45 
47  double step(void) const;
48 
50  const std::string to_pp_string(void) const;
51 
53  bool operator==(const range_t& other) const;
54 
56  bool operator!=(const range_t& other) const;
57 
58 private:
59  double _start, _stop, _step;
60 };
61 
65 struct UHD_API meta_range_t : public std::vector<range_t>
66 {
68  meta_range_t(void);
69 
76  template <typename InputIterator>
77  meta_range_t(InputIterator first, InputIterator last)
78  : std::vector<range_t>(first, last)
79  { /* NOP */
80  // This is to avoid people accidentally doing silly things like:
81  // meta_range_t(0, 0)
82  // which probably was supposed to call meta_range_t(double, double, double)
83  // but actually calls this constructor.
84  static_assert(
85  !std::is_integral<typename std::decay<InputIterator>::type>::value,
86  "You can't pass integers to meta_range_t's constructor!"
87  );
88  }
89 
97  meta_range_t(double start, double stop, double step = 0);
98 
100  double start(void) const;
101 
103  double stop(void) const;
104 
106  double step(void) const;
107 
114  double clip(double value, bool clip_step = false) const;
115 
126  meta_range_t as_monotonic() const;
127 
129  const std::string to_pp_string(void) const;
130 };
131 
134 
135 } // namespace uhd
config.hpp
uhd::operator==
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.
UHD_API
#define UHD_API
Definition: config.h:87
uhd
Definition: build_info.hpp:12
uhd::clip
UHD_INLINE T clip(const T &val, const T &bound1, const T &bound2)
Definition: algorithm.hpp:81
uhd::meta_range_t::meta_range_t
meta_range_t(InputIterator first, InputIterator last)
Definition: ranges.hpp:77
uhd::freq_range_t
meta_range_t freq_range_t
Definition: ranges.hpp:133
uhd::range_t
Definition: ranges.hpp:21
uhd::gain_range_t
meta_range_t gain_range_t
Definition: ranges.hpp:132
uhd::math::fp_compare::operator!=
UHD_INLINE bool operator!=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:64
uhd::meta_range_t
Definition: ranges.hpp:65