22 #ifndef LUNCHBOX_PLUGINFACTORY_H
23 #define LUNCHBOX_PLUGINFACTORY_H
26 #include <lunchbox/algorithm.h>
27 #include <lunchbox/debug.h>
28 #include <lunchbox/dso.h>
29 #include <lunchbox/file.h>
30 #include <servus/uri.h>
32 #include <boost/foreach.hpp>
33 #include <boost/lexical_cast.hpp>
34 #include <boost/noncopyable.hpp>
35 #include <boost/unordered_map.hpp>
58 template<
class PluginT,
class InitDataT = servus::URI >
63 typedef std::vector< PluginHolder > Plugins;
76 PluginT*
create(
const InitDataT& initData );
106 DSOs
load(
const int version,
const std::string& path,
107 const std::string& pattern );
108 DSOs
load(
const int version,
const Strings& paths,
109 const std::string& pattern );
121 #pragma warning( disable: 4251 )
123 typedef boost::unordered_map< DSO*, PluginHolder > PluginMap;
124 PluginMap _libraries;
125 #pragma warning( default: 4251 )
127 void _load( DSOs& result,
const int version,
const std::string& path,
128 const std::string& pattern );
135 #include "pluginFactory.ipp"
137 #endif // LUNCHBOX_PLUGINFACTORY_H
Helper to access dynamic shared objects (DSO)
Basic type definitions not provided by the operating system.
DSOs load(const int version, const std::string &path, const std::string &pattern)
Load all compatible plugin libraries from a directory matching a pattern.
std::vector< std::string > Strings
A vector of std::strings.
PluginT * create(const InitDataT &initData)
Create a plugin instance.
Factory for Plugin classes.
bool deregister(const Plugin< PluginT, InitDataT > &plugin)
Deregister a plugin type.
bool unload(DSO *dso)
Unload and deregister a previously loaded plugin.
Abstraction layer and common utilities for multi-threaded programming.
Manages a class deriving from a PluginT interface.
static PluginFactory & getInstance()
Get the single class instance.
void register_(const Plugin< PluginT, InitDataT > &plugin)
Register a plugin type.
void deregisterAll()
Unregister all plugin types.