From 7889847eed1e8bc003b88b0d6ad4f7904873d2ac Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 5 Jun 2013 10:44:00 -0700 Subject: gras: created duck typed API for posting msgs Uses templates and template overloads in c++ User python duck typing in the python case. Cleans up post for #84 --- include/gras/detail/block.hpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'include/gras/detail') diff --git a/include/gras/detail/block.hpp b/include/gras/detail/block.hpp index d975b0f..3c85905 100644 --- a/include/gras/detail/block.hpp +++ b/include/gras/detail/block.hpp @@ -97,6 +97,42 @@ inline ValueType Block::get(const std::string &key) return this->_get_property(key).as(); } +template +inline void Block::post_output_msg(const size_t i, const ValueType &value) +{ + this->_post_output_msg(i, PMC_M(value)); +} + +template <> +inline void Block::post_output_msg(const size_t i, const PMCC &value) +{ + this->_post_output_msg(i, value); +} + +template <> +inline void Block::post_output_msg(const size_t i, const PMC &value) +{ + this->_post_output_msg(i, value); +} + +template +inline void Block::post_input_msg(const size_t i, const ValueType &value) +{ + this->_post_input_msg(i, PMC_M(value)); +} + +template <> +inline void Block::post_input_msg(const size_t i, const PMCC &value) +{ + this->_post_input_msg(i, value); +} + +template <> +inline void Block::post_input_msg(const size_t i, const PMC &value) +{ + this->_post_input_msg(i, value); +} + } //namespace gras #endif /*INCLUDED_GRAS_DETAIL_BLOCK_HPP*/ -- cgit