summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJosh Blum2013-03-22 00:45:04 -0700
committerJosh Blum2013-03-22 00:45:04 -0700
commita54708334425472d277e77c394688bab4cac607a (patch)
tree9ab28fae5f1d4b964da6cdfbbff1ae937e28b700 /lib
parent7efd7630b87c2ab1716ede4079b5840e730921db (diff)
downloadsandhi-a54708334425472d277e77c394688bab4cac607a.tar.gz
sandhi-a54708334425472d277e77c394688bab4cac607a.tar.bz2
sandhi-a54708334425472d277e77c394688bab4cac607a.zip
gras: quick prop tree unit test + fixes
Diffstat (limited to 'lib')
-rw-r--r--lib/block_props.cpp8
-rw-r--r--lib/hier_block.cpp1
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/block_props.cpp b/lib/block_props.cpp
index 0f571af..ab8b642 100644
--- a/lib/block_props.cpp
+++ b/lib/block_props.cpp
@@ -92,6 +92,7 @@ static PMCC prop_access_dispatcher(ActorType &actor, const std::string &path, co
if (node == "" and i == 1) //find root
{
while (elem->_parent) elem = elem->_parent;
+ continue;
}
if (node == ".") //this dir
{
@@ -109,9 +110,14 @@ static PMCC prop_access_dispatcher(ActorType &actor, const std::string &path, co
{
key = node;
if (i != nodes.size() or not elem->block) throw std::runtime_error(
- "Property tree lookup fail - beyond leaf" + path
+ "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
diff --git a/lib/hier_block.cpp b/lib/hier_block.cpp
index 52b6834..cfaca86 100644
--- a/lib/hier_block.cpp
+++ b/lib/hier_block.cpp
@@ -88,5 +88,6 @@ void HierBlock::register_subelement(const std::string &node, const Element &sube
% subelem.to_string()
% subelem->_parent.to_string()
));
+ subelem->_parent = *this;
(*this)->_subelems[node] = subelem;
}