Revision daa537d3
| b/host/include/uhd/types/ranges.hpp | ||
|---|---|---|
| 21 | 21 |
#include <uhd/config.hpp> |
| 22 | 22 |
#include <uhd/utils/pimpl.hpp> |
| 23 | 23 |
#include <vector> |
| 24 |
#include <string> |
|
| 24 | 25 |
|
| 25 | 26 |
namespace uhd{
|
| 26 | 27 |
|
| ... | ... | |
| 55 | 56 |
//! Get the step value for this range. |
| 56 | 57 |
const T step(void) const; |
| 57 | 58 |
|
| 59 |
//! Convert this range to a printable string |
|
| 60 |
const std::string to_pp_string(void) const; |
|
| 61 |
|
|
| 58 | 62 |
private: |
| 59 |
UHD_PIMPL_DECL(impl) _impl;
|
|
| 63 |
UHD_PIMPL_DECL(impl) _impl;
|
|
| 60 | 64 |
}; |
| 61 | 65 |
|
| 62 | 66 |
/*! |
| ... | ... | |
| 102 | 106 |
*/ |
| 103 | 107 |
const T clip(const T &value, bool clip_step = false) const; |
| 104 | 108 |
|
| 109 |
//! Convert this meta-range to a printable string |
|
| 110 |
const std::string to_pp_string(void) const; |
|
| 111 |
|
|
| 105 | 112 |
}; |
| 106 | 113 |
|
| 107 | 114 |
//! export a symbol for the gain range type |
| b/host/include/uhd/types/ranges.ipp | ||
|---|---|---|
| 22 | 22 |
#include <boost/foreach.hpp> |
| 23 | 23 |
#include <algorithm> |
| 24 | 24 |
#include <stdexcept> |
| 25 |
#include <iostream>
|
|
| 25 |
#include <sstream>
|
|
| 26 | 26 |
|
| 27 | 27 |
namespace uhd{
|
| 28 | 28 |
|
| ... | ... | |
| 66 | 66 |
return _impl->step; |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
template <typename T> const std::string range_t<T>::to_pp_string(void) const{
|
|
| 70 |
std::stringstream ss; |
|
| 71 |
ss << "(" << this->start();
|
|
| 72 |
if (this->start() != this->stop()) ss << ", " << this->stop(); |
|
| 73 |
if (this->step() != T(0)) ss << ", " << this->step(); |
|
| 74 |
ss << ")"; |
|
| 75 |
return ss.str(); |
|
| 76 |
} |
|
| 77 |
|
|
| 69 | 78 |
/******************************************************************* |
| 70 | 79 |
* meta_range_t implementation code |
| 71 | 80 |
******************************************************************/ |
| ... | ... | |
| 163 | 172 |
return last_stop; |
| 164 | 173 |
} |
| 165 | 174 |
|
| 175 |
template <typename T> const std::string meta_range_t<T>::to_pp_string(void) const{
|
|
| 176 |
std::stringstream ss; |
|
| 177 |
BOOST_FOREACH(const range_t<T> &r, (*this)){
|
|
| 178 |
ss << r.to_pp_string() << std::endl; |
|
| 179 |
} |
|
| 180 |
return ss.str(); |
|
| 181 |
} |
|
| 182 |
|
|
| 166 | 183 |
} //namespace uhd |
| 167 | 184 |
|
| 168 | 185 |
#endif /* INCLUDED_UHD_TYPES_RANGES_IPP */ |
Also available in: Unified diff