summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/exception.hpp33
-rw-r--r--host/include/uhd/usrp/gps_ctrl.hpp14
2 files changed, 40 insertions, 7 deletions
diff --git a/host/include/uhd/exception.hpp b/host/include/uhd/exception.hpp
index e2a50bf1e..10cd8f501 100644
--- a/host/include/uhd/exception.hpp
+++ b/host/include/uhd/exception.hpp
@@ -32,72 +32,105 @@
*
* The code() provides an error code which allows the application
* the option of printing a cryptic error message from the 1990s.
+ *
+ * The dynamic_clone() and dynamic_throw() methods allow us to:
+ * catch an exception by dynamic type (i.e. derived class), save it,
+ * and later rethrow it, knowing only the static type (i.e. base class),
+ * and then finally to catch it again using the derived type.
+ *
+ * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2106.html
*/
namespace uhd{
struct UHD_API exception : std::runtime_error{
exception(const std::string &what);
virtual unsigned code(void) const = 0;
+ virtual exception *dynamic_clone(void) const = 0;
+ virtual void dynamic_throw(void) const = 0;
};
struct UHD_API assertion_error : exception{
assertion_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual assertion_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API lookup_error : exception{
lookup_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual lookup_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API index_error : lookup_error{
index_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual index_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API key_error : lookup_error{
key_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual key_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API type_error : exception{
type_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual type_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API value_error : exception{
value_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual value_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API runtime_error : exception{
runtime_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual runtime_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API not_implemented_error : runtime_error{
not_implemented_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual not_implemented_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API environment_error : exception{
environment_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual environment_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API io_error : environment_error{
io_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual io_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API os_error : environment_error{
os_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual os_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
struct UHD_API system_error : exception{
system_error(const std::string &what);
virtual unsigned code(void) const;
+ virtual system_error *dynamic_clone(void) const;
+ virtual void dynamic_throw(void) const;
};
/*!
diff --git a/host/include/uhd/usrp/gps_ctrl.hpp b/host/include/uhd/usrp/gps_ctrl.hpp
index bd679b165..6ff00e03c 100644
--- a/host/include/uhd/usrp/gps_ctrl.hpp
+++ b/host/include/uhd/usrp/gps_ctrl.hpp
@@ -22,6 +22,8 @@
#include <boost/utility.hpp>
#include <boost/function.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <vector>
+#include <uhd/types/sensors.hpp>
using namespace boost::posix_time;
@@ -38,16 +40,14 @@ public:
static sptr make(gps_send_fn_t, gps_recv_fn_t);
/*!
- * Get the current GPS time and date
- * \return current GPS time and date as boost::posix_time::ptime object
+ * Retrieve the list of sensors this GPS object provides
*/
- virtual ptime get_time(void) = 0;
-
+ virtual std::vector<std::string> get_sensors(void) = 0;
+
/*!
- * Get the epoch time (as time_t, which is int)
- * \return current GPS time and date as time_t
+ * Retrieve the named sensor
*/
- virtual time_t get_epoch_time(void) = 0;
+ virtual uhd::sensor_value_t get_sensor(std::string key) = 0;
/*!
* Tell you if there's a supported GPS connected or not