summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2011-02-14 22:01:53 -0800
committerPhilip Balister <philip@opensdr.com>2011-02-14 22:01:53 -0800
commitf157f0ba340b5bee85965881b25a3861a099b7bb (patch)
tree19bf9c0bcff6e2884438db09ca3ff74128b1f0ba /host/include
parentc9b3cb60e1559a5ea583bbef184a3c76ccb51a21 (diff)
parent85a1575d83505d4d2770e5754bee207181ba0f8a (diff)
downloaduhd-f157f0ba340b5bee85965881b25a3861a099b7bb.tar.gz
uhd-f157f0ba340b5bee85965881b25a3861a099b7bb.tar.bz2
uhd-f157f0ba340b5bee85965881b25a3861a099b7bb.zip
Merge branch 'next' of ettus.sourcerepo.com:ettus/uhdpriv into next
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/types/ref_vector.hpp40
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp6
2 files changed, 36 insertions, 10 deletions
diff --git a/host/include/uhd/types/ref_vector.hpp b/host/include/uhd/types/ref_vector.hpp
index efd4b8f89..0ae301647 100644
--- a/host/include/uhd/types/ref_vector.hpp
+++ b/host/include/uhd/types/ref_vector.hpp
@@ -29,30 +29,54 @@ namespace uhd{
*/
template <typename T> class ref_vector{
public:
- //! Create a reference vector from a pointer and size
- template <typename Ptr> ref_vector(Ptr *ptr, size_t size = 1):
- _mem(T(ptr)), _size(size)
+ /*!
+ * Create a reference vector of size 1 from a pointer.
+ * Therefore: rv[0] == ptr and rv.size() == 1
+ * \param ptr a pointer to a chunk of memory
+ */
+ template <typename Ptr> ref_vector(Ptr *ptr):
+ _ptr(T(ptr)), _mem(_mem_t(&_ptr)), _size(1)
{
/* NOP */
}
- //! Create a reference vector from a std::vector container
- template <typename Range> ref_vector(const Range &range):
- _mem(T(range.front())), _size(range.size())
+ /*!
+ * Create a reference vector from a std::vector container.
+ * Therefore: rv[n] == vec[n] and rv.size() == vec.size()
+ * \param range a const reference to an std::vector
+ */
+ template <typename Vector> ref_vector(const Vector &vec):
+ _ptr(T()), _mem(_mem_t(&vec.front())), _size(vec.size())
{
/* NOP */
}
+ /*!
+ * Create a reference vector from a pointer and a length
+ * Therefore: rv[n] == mem[n] and rv.size() == len
+ * \param mem a pointer to an array of pointers
+ * \param len the length of the array of pointers
+ */
+ ref_vector(const T *mem, size_t len):
+ _ptr(T()), _mem(_mem_t(mem)), _size(len)
+ {
+ /* NOP */
+ }
+
+ //! Index operator gets the value of rv[index]
const T &operator[](size_t index) const{
- return (&_mem)[index];
+ return _mem[index];
}
+ //! The number of elements in this container
size_t size(void) const{
return _size;
}
private:
- const T _mem;
+ const T _ptr;
+ typedef T* _mem_t;
+ const _mem_t _mem;
const size_t _size;
};
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index c77b5d6d2..60b757f50 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -141,15 +141,17 @@ public:
/*!
* Get the current time in the usrp time registers.
+ * \param mboard which motherboard to query
* \return a timespec representing current usrp time
*/
- virtual time_spec_t get_time_now(void) = 0;
+ virtual time_spec_t get_time_now(size_t mboard = 0) = 0;
/*!
* Get the time when the last pps pulse occured.
+ * \param mboard which motherboard to query
* \return a timespec representing the last pps
*/
- virtual time_spec_t get_time_last_pps(void) = 0;
+ virtual time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
/*!
* Sets the time registers on the usrp immediately.