summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/CMakeLists.txt1
-rw-r--r--host/include/uhd/config.hpp2
-rw-r--r--host/include/uhd/convert.hpp8
-rw-r--r--host/include/uhd/device.hpp40
-rw-r--r--host/include/uhd/device.ipp55
-rw-r--r--host/include/uhd/transport/bounded_buffer.hpp61
-rw-r--r--host/include/uhd/transport/bounded_buffer.ipp55
-rw-r--r--host/include/uhd/transport/zero_copy.hpp85
-rw-r--r--host/include/uhd/types/CMakeLists.txt1
-rw-r--r--host/include/uhd/types/ref_vector.hpp85
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp6
11 files changed, 203 insertions, 196 deletions
diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt
index fee1270e9..b7a22cf0b 100644
--- a/host/include/uhd/CMakeLists.txt
+++ b/host/include/uhd/CMakeLists.txt
@@ -25,7 +25,6 @@ INSTALL(FILES
config.hpp
convert.hpp
device.hpp
- device.ipp
version.hpp
wax.hpp
DESTINATION ${INCLUDE_DIR}/uhd
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 912fbc204..1a04680e9 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -27,7 +27,7 @@
//# pragma warning(disable: 4512) // assignment operator can't not be generated
//# pragma warning(disable: 4100) // unreferenced formal parameter
//# pragma warning(disable: 4996) // <symbol> was declared deprecated
-//# pragma warning(disable: 4355) // 'this' : used in base member initializer list
+# pragma warning(disable: 4355) // 'this' : used in base member initializer list
//# pragma warning(disable: 4706) // assignment within conditional expression
# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
//# pragma warning(disable: 4127) // conditional expression is constant
diff --git a/host/include/uhd/convert.hpp b/host/include/uhd/convert.hpp
index bfe8c8267..8fc2f38db 100644
--- a/host/include/uhd/convert.hpp
+++ b/host/include/uhd/convert.hpp
@@ -21,15 +21,15 @@
#include <uhd/config.hpp>
#include <uhd/types/io_type.hpp>
#include <uhd/types/otw_type.hpp>
+#include <uhd/types/ref_vector.hpp>
#include <boost/function.hpp>
#include <string>
-#include <vector>
namespace uhd{ namespace convert{
- typedef std::vector<void *> output_type;
- typedef std::vector<const void *> input_type;
- typedef boost::function<void(input_type&, output_type&, size_t)> function_type;
+ typedef uhd::ref_vector<void *> output_type;
+ typedef uhd::ref_vector<const void *> input_type;
+ typedef boost::function<void(const input_type&, const output_type&, size_t)> function_type;
/*!
* Describe the priority of a converter function.
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index 992276928..50237472b 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -22,11 +22,11 @@
#include <uhd/types/device_addr.hpp>
#include <uhd/types/metadata.hpp>
#include <uhd/types/io_type.hpp>
+#include <uhd/types/ref_vector.hpp>
#include <uhd/wax.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-#include <vector>
namespace uhd{
@@ -96,6 +96,12 @@ public:
RECV_MODE_ONE_PACKET = 1
};
+ //! Typedef for a pointer to a single, or a collection of send buffers
+ typedef ref_vector<const void *> send_buffs_type;
+
+ //! Typedef for a pointer to a single, or a collection of recv buffers
+ typedef ref_vector<void *> recv_buffs_type;
+
/*!
* Send buffers containing IF data described by the metadata.
*
@@ -121,7 +127,7 @@ public:
* \return the number of samples sent
*/
virtual size_t send(
- const std::vector<const void *> &buffs,
+ const send_buffs_type &buffs,
size_t nsamps_per_buff,
const tx_metadata_t &metadata,
const io_type_t &io_type,
@@ -130,18 +136,6 @@ public:
) = 0;
/*!
- * Convenience wrapper for send that takes a single buffer.
- */
- size_t send(
- const void *buff,
- size_t nsamps_per_buff,
- const tx_metadata_t &metadata,
- const io_type_t &io_type,
- send_mode_t send_mode,
- double timeout = 0.1
- );
-
- /*!
* Receive buffers containing IF data described by the metadata.
*
* Receive handles fragmentation as follows:
@@ -173,7 +167,7 @@ public:
* \return the number of samples received or 0 on error
*/
virtual size_t recv(
- const std::vector<void *> &buffs,
+ const recv_buffs_type &buffs,
size_t nsamps_per_buff,
rx_metadata_t &metadata,
const io_type_t &io_type,
@@ -182,18 +176,6 @@ public:
) = 0;
/*!
- * Convenience wrapper for recv that takes a single buffer.
- */
- size_t recv(
- void *buff,
- size_t nsamps_per_buff,
- rx_metadata_t &metadata,
- const io_type_t &io_type,
- recv_mode_t recv_mode,
- double timeout = 0.1
- );
-
- /*!
* Get the maximum number of samples per packet on send.
* \return the number of samples
*/
@@ -219,6 +201,4 @@ public:
} //namespace uhd
-#include <uhd/device.ipp>
-
#endif /* INCLUDED_UHD_DEVICE_HPP */
diff --git a/host/include/uhd/device.ipp b/host/include/uhd/device.ipp
deleted file mode 100644
index e2e51ecd0..000000000
--- a/host/include/uhd/device.ipp
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_UHD_DEVICE_IPP
-#define INCLUDED_UHD_DEVICE_IPP
-
-namespace uhd{
-
- UHD_INLINE size_t device::send(
- const void *buff,
- size_t nsamps_per_buff,
- const tx_metadata_t &metadata,
- const io_type_t &io_type,
- send_mode_t send_mode,
- double timeout
- ){
- return this->send(
- std::vector<const void *>(1, buff),
- nsamps_per_buff, metadata,
- io_type, send_mode, timeout
- );
- }
-
- UHD_INLINE size_t device::recv(
- void *buff,
- size_t nsamps_per_buff,
- rx_metadata_t &metadata,
- const io_type_t &io_type,
- recv_mode_t recv_mode,
- double timeout
- ){
- return this->recv(
- std::vector<void *>(1, buff),
- nsamps_per_buff, metadata,
- io_type, recv_mode, timeout
- );
- }
-
-} //namespace uhd
-
-#endif /* INCLUDED_UHD_DEVICE_IPP */
diff --git a/host/include/uhd/transport/bounded_buffer.hpp b/host/include/uhd/transport/bounded_buffer.hpp
index aca93b071..6aa92c2e6 100644
--- a/host/include/uhd/transport/bounded_buffer.hpp
+++ b/host/include/uhd/transport/bounded_buffer.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -18,8 +18,7 @@
#ifndef INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_HPP
#define INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_HPP
-#include <uhd/config.hpp>
-#include <boost/shared_ptr.hpp>
+#include <uhd/transport/bounded_buffer.ipp> //detail
namespace uhd{ namespace transport{
@@ -32,13 +31,26 @@ namespace uhd{ namespace transport{
*/
template <typename elem_type> class bounded_buffer{
public:
- typedef boost::shared_ptr<bounded_buffer<elem_type> > sptr;
/*!
- * Make a new bounded buffer object.
+ * Create a new bounded buffer object.
* \param capacity the bounded_buffer capacity
*/
- static sptr make(size_t capacity);
+ bounded_buffer(size_t capacity):
+ _detail(capacity)
+ {
+ /* NOP */
+ }
+
+ /*!
+ * Push a new element into the bounded buffer immediately.
+ * The element will not be pushed when the buffer is full.
+ * \param elem the element reference pop to
+ * \return false when the buffer is full
+ */
+ bool push_with_haste(const elem_type &elem){
+ return _detail.push_with_haste(elem);
+ }
/*!
* Push a new element into the bounded buffer.
@@ -47,14 +59,18 @@ namespace uhd{ namespace transport{
* \param elem the new element to push
* \return true if the element fit without popping for space
*/
- virtual bool push_with_pop_on_full(const elem_type &elem) = 0;
+ bool push_with_pop_on_full(const elem_type &elem){
+ return _detail.push_with_pop_on_full(elem);
+ }
/*!
* Push a new element into the bounded_buffer.
* Wait until the bounded_buffer becomes non-full.
* \param elem the new element to push
*/
- virtual void push_with_wait(const elem_type &elem) = 0;
+ void push_with_wait(const elem_type &elem){
+ return _detail.push_with_wait(elem);
+ }
/*!
* Push a new element into the bounded_buffer.
@@ -63,14 +79,28 @@ namespace uhd{ namespace transport{
* \param timeout the timeout in seconds
* \return false when the operation times out
*/
- virtual bool push_with_timed_wait(const elem_type &elem, double timeout) = 0;
+ bool push_with_timed_wait(const elem_type &elem, double timeout){
+ return _detail.push_with_timed_wait(elem, timeout);
+ }
+
+ /*!
+ * Pop an element from the bounded buffer immediately.
+ * The element will not be popped when the buffer is empty.
+ * \param elem the element reference pop to
+ * \return false when the buffer is empty
+ */
+ bool pop_with_haste(elem_type &elem){
+ return _detail.pop_with_haste(elem);
+ }
/*!
* Pop an element from the bounded_buffer.
* Wait until the bounded_buffer becomes non-empty.
* \param elem the element reference pop to
*/
- virtual void pop_with_wait(elem_type &elem) = 0;
+ void pop_with_wait(elem_type &elem){
+ return _detail.pop_with_wait(elem);
+ }
/*!
* Pop an element from the bounded_buffer.
@@ -79,16 +109,13 @@ namespace uhd{ namespace transport{
* \param timeout the timeout in seconds
* \return false when the operation times out
*/
- virtual bool pop_with_timed_wait(elem_type &elem, double timeout) = 0;
+ bool pop_with_timed_wait(elem_type &elem, double timeout){
+ return _detail.pop_with_timed_wait(elem, timeout);
+ }
- /*!
- * Clear all elements from the bounded_buffer.
- */
- virtual void clear(void) = 0;
+ private: bounded_buffer_detail<elem_type> _detail;
};
}} //namespace
-#include <uhd/transport/bounded_buffer.ipp>
-
#endif /* INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_HPP */
diff --git a/host/include/uhd/transport/bounded_buffer.ipp b/host/include/uhd/transport/bounded_buffer.ipp
index 4fbe3f085..0d393ad64 100644
--- a/host/include/uhd/transport/bounded_buffer.ipp
+++ b/host/include/uhd/transport/bounded_buffer.ipp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -18,27 +18,37 @@
#ifndef INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_IPP
#define INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_IPP
+#include <uhd/config.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/locks.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
namespace uhd{ namespace transport{ namespace{ /*anon*/
- template <typename elem_type>
- class bounded_buffer_impl : public bounded_buffer<elem_type>{
+ template <typename elem_type> class bounded_buffer_detail{
public:
- bounded_buffer_impl(size_t capacity) : _buffer(capacity){
- _not_full_fcn = boost::bind(&bounded_buffer_impl<elem_type>::not_full, this);
- _not_empty_fcn = boost::bind(&bounded_buffer_impl<elem_type>::not_empty, this);
+ bounded_buffer_detail(size_t capacity):
+ _buffer(capacity)
+ {
+ _not_full_fcn = boost::bind(&bounded_buffer_detail<elem_type>::not_full, this);
+ _not_empty_fcn = boost::bind(&bounded_buffer_detail<elem_type>::not_empty, this);
+ }
+
+ UHD_INLINE bool push_with_haste(const elem_type &elem){
+ boost::mutex::scoped_lock lock(_mutex);
+ if (_buffer.full()) return false;
+ _buffer.push_front(elem);
+ lock.unlock();
+ _empty_cond.notify_one();
+ return true;
}
UHD_INLINE bool push_with_pop_on_full(const elem_type &elem){
boost::mutex::scoped_lock lock(_mutex);
- if(_buffer.full()){
+ if (_buffer.full()){
_buffer.pop_back();
_buffer.push_front(elem);
lock.unlock();
@@ -54,6 +64,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE void push_with_wait(const elem_type &elem){
+ if (this->push_with_haste(elem)) return;
boost::mutex::scoped_lock lock(_mutex);
_full_cond.wait(lock, _not_full_fcn);
_buffer.push_front(elem);
@@ -62,6 +73,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE bool push_with_timed_wait(const elem_type &elem, double timeout){
+ if (this->push_with_haste(elem)) return true;
boost::mutex::scoped_lock lock(_mutex);
if (not _full_cond.timed_wait(
lock, to_time_dur(timeout), _not_full_fcn
@@ -72,7 +84,17 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
return true;
}
+ UHD_INLINE bool pop_with_haste(elem_type &elem){
+ boost::mutex::scoped_lock lock(_mutex);
+ if (_buffer.empty()) return false;
+ elem = this->pop_back();
+ lock.unlock();
+ _full_cond.notify_one();
+ return true;
+ }
+
UHD_INLINE void pop_with_wait(elem_type &elem){
+ if (this->pop_with_haste(elem)) return;
boost::mutex::scoped_lock lock(_mutex);
_empty_cond.wait(lock, _not_empty_fcn);
elem = this->pop_back();
@@ -81,6 +103,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
}
UHD_INLINE bool pop_with_timed_wait(elem_type &elem, double timeout){
+ if (this->pop_with_haste(elem)) return true;
boost::mutex::scoped_lock lock(_mutex);
if (not _empty_cond.timed_wait(
lock, to_time_dur(timeout), _not_empty_fcn
@@ -91,13 +114,6 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
return true;
}
- UHD_INLINE void clear(void){
- boost::mutex::scoped_lock lock(_mutex);
- while (not_empty()) this->pop_back();
- lock.unlock();
- _full_cond.notify_one();
- }
-
private:
boost::mutex _mutex;
boost::condition _empty_cond, _full_cond;
@@ -128,13 +144,4 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/
};
}}} //namespace
-namespace uhd{ namespace transport{
-
- template <typename elem_type> typename bounded_buffer<elem_type>::sptr
- bounded_buffer<elem_type>::make(size_t capacity){
- return typename bounded_buffer<elem_type>::sptr(new bounded_buffer_impl<elem_type>(capacity));
- }
-
-}} //namespace
-
#endif /* INCLUDED_UHD_TRANSPORT_BOUNDED_BUFFER_IPP */
diff --git a/host/include/uhd/transport/zero_copy.hpp b/host/include/uhd/transport/zero_copy.hpp
index 7d8fb4b83..092028d09 100644
--- a/host/include/uhd/transport/zero_copy.hpp
+++ b/host/include/uhd/transport/zero_copy.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -19,10 +19,8 @@
#define INCLUDED_UHD_TRANSPORT_ZERO_COPY_HPP
#include <uhd/config.hpp>
-#include <boost/asio/buffer.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
-#include <boost/function.hpp>
namespace uhd{ namespace transport{
@@ -31,23 +29,9 @@ namespace uhd{ namespace transport{
* Contains a reference to transport-managed memory,
* and a method to release the memory after reading.
*/
- class UHD_API managed_recv_buffer : boost::noncopyable{
+ class UHD_API managed_recv_buffer{
public:
typedef boost::shared_ptr<managed_recv_buffer> sptr;
- typedef boost::function<void(void)> release_fcn_t;
-
- /*!
- * Make a safe managed receive buffer:
- * A safe managed buffer ensures that release is called once,
- * either by the user or automatically upon deconstruction.
- * \param buff a reference to the constant buffer
- * \param release_fcn callback to release the memory
- * \return a new managed receive buffer
- */
- static sptr make_safe(
- const boost::asio::const_buffer &buff,
- const release_fcn_t &release_fcn
- );
/*!
* Signal to the transport that we are done with the buffer.
@@ -57,28 +41,24 @@ namespace uhd{ namespace transport{
virtual void release(void) = 0;
/*!
- * Get the size of the underlying buffer.
- * \return the number of bytes
- */
- inline size_t size(void) const{
- return boost::asio::buffer_size(this->get());
- }
-
- /*!
* Get a pointer to the underlying buffer.
* \return a pointer into memory
*/
template <class T> inline T cast(void) const{
- return boost::asio::buffer_cast<T>(this->get());
+ return static_cast<T>(this->get_buff());
}
- private:
/*!
- * Get a reference to the internal const buffer.
- * The buffer has a reference to memory and a size.
- * \return a boost asio const buffer
+ * Get the size of the underlying buffer.
+ * \return the number of bytes
*/
- virtual const boost::asio::const_buffer &get(void) const = 0;
+ inline size_t size(void) const{
+ return this->get_size();
+ }
+
+ private:
+ virtual const void *get_buff(void) const = 0;
+ virtual size_t get_size(void) const = 0;
};
/*!
@@ -86,24 +66,9 @@ namespace uhd{ namespace transport{
* Contains a reference to transport-managed memory,
* and a method to commit the memory after writing.
*/
- class UHD_API managed_send_buffer : boost::noncopyable{
+ class UHD_API managed_send_buffer{
public:
typedef boost::shared_ptr<managed_send_buffer> sptr;
- typedef boost::function<void(size_t)> commit_fcn_t;
-
- /*!
- * Make a safe managed send buffer:
- * A safe managed buffer ensures that commit is called once,
- * either by the user or automatically upon deconstruction.
- * In the later case, the deconstructor will call commit(0).
- * \param buff a reference to the mutable buffer
- * \param commit_fcn callback to commit the memory
- * \return a new managed send buffer
- */
- static sptr make_safe(
- const boost::asio::mutable_buffer &buff,
- const commit_fcn_t &commit_fcn
- );
/*!
* Signal to the transport that we are done with the buffer.
@@ -114,28 +79,24 @@ namespace uhd{ namespace transport{
virtual void commit(size_t num_bytes) = 0;
/*!
- * Get the size of the underlying buffer.
- * \return the number of bytes
- */
- inline size_t size(void) const{
- return boost::asio::buffer_size(this->get());
- }
-
- /*!
* Get a pointer to the underlying buffer.
* \return a pointer into memory
*/
template <class T> inline T cast(void) const{
- return boost::asio::buffer_cast<T>(this->get());
+ return static_cast<T>(this->get_buff());
}
- private:
/*!
- * Get a reference to the internal mutable buffer.
- * The buffer has a reference to memory and a size.
- * \return a boost asio mutable buffer
+ * Get the size of the underlying buffer.
+ * \return the number of bytes
*/
- virtual const boost::asio::mutable_buffer &get(void) const = 0;
+ inline size_t size(void) const{
+ return this->get_size();
+ }
+
+ private:
+ virtual void *get_buff(void) const = 0;
+ virtual size_t get_size(void) const = 0;
};
/*!
diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt
index 51be164aa..c856e5568 100644
--- a/host/include/uhd/types/CMakeLists.txt
+++ b/host/include/uhd/types/CMakeLists.txt
@@ -26,6 +26,7 @@ INSTALL(FILES
metadata.hpp
otw_type.hpp
ranges.hpp
+ ref_vector.hpp
sensors.hpp
serial.hpp
stream_cmd.hpp
diff --git a/host/include/uhd/types/ref_vector.hpp b/host/include/uhd/types/ref_vector.hpp
new file mode 100644
index 000000000..bbfb5434d
--- /dev/null
+++ b/host/include/uhd/types/ref_vector.hpp
@@ -0,0 +1,85 @@
+//
+// Copyright 2011 Ettus Research LLC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#ifndef INCLUDED_UHD_TYPES_REF_VECTOR_HPP
+#define INCLUDED_UHD_TYPES_REF_VECTOR_HPP
+
+#include <uhd/config.hpp>
+
+namespace uhd{
+
+/*!
+ * Reference vector:
+ * - Provides a std::vector-like interface for an array.
+ * - Statically sized, and does not manage the memory.
+ */
+template <typename T> class UHD_API ref_vector{
+public:
+ /*!
+ * 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.
+ * Therefore: rv[n] == vec[n] and rv.size() == vec.size()
+ * \param vec 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];
+ }
+
+ //! The number of elements in this container
+ size_t size(void) const{
+ return _size;
+ }
+
+private:
+ const T _ptr;
+ typedef T* _mem_t;
+ const _mem_t _mem;
+ const size_t _size;
+};
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_TYPES_REF_VECTOR_HPP */
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.