summaryrefslogtreecommitdiff
path: root/include/gras/block.hpp
diff options
context:
space:
mode:
authorJosh Blum2013-06-05 10:44:00 -0700
committerJosh Blum2013-06-05 10:44:00 -0700
commit7889847eed1e8bc003b88b0d6ad4f7904873d2ac (patch)
tree4497b862f1e28faf585214e13ed124cf856323a5 /include/gras/block.hpp
parent4201e46df896d88ef39a3ccb3b57f7517932d5a2 (diff)
downloadsandhi-7889847eed1e8bc003b88b0d6ad4f7904873d2ac.tar.gz
sandhi-7889847eed1e8bc003b88b0d6ad4f7904873d2ac.tar.bz2
sandhi-7889847eed1e8bc003b88b0d6ad4f7904873d2ac.zip
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
Diffstat (limited to 'include/gras/block.hpp')
-rw-r--r--include/gras/block.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp
index 59c30c0..378358e 100644
--- a/include/gras/block.hpp
+++ b/include/gras/block.hpp
@@ -222,7 +222,8 @@ struct GRAS_API Block : Element
* \param which_output the index of the output port
* \param msg the message object to pass downstream
*/
- void post_output_msg(const size_t which_output, const PMCC &msg);
+ template <typename ValueType>
+ void post_output_msg(const size_t which_output, const ValueType &value);
/*!
* Pop a message from the specified port.
@@ -248,7 +249,8 @@ struct GRAS_API Block : Element
* \param which_input an input port on this block
* \param msg the message to post to the input port
*/
- void post_input_msg(const size_t which_input, const PMCC &tag);
+ template <typename ValueType>
+ void post_input_msg(const size_t which_input, const ValueType &value);
/*******************************************************************
* The property interface:
@@ -543,6 +545,8 @@ struct GRAS_API Block : Element
void _register_setter(const std::string &, void *);
virtual void _set_property(const std::string &, const PMCC &);
virtual PMCC _get_property(const std::string &);
+ void _post_output_msg(const size_t which_output, const PMCC &msg);
+ void _post_input_msg(const size_t which_input, const PMCC &msg);
};
} //namespace gras