From 35a0bce9f01e354c527806b4c8f6f2ef493db2f6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 29 Jun 2011 12:20:19 -0700 Subject: uhd: make sure things are initialized --- host/include/uhd/property_tree.ipp | 4 ++++ host/include/uhd/utils/msg.hpp | 3 +++ 2 files changed, 7 insertions(+) (limited to 'host/include') diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp index 5fbb2dda5..58ee2339c 100644 --- a/host/include/uhd/property_tree.ipp +++ b/host/include/uhd/property_tree.ipp @@ -18,6 +18,7 @@ #ifndef INCLUDED_UHD_PROPERTY_TREE_IPP #define INCLUDED_UHD_PROPERTY_TREE_IPP +#include #include #include @@ -58,6 +59,9 @@ public: } T get(void) const{ + if (_publisher.empty() and _value.get() == NULL) throw uhd::runtime_error( + "Called get() on property with an uninitialized value" + ); return _publisher.empty()? *_value : _publisher(); } diff --git a/host/include/uhd/utils/msg.hpp b/host/include/uhd/utils/msg.hpp index 71d2cb35e..b0f00e13d 100644 --- a/host/include/uhd/utils/msg.hpp +++ b/host/include/uhd/utils/msg.hpp @@ -30,6 +30,9 @@ #define UHD_MSG(type) \ uhd::msg::_msg(uhd::msg::type)() +//! Helpful debug tool to print site info +#define UHD_HERE() \ + UHD_MSG(status) << __FILE__ << ":" << __LINE__ << std::endl namespace uhd{ namespace msg{ -- cgit v1.2.3