aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2019-04-11 11:36:31 -0700
committerMartin Braun <martin.braun@ettus.com>2019-05-02 08:39:54 -0700
commit01fd6d52cefdb2baa7070b91ed483e9456141966 (patch)
treef43dae9b6291c28108b3896641374d643c7c8ca4 /host/include
parentd44277d7ac7acc621442fe7ef4555f568fbe88d0 (diff)
downloaduhd-01fd6d52cefdb2baa7070b91ed483e9456141966.tar.gz
uhd-01fd6d52cefdb2baa7070b91ed483e9456141966.tar.bz2
uhd-01fd6d52cefdb2baa7070b91ed483e9456141966.zip
prop_tree: add pop() function
Adding pop function to property tree, which will remove and return a property from the property tree. This also includes unit tests.
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/property_tree.hpp7
-rw-r--r--host/include/uhd/property_tree.ipp6
2 files changed, 13 insertions, 0 deletions
diff --git a/host/include/uhd/property_tree.hpp b/host/include/uhd/property_tree.hpp
index 42e73458f..11b92393a 100644
--- a/host/include/uhd/property_tree.hpp
+++ b/host/include/uhd/property_tree.hpp
@@ -243,7 +243,14 @@ public:
template <typename T>
property<T>& access(const fs_path& path);
+ //! Pop a property off the tree, and returns the property
+ template <typename T>
+ boost::shared_ptr<property<T> > pop(const fs_path& path);
+
private:
+ //! Internal pop function
+ virtual boost::shared_ptr<void> _pop(const fs_path& path) = 0;
+
//! Internal create property with wild-card type
virtual void _create(const fs_path& path, const boost::shared_ptr<void>& prop) = 0;
diff --git a/host/include/uhd/property_tree.ipp b/host/include/uhd/property_tree.ipp
index de1ac28c0..ca5d6904f 100644
--- a/host/include/uhd/property_tree.ipp
+++ b/host/include/uhd/property_tree.ipp
@@ -192,6 +192,12 @@ property<T>& property_tree::access(const fs_path& path)
return *boost::static_pointer_cast<property<T> >(this->_access(path));
}
+template <typename T>
+typename boost::shared_ptr<property<T> > property_tree::pop(const fs_path& path)
+{
+ return boost::static_pointer_cast<property<T> >(this->_pop(path));
+}
+
} // namespace uhd
#endif /* INCLUDED_UHD_PROPERTY_TREE_IPP */