From: Christian P. <cp...@us...> - 2005-01-10 13:01:09
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14506/include/pclasses/Plugin Modified Files: Plugin.h Log Message: Added some NamedTypeFactory / Plugin registering helper macros Index: Plugin.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Plugin/Plugin.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Plugin.h 26 Dec 2004 06:01:52 -0000 1.12 +++ Plugin.h 10 Jan 2005 13:00:56 -0000 1.13 @@ -307,6 +307,30 @@ } // namespace Plugin +/* + The following two macros make plugin-developers life much easier ;-) + added by cproch +*/ + +//! Registers a type in the NamedTypeFactory on static initialization +/*! + \param b Basetype of the type to be registered + \param t Type to register +*/ +#define PLUGIN_REGISTER_TYPE(b, t) \ + void t##_Factory_init() { NAMEDTYPEFACTORY_REGISTER_TYPE(b, t); } \ + int t##_Factory_init_placeholder = ( t##_Factory_init(), 0 ); + +//! Registers a alias of a type in the NamedTypeFactory on static initialization +/*! + \param b Basetype of the type to be registered + \param a Type alias + \param t Type to register +*/ +#define PLUGIN_REGISTER_ALIAS(b, a, t) \ + void t##_Factory_init_##a() { NAMEDTYPEFACTORY_REGISTER_ALIAS(b, #a, t); } \ + int t##_Factory_init_placeholder_##a = ( t##_Factory_init_##a(), 0 ); + #ifndef PCLASSES_ENABLE_PLUGINS_FACTORY_HOOK # define PCLASSES_ENABLE_PLUGINS_FACTORY_HOOK 0 |