diff options
author | Josh Blum | 2013-07-05 16:10:49 -0700 |
---|---|---|
committer | Josh Blum | 2013-07-05 16:10:49 -0700 |
commit | aa2c285ac86e5671fa418d336920c1c300cf9737 (patch) | |
tree | 33dfab03ddb43b4865ce59b89f421741460d6c24 /include/gras/callable.hpp | |
parent | e23e5f43a97c72f1bf0dd240376bf89ff19f356c (diff) | |
download | sandhi-aa2c285ac86e5671fa418d336920c1c300cf9737.tar.gz sandhi-aa2c285ac86e5671fa418d336920c1c300cf9737.tar.bz2 sandhi-aa2c285ac86e5671fa418d336920c1c300cf9737.zip |
gras: serious template insanity
Diffstat (limited to 'include/gras/callable.hpp')
-rw-r--r-- | include/gras/callable.hpp | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/include/gras/callable.hpp b/include/gras/callable.hpp index 6b2a3b6..32d6d17 100644 --- a/include/gras/callable.hpp +++ b/include/gras/callable.hpp @@ -39,46 +39,59 @@ struct GRAS_API Callable template <typename ClassType, typename ReturnType> void register_call(const std::string &key, ReturnType(ClassType::*fcn)(void)); - template <typename ClassType, typename ReturnType, typename Arg0> - void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &)); - - template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1> - void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &)); - template <typename ClassType> void register_call(const std::string &key, void(ClassType::*fcn)(void)); + template <typename ClassType, typename ReturnType, typename Arg0> + void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &)); + template <typename ClassType, typename Arg0> void register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &)); + template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1> + void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &)); + template <typename ClassType, typename Arg0, typename Arg1> void register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &, const Arg1 &)); + template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1, typename Arg2> + void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &)); + + template <typename ClassType, typename Arg0, typename Arg1, typename Arg2> + void register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &)); + /******************************************************************* * Call API - don't look here, template magic, not helpful ******************************************************************/ template <typename ReturnType> ReturnType call(const std::string &key); + inline + void call(const std::string &key); + template <typename ReturnType, typename Arg0> ReturnType call(const std::string &key, const Arg0 &); - template <typename ReturnType, typename Arg0, typename Arg1> - ReturnType call(const std::string &key, const Arg0 &, const Arg1 &); - - void call(const std::string &key); - template <typename Arg0> void call(const std::string &key, const Arg0 &); + template <typename ReturnType, typename Arg0, typename Arg1> + ReturnType call(const std::string &key, const Arg0 &, const Arg1 &); + template <typename Arg0, typename Arg1> void call(const std::string &key, const Arg0 &, const Arg1 &); + template <typename ReturnType, typename Arg0, typename Arg1, typename Arg2> + ReturnType call(const std::string &key, const Arg0 &, const Arg1 &, const Arg2 &); + + template <typename Arg0, typename Arg1, typename Arg2> + void call(const std::string &key, const Arg0 &, const Arg1 &, const Arg2 &); + /******************************************************************* * Private registration hooks ******************************************************************/ void _register_call(const std::string &, void *); - virtual PMCC _handle_call(const std::string &, const std::vector<PMCC> &); + virtual PMCC _handle_call(const std::string &, const PMCC *); void *_call_registry; }; |