diff options
author | Paul David <paul.david@ettus.com> | 2017-05-09 21:36:02 -0400 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-05-23 17:14:32 -0700 |
commit | 2c0f1098351d6c0763d985c2085ec676a7992e2d (patch) | |
tree | 66b8c4cba5742f9e9a7f59d46c586957b35c4c28 /host/lib | |
parent | 056dabcaf37469d0e614d269ded3e6e4c41d4cc8 (diff) | |
download | uhd-2c0f1098351d6c0763d985c2085ec676a7992e2d.tar.gz uhd-2c0f1098351d6c0763d985c2085ec676a7992e2d.tar.bz2 uhd-2c0f1098351d6c0763d985c2085ec676a7992e2d.zip |
Types: Added equality/inquality operators to support Boost.Python additions
- Added to subdev_spec_pair_t
- Added to range_t
- Added tests for the inequalities
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/types/ranges.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/subdev_spec.cpp | 8 |
2 files changed, 20 insertions, 0 deletions
diff --git a/host/lib/types/ranges.cpp b/host/lib/types/ranges.cpp index ee4546cb8..d22e2fb6a 100644 --- a/host/lib/types/ranges.cpp +++ b/host/lib/types/ranges.cpp @@ -63,6 +63,18 @@ const std::string range_t::to_pp_string(void) const{ return ss.str(); } +bool range_t::operator==(const range_t &other) const{ + return (other._start == _start and + other._step == _step and + other._stop == _stop); +} + +bool range_t::operator!=(const range_t &other) const{ + return (other._start != _start or + other._step != _step or + other._stop != _stop); +} + /*********************************************************************** * meta_range_t implementation code **********************************************************************/ diff --git a/host/lib/usrp/subdev_spec.cpp b/host/lib/usrp/subdev_spec.cpp index e59160a71..b7eb64f87 100644 --- a/host/lib/usrp/subdev_spec.cpp +++ b/host/lib/usrp/subdev_spec.cpp @@ -43,6 +43,14 @@ bool usrp::operator==(const subdev_spec_pair_t &lhs, const subdev_spec_pair_t &r return (lhs.db_name == rhs.db_name) and (lhs.sd_name == rhs.sd_name); } +bool subdev_spec_pair_t::operator==(const subdev_spec_pair_t &other){ + return (other.db_name == db_name) and (other.sd_name == sd_name); +} + +bool subdev_spec_pair_t::operator!=(const subdev_spec_pair_t &other){ + return (other.db_name != db_name) or (other.sd_name != sd_name); +} + subdev_spec_t::subdev_spec_t(const std::string &markup){ for(const std::string &pair: pair_tokenizer(markup)){ if (pair.empty()) continue; |