summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2013-07-03 18:37:57 -0700
committerJosh Blum2013-07-03 18:37:57 -0700
commitf8f7439031b92bb9e50a3c036c647f95be8bbb00 (patch)
tree6821cdabef006babda5e65c32185453c4b1d0810
parent1f8d397eb2ac57af561c60eb9adc6fd73826beb0 (diff)
downloadsandhi-f8f7439031b92bb9e50a3c036c647f95be8bbb00.tar.gz
sandhi-f8f7439031b92bb9e50a3c036c647f95be8bbb00.tar.bz2
sandhi-f8f7439031b92bb9e50a3c036c647f95be8bbb00.zip
gras: use the base class settings calls to cleanup code
-rw-r--r--lib/block_props.cpp10
-rw-r--r--lib/gras_impl/block_actor.hpp3
-rw-r--r--lib/top_block_query.cpp4
3 files changed, 7 insertions, 10 deletions
diff --git a/lib/block_props.cpp b/lib/block_props.cpp
index a85d948..ae687be 100644
--- a/lib/block_props.cpp
+++ b/lib/block_props.cpp
@@ -77,15 +77,15 @@ struct PropAccessReceiver : Theron::Receiver
/***********************************************************************
* Handle the get and set calls from the user's call-stack
**********************************************************************/
-PMCC BlockActor::prop_access_dispatcher(const std::string &key, const PMCC &value, const bool set)
+static PMCC prop_access_dispatcher(boost::shared_ptr<BlockActor> actor, const std::string &key, const PMCC &value, const bool set)
{
PropAccessReceiver receiver;
PropAccessMessage message;
- message.prio_token = this->prio_token;
+ message.prio_token = actor->prio_token;
message.set = set;
message.key = key;
message.value = value;
- this->GetFramework().Send(message, receiver.GetAddress(), this->GetAddress());
+ actor->GetFramework().Send(message, receiver.GetAddress(), actor->GetAddress());
receiver.Wait();
if (not receiver.message.error.empty())
{
@@ -106,10 +106,10 @@ void Block::_register_setter(const std::string &key, void *pr)
void Block::_set_property(const std::string &key, const PMCC &value)
{
- (*this)->block_actor->prop_access_dispatcher(key, value, true);
+ prop_access_dispatcher((*this)->block_actor, key, value, true);
}
PMCC Block::_get_property(const std::string &key)
{
- return (*this)->block_actor->prop_access_dispatcher(key, PMCC(), false);
+ return prop_access_dispatcher((*this)->block_actor, key, PMCC(), false);
}
diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp
index 840e8c2..9a5c7b8 100644
--- a/lib/gras_impl/block_actor.hpp
+++ b/lib/gras_impl/block_actor.hpp
@@ -102,9 +102,6 @@ struct BlockActor : Theron::Actor
{
data->block->work(data->input_items, data->output_items);
}
-
- //property stuff
- PMCC prop_access_dispatcher(const std::string &key, const PMCC &value, const bool set);
};
//-------------- common functions from this BlockActor class ---------//
diff --git a/lib/top_block_query.cpp b/lib/top_block_query.cpp
index f56184d..7707e32 100644
--- a/lib/top_block_query.cpp
+++ b/lib/top_block_query.cpp
@@ -186,11 +186,11 @@ static ptree query_props(ElementImpl *self, const ptree &query)
{
const std::type_info &t = actor->data->property_registry[prop_key].setter->type();
const PMCC p = ptree_to_pmc(query.get_child("value"), t);
- actor->prop_access_dispatcher(prop_key, p, true);
+ actor->data->block->Block::_set_property(prop_key, p);
}
else
{
- PMCC p = actor->prop_access_dispatcher(prop_key, PMC(), false);
+ PMCC p = actor->data->block->Block::_get_property(prop_key);
ptree v = pmc_to_ptree(p);
root.push_back(std::make_pair("block", query.get_child("block")));
root.push_back(std::make_pair("key", query.get_child("key")));