From 9ea77e78ade12ed5402ed9f3df1f10d9d4d27559 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 22 Mar 2013 01:54:16 -0700 Subject: gras: we now have the element tree interface --- lib/block_props.cpp | 47 +---------------------------------------------- 1 file changed, 1 insertion(+), 46 deletions(-) (limited to 'lib/block_props.cpp') diff --git a/lib/block_props.cpp b/lib/block_props.cpp index ab8b642..672200b 100644 --- a/lib/block_props.cpp +++ b/lib/block_props.cpp @@ -2,8 +2,6 @@ #include "element_impl.hpp" #include -#include -#include using namespace gras; @@ -76,51 +74,8 @@ struct PropAccessReceiver : Theron::Receiver * Handle the get and set calls from the user's call-stack **********************************************************************/ template -static PMCC prop_access_dispatcher(ActorType &actor, const std::string &path, const PMCC &value, const bool set) +static PMCC prop_access_dispatcher(ActorType &actor, const std::string &key, const PMCC &value, const bool set) { - //split the paths into nodes - std::vector nodes; - boost::split(nodes, path, boost::is_any_of("/")); - - //iterate through the path to find the element - std::string key; - Element elem = *(actor->block_ptr); - size_t i = 0; - BOOST_FOREACH(const std::string &node, nodes) - { - i++; - if (node == "" and i == 1) //find root - { - while (elem->_parent) elem = elem->_parent; - continue; - } - if (node == ".") //this dir - { - continue; - } - if (node == "..") //up a dir - { - if (not elem->_parent) throw std::runtime_error( - "Property tree lookup fail - null parent: " + path - ); - elem = elem->_parent; - continue; - } - if (i == nodes.size() or elem->block) //leaf - { - key = node; - if (i != nodes.size() or not elem->block) throw std::runtime_error( - "Property tree lookup fail - beyond leaf: " + path - ); - continue; - } - if (elem->_subelems.count(node) == 0) throw std::runtime_error( - "Property tree lookup fail - no such path: " + path - ); - elem = elem->_subelems[node]; - } - - //now send a message to the actor to perform the action PropAccessReceiver receiver; PropAccessMessage message; message.set = set; -- cgit