diff options
author | Josh Blum <josh@joshknows.com> | 2010-06-24 18:55:08 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-06-24 18:55:08 -0700 |
commit | fadd3a44a84e061412accd35c1c97db820190df8 (patch) | |
tree | 3bae768f567858b6dc61f24cd643819c9c9c2380 /host/include | |
parent | e74356ec5956d10d399969851fefd4a1f308ad7c (diff) | |
download | uhd-fadd3a44a84e061412accd35c1c97db820190df8.tar.gz uhd-fadd3a44a84e061412accd35c1c97db820190df8.tar.bz2 uhd-fadd3a44a84e061412accd35c1c97db820190df8.zip |
uhd: created benchmark rx example app
Made mods to time spec to support math operators.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/types/time_spec.hpp | 24 | ||||
-rw-r--r-- | host/include/uhd/usrp/dboard_id.hpp | 2 |
2 files changed, 24 insertions, 2 deletions
diff --git a/host/include/uhd/types/time_spec.hpp b/host/include/uhd/types/time_spec.hpp index 25d9e41d0..7353c6e25 100644 --- a/host/include/uhd/types/time_spec.hpp +++ b/host/include/uhd/types/time_spec.hpp @@ -20,6 +20,7 @@ #include <uhd/config.hpp> #include <boost/cstdint.hpp> +#include <boost/operators.hpp> namespace uhd{ @@ -38,7 +39,10 @@ namespace uhd{ * This gives the fractional seconds enough precision to unambiguously * specify a clock-tick/sample-count up to rates of several petahertz. */ - struct UHD_API time_spec_t{ + struct UHD_API time_spec_t: + boost::addable<time_spec_t>, + boost::subtractable<time_spec_t>, + boost::equality_comparable<time_spec_t>{ //! whole/integer seconds count in seconds boost::uint32_t secs; @@ -69,8 +73,26 @@ namespace uhd{ */ time_spec_t(boost::uint32_t secs = 0, double nsecs = 0); + /*! + * Create a time_spec_t from whole and fractional seconds. + * Translation from clock-domain specific units. + * \param secs the whole/integer seconds count in seconds + * \param ticks the fractional seconds tick count + * \param tick_rate the number of ticks per second + */ + time_spec_t(boost::uint32_t secs, boost::uint32_t ticks, double tick_rate); + + //! Implement addable interface + time_spec_t &operator+=(const time_spec_t &); + + //! Implement subtractable interface + time_spec_t &operator-=(const time_spec_t &); + }; + //! Implement equality_comparable interface + UHD_API bool operator==(const time_spec_t &, const time_spec_t &); + } //namespace uhd #endif /* INCLUDED_UHD_TYPES_TIME_SPEC_HPP */ diff --git a/host/include/uhd/usrp/dboard_id.hpp b/host/include/uhd/usrp/dboard_id.hpp index 8b6eaf6bd..4c45e4334 100644 --- a/host/include/uhd/usrp/dboard_id.hpp +++ b/host/include/uhd/usrp/dboard_id.hpp @@ -25,7 +25,7 @@ namespace uhd{ namespace usrp{ - class UHD_API dboard_id_t : boost::equality_comparable1<dboard_id_t>{ + class UHD_API dboard_id_t : boost::equality_comparable<dboard_id_t>{ public: /*! * Create a dboard id from an integer. |