diff options
author | Josh Blum | 2013-07-30 20:59:41 -0700 |
---|---|---|
committer | Josh Blum | 2013-07-30 20:59:41 -0700 |
commit | 17d636eec0ee0da346173066dd4f400a64e96c44 (patch) | |
tree | 719ec814b166e4d9c8fcb4f36413d95ba7070296 /tmpl/factory.tmpl.hpp | |
parent | 3782b3a9a844d32a277adbbfad98bf64b4cb227c (diff) | |
download | sandhi-17d636eec0ee0da346173066dd4f400a64e96c44.tar.gz sandhi-17d636eec0ee0da346173066dd4f400a64e96c44.tar.bz2 sandhi-17d636eec0ee0da346173066dd4f400a64e96c44.zip |
gras: rename some factory functions
Diffstat (limited to 'tmpl/factory.tmpl.hpp')
-rw-r--r-- | tmpl/factory.tmpl.hpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tmpl/factory.tmpl.hpp b/tmpl/factory.tmpl.hpp index 148a851..a8f0b5d 100644 --- a/tmpl/factory.tmpl.hpp +++ b/tmpl/factory.tmpl.hpp @@ -17,7 +17,7 @@ namespace gras * - Call make() to create element from global factory. * * Example register a factory function: - * gras::Factory::register_make("/proj/my_block", &make_my_block); + * gras::Factory::register_factory("/proj/my_block", &make_my_block); * * Example call into the factory: * gras::Element *my_block = gras::Factory::make("/proj/my_block", arg0, arg1); @@ -27,7 +27,7 @@ struct GRAS_API Factory /******************************************************************* * Private registration hooks ******************************************************************/ - static void _register_make(const std::string &, void *); + static void _register_factory(const std::string &, void *); static Element *_handle_make(const std::string &, const PMCC &); }; @@ -36,7 +36,7 @@ struct GRAS_API Factory **********************************************************************/ #for $NARGS in range($MAX_ARGS) template <typename ReturnType, $expand('typename A%d', $NARGS)> -static void register_make(const std::string &name, ReturnType(*fcn)($expand('const A%d &', $NARGS))); +static void register_factory(const std::string &path, ReturnType(*fcn)($expand('const A%d &', $NARGS))); #end for /*********************************************************************** @@ -44,7 +44,7 @@ static void register_make(const std::string &name, ReturnType(*fcn)($expand('con **********************************************************************/ #for $NARGS in range($MAX_ARGS) template <$expand('typename A%d', $NARGS)> -static Element *make(const std::string &name, $expand('const A%d &', $NARGS)); +static Element *make(const std::string &path, $expand('const A%d &', $NARGS)); #end for } @@ -54,9 +54,9 @@ static Element *make(const std::string &name, $expand('const A%d &', $NARGS)); * Declare this macro at the global scope in a cpp file. * The block will register at static initialization time. */ -#define GRAS_REGISTER_FACTORY(name, fcn) \ +#define GRAS_REGISTER_FACTORY(path, fcn) \ GRAS_STATIC_BLOCK(fcn) \ - {gras::register_make(name, &fcn);} + {gras::register_factory(path, &fcn);} #for $NARGS in range($MAX_ARGS) /*! @@ -66,10 +66,10 @@ static Element *make(const std::string &name, $expand('const A%d &', $NARGS)); * Declare this macro at the global scope in a cpp file. * The block will register at static initialization time. */ -#define GRAS_REGISTER_FACTORY$(NARGS)(name, type, $expand('A%d', $NARGS)) \ +#define GRAS_REGISTER_FACTORY$(NARGS)(path, type, $expand('A%d', $NARGS)) \ static gras::Element *make_ $('##') type($expand('const A%d &a%d', $NARGS)) \ { return new type($expand('a%d', $NARGS)); } \ - GRAS_REGISTER_FACTORY(name, make_$('##')type) + GRAS_REGISTER_FACTORY(path, make_$('##')type) #end for #include <gras/detail/factory.hpp> |