diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block_props.cpp | 14 | ||||
-rw-r--r-- | lib/gras_impl/block_actor.hpp | 3 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/block_props.cpp b/lib/block_props.cpp index 672200b..12ab339 100644 --- a/lib/block_props.cpp +++ b/lib/block_props.cpp @@ -42,7 +42,10 @@ void BlockActor::handle_prop_access( PMCC Block::_handle_prop_access(const std::string &key, const PMCC &value, const bool set) { - PropertyRegistrySptr pr = (*this)->block->prop_registry[key]; + PropertyRegistrySptr pr = (set)? + (*this)->block->setter_registry[key] : + (*this)->block->getter_registry[key] + ; if (not pr) throw std::invalid_argument("no property registered for key: " + key); if (set) { @@ -91,9 +94,14 @@ static PMCC prop_access_dispatcher(ActorType &actor, const std::string &key, con return receiver.message.value; } -void Block::_register_property(const std::string &key, PMCC pr) +void Block::_register_getter(const std::string &key, PMCC pr) { - (*this)->block->prop_registry[key] = pr.as<PropertyRegistrySptr>(); + (*this)->block->getter_registry[key] = pr.as<PropertyRegistrySptr>(); +} + +void Block::_register_setter(const std::string &key, PMCC pr) +{ + (*this)->block->setter_registry[key] = pr.as<PropertyRegistrySptr>(); } void Block::_set_property(const std::string &key, const PMCC &value) diff --git a/lib/gras_impl/block_actor.hpp b/lib/gras_impl/block_actor.hpp index e620d77..8a2d5ae 100644 --- a/lib/gras_impl/block_actor.hpp +++ b/lib/gras_impl/block_actor.hpp @@ -203,7 +203,8 @@ struct BlockActor : Apology::Worker std::vector<std::vector<OutputHintMessage> > output_allocation_hints; //property stuff - std::map<std::string, PropertyRegistrySptr> prop_registry; + std::map<std::string, PropertyRegistrySptr> getter_registry; + std::map<std::string, PropertyRegistrySptr> setter_registry; BlockStats stats; }; |