aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/property_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/property_tree.cpp')
-rw-r--r--host/lib/property_tree.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/host/lib/property_tree.cpp b/host/lib/property_tree.cpp
index 07da0cf59..85868b27c 100644
--- a/host/lib/property_tree.cpp
+++ b/host/lib/property_tree.cpp
@@ -133,6 +133,29 @@ public:
return node->keys();
}
+ boost::shared_ptr<void> _pop(const fs_path& path_)
+ {
+ const fs_path path = _root / path_;
+ boost::mutex::scoped_lock lock(_guts->mutex);
+
+ node_type* parent = NULL;
+ node_type* node = &_guts->root;
+ for (const std::string& name : path_tokenizer(path)) {
+ if (not node->has_key(name))
+ throw_path_not_found(path);
+ parent = node;
+ node = &(*node)[name];
+ }
+
+ if (node->prop.get() == NULL)
+ throw uhd::runtime_error("Cannot access! Property uninitialized at: " + path);
+ if (parent == NULL)
+ throw uhd::runtime_error("Cannot pop");
+ auto prop = node->prop;
+ parent->pop(fs_path(path.leaf()));
+ return prop;
+ }
+
void _create(const fs_path& path_, const boost::shared_ptr<void>& prop)
{
const fs_path path = _root / path_;