From 01fd6d52cefdb2baa7070b91ed483e9456141966 Mon Sep 17 00:00:00 2001 From: Brent Stapleton Date: Thu, 11 Apr 2019 11:36:31 -0700 Subject: 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. --- host/include/uhd/property_tree.hpp | 7 +++++++ host/include/uhd/property_tree.ipp | 6 ++++++ 2 files changed, 13 insertions(+) (limited to 'host/include') 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 property& access(const fs_path& path); + //! Pop a property off the tree, and returns the property + template + boost::shared_ptr > pop(const fs_path& path); + private: + //! Internal pop function + virtual boost::shared_ptr _pop(const fs_path& path) = 0; + //! Internal create property with wild-card type virtual void _create(const fs_path& path, const boost::shared_ptr& 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& property_tree::access(const fs_path& path) return *boost::static_pointer_cast >(this->_access(path)); } +template +typename boost::shared_ptr > property_tree::pop(const fs_path& path) +{ + return boost::static_pointer_cast >(this->_pop(path)); +} + } // namespace uhd #endif /* INCLUDED_UHD_PROPERTY_TREE_IPP */ -- cgit v1.2.3