aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-06-29 12:20:19 -0700
committerJosh Blum <josh@joshknows.com>2011-06-29 12:20:19 -0700
commit35a0bce9f01e354c527806b4c8f6f2ef493db2f6 (patch)
tree8986bd9e104f06fc9cda77d27bb2bf8dd07d9b05 /host/include
parent54b8be72fd07bb51568ad5c4bad678b081a8dbe5 (diff)
downloaduhd-35a0bce9f01e354c527806b4c8f6f2ef493db2f6.tar.gz
uhd-35a0bce9f01e354c527806b4c8f6f2ef493db2f6.tar.bz2
uhd-35a0bce9f01e354c527806b4c8f6f2ef493db2f6.zip
uhd: make sure things are initialized
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/property_tree.ipp4
-rw-r--r--host/include/uhd/utils/msg.hpp3
2 files changed, 7 insertions, 0 deletions
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 <uhd/exception.hpp>
#include <boost/foreach.hpp>
#include <vector>
@@ -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{