|
From: Christian P. <cp...@se...> - 2005-01-11 16:09:17
|
Hi Stephan, Hi List,
I've added a method to Factory and some helper macros to make life easier when
registering named types and plugin types.
template <typename TypeName>
void registerType( const key_type & key, TypeName );
doesn't require passing Hook::FactoryCreateHook<InterfaceT,TypeName>::create.
--
class Base { };
class Bla : public Base { };
NamedTypeFactory<Base>::instance().registerType("Bla", Bla());
--
and this gets even simpler:
--
NAMEDTYPEFACTORY_REGISTER_TYPE(Base, Bla);
NAMEDTYPEFACTORY_REGISTER_ALIAS(Base, "AliasedBla", Bla);
--
While developing the ConsoleLogTarget plugin i've added two macros to make
plugin developers life really easy:
--
class MyBla: public Base { };
PLUGIN_REGISTER_TYPE(Base, MyBla);
PLUGIN_REGISTER_ALIAS(Base, "MyAliasedBla", MyBla);
--
Thats it ! No more hand-coded plugin-stub code.
Couldn't get any easier!
Damn.. i really love the new Plugin framework.
Greetings,
Christian
|