|
Boost : |
Subject: Re: [boost] Any interest in static plugins?
From: Vicente Botet Escriba (vicente.botet_at_[hidden])
Date: 2009-11-30 07:43:46
Dave van Soest wrote:
>
> Hi Christian, Darryl, and anyone else interested,
>
>>> You may get more response if you posted or linked to some motivational
>>> examples.
>>
>> +1 on the examples. So far I'm merely intrigued to understand what the
>> library is/does.
>
> <snip>
>
> The factory manager for 'ObjectBase' derivatives, which follows the
> singleton pattern, can be used from your program as follows (note: again
> this code is simplified):
>
> ---- Start of code sample 3 ----
> #include <static_plugin.hpp>
> #include "ObjectBase.hpp"
>
> typedef FactoryManager<ObjectBase> ObjectBaseFM;
>
> int main(void) {
> const ObjectBaseFM& fm(getFactoryManager<ObjectBase>());
> assert(fm.factoryCount() > 0);
> ObjectBase::IdType id(fm.factoryIdList().at(0));
> std::auto_ptr<ObjectBase> object(fm.create(id));
> object->doSomething();
> return 0;
> }
> ---- End of code sample 3 ----
>
> The only requirements are that ObjectBase defines the IdType type and
> SomeObject contains a static member of type IdType called 'id'. The
> declaration of the static_plugin::Creator<...> causes the SomeObject
> plugin to be registered.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
Hi,
I don't know if this is really related or not, there is a Functional/Factory
library accepted in Boost.
In case this can help you,
Vicente
-- View this message in context: http://old.nabble.com/Any-interest-in-static-plugins--tp26536909p26574107.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk