[Home]Boost.Plugin

BOOST WIKI | RecentChanges | Preferences | Page List | Links List

Difference (from prior major revision) (no other diffs)

Changed: 36c36

Additional plugin information



Additional plugin information




Changed: 41c41

Generic trader



Generic trader




Boost.Plugin library

The purpose of this library is to allow creating classes defined in dynamic libraries by specifying string name of the class.

Use cases

Single creation

A user provides a name of class, a name of a shared library and a set of constructor arguments. The library returns a new class instance. Example usage:

 plugin<BasePlugin?> p("somelib.so", "SpecificType?");
 BasePlugin?* n = p.create(10);

This use case is important because in general user might have his own mechanism for tracking which libraries contain which classes.

Creation by name

User loads several libraries and then creates a class by name and a set of constructor arguments.

  plugin_registry<BasePlugin?> registry;
  registry.add("somelib.so");
  BasePlugin?* n = registry["SpecificType?"].create(10);

Note: the operator[] would return instance of 'plugin'. This is the primary use case for the library.

Internal classes creation

In addition to the above, it might be desirable to create by name classes defined in the same application, not only in some library. For example, a compiler might have a number of passes, and it's reasonable if each pass just registers itself with the global registry and is then created via that registry.

Additional plugin information

It might be desirable to attach extra information to a plugin, in a form of a string. Might be good to handle versioning, for example. Not sure about this.

Generic trader

It's possible to create a system where user ask for a specific "service" with specific properties, and the library searches for the right plugin. Such system can become contrived, and I think we should not implement it for the first version.


BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited May 11, 2005 8:22 am (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers