8#ifndef META_OCEAN_BASE_PLUGIN_MANAGER_H
9#define META_OCEAN_BASE_PLUGIN_MANAGER_H
130 inline const std::string&
filename()
const;
136 inline const std::string&
name()
const;
174#if defined(__APPLE__)
192#if defined(__APPLE__)
208 explicit operator bool()
const;
287 unsigned int collectPlugins(
const std::string& directory,
const bool removeAlreadyCollected =
true);
372 #if defined(__APPLE__)
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a plugin interface.
Definition PluginManager.h:88
const std::string & thirdpartyDependences() const
Returns the 3rd party dependences of this plugin.
Definition PluginManager.h:432
std::string name_
Name of the plugin.
Definition PluginManager.h:223
std::string thirdpartyDependences_
3rd party dependences.
Definition PluginManager.h:244
PluginLoadFunction loadFunction_
Plugin load function.
Definition PluginManager.h:250
bool unloadApple() const
Tries to unload the plugin.
void * handle_
Platform specific plugin handle.
Definition PluginManager.h:232
PluginUnloadFunction unloadFunction_
Plugin unload function.
Definition PluginManager.h:253
bool(*)() PluginUnloadFunction
Definition of a function pointer for plugin unload functions.
Definition PluginManager.h:99
const std::string & description() const
Returns the description of the plugin.
Definition PluginManager.h:417
bool unload() const
Tries to unload the plugin.
std::string description_
Description of the plugin.
Definition PluginManager.h:226
PluginType type() const
Returns the type of this plugin.
Definition PluginManager.h:427
const std::string & filename() const
Returns the filename of the plugin.
Definition PluginManager.h:407
const std::string & thirdpartyDescription() const
Returns the description about the 3rd party dependences of this plugin.
Definition PluginManager.h:437
Plugin(const std::string &filename, const std::string &name, const std::string &description, const PluginType type, const PluginPriority priority, const PluginTypeSet &dependencySet, const std::string &thirdpartyDependences, const std::string &thirdpartyDescription)
Creates a new plugin object.
const char *(*)() PluginVersionFunction
Definition of a function pointer for plugin version information functions.
Definition PluginManager.h:104
bool loadApple() const
Loads the plugin (specialization for Apple platforms).
bool operator<(const Plugin &right) const
Returns whether the left plugin has to be loaded before the right one.
PluginType type_
Plugin type.
Definition PluginManager.h:235
bool load() const
Loads the plugin.
const std::string & name() const
Returns the name of the plugin.
Definition PluginManager.h:412
PluginPriority priority_
Load priority of this plugin.
Definition PluginManager.h:241
std::string thirdpartyDescription_
3rd party description.
Definition PluginManager.h:247
PluginTypeSet dependencySet_
Set of plugin types this plugin depends on.
Definition PluginManager.h:238
Plugin()=default
Creates an empty plugin object.
const std::string & thirdpartyInformation() const
Returns the version information of the used 3rd party libraries.
Definition PluginManager.h:422
std::string thirdpartyInformation_
3rd party library version information.
Definition PluginManager.h:229
bool(*)() PluginLoadFunction
Definition of a function pointer for plugin load functions.
Definition PluginManager.h:94
std::string filename_
Filename of the plugin.
Definition PluginManager.h:220
std::set< PluginType > PluginTypeSet
Definition of a set holding plugin types.
Definition PluginManager.h:75
Plugins loadedPlugins_
Vector holding all loaded plugins.
Definition PluginManager.h:398
Names unloadedPlugins() const
Returns all not loaded plugins.
bool loadPluginSet(const PluginSet &pluginsToLoad)
Loads all plugins of a given set and moves the successfully loaded plugins from the collected plugins...
Lock lock_
Lock for the manager.
Definition PluginManager.h:404
bool unloadAllPlugins()
Unloads all loaded plugins.
bool loadPlugins(const PluginType type)
Loads all plugins with a specified type.
Strings Names
Definition of a vector holding plugin names.
Definition PluginManager.h:80
bool loadAllPlugins()
Loads all available plugins.
std::set< Plugin > PluginSet
Definition of a set holding plugin objects.
Definition PluginManager.h:264
std::vector< Plugin > Plugins
Definition of a vector holding plugin objects.
Definition PluginManager.h:259
~PluginManager()
Destructs a plugin manager object.
static bool determinePluginApple(const std::string &filename, Plugin &plugin)
Determines whether a given file is a plugin (specialization for Apple platforms).
PluginPriority
Definition of different plugin load priority values.
Definition PluginManager.h:59
@ PRIORITY_LOW
Low plugin load priority.
Definition PluginManager.h:63
@ PRIORITY_MEDIUM
Medium plugin load priority.
Definition PluginManager.h:65
@ PRIORITY_UNDEFINED
Undefined plugin load priority.
Definition PluginManager.h:61
@ PRIORITY_VERY_HIGH
Very high plugin load priority.
Definition PluginManager.h:69
@ PRIORITY_HIGH
High plugin load priority.
Definition PluginManager.h:67
bool setPluginFileExtension(const std::string &extension)
Sets the file extension for plugin files.
Plugins collectedPlugins_
Vector holding all collected plugins.
Definition PluginManager.h:395
Names loadedPlugins() const
Returns all loaded plugins.
Names plugins() const
Returns all available plugins.
void release()
Releases the plugin manager and unloads all plugins.
bool loadPlugins(const Names &names)
Loads several plugins and uses the internal dependency order.
static bool determinePlugin(const std::string &filename, Plugin &plugin)
Determines whether a given file is a plugin.
const std::string & fileExtension() const
Returns the file extension for plugin files.
Definition PluginManager.h:442
PluginType
Definition of different plugin types.
Definition PluginManager.h:35
@ TYPE_RENDERING
Rendering plugin.
Definition PluginManager.h:45
@ TYPE_UNKNOWN
Unknown plugin type.
Definition PluginManager.h:37
@ TYPE_MEDIA
Media plugin.
Definition PluginManager.h:43
@ TYPE_SCENEDESCRIPTION
Scene description plugin.
Definition PluginManager.h:47
@ TYPE_DEVICE
Device plugin.
Definition PluginManager.h:39
@ TYPE_PHYSICS
Physics plugin.
Definition PluginManager.h:49
@ TYPE_INTERACTION
Interaction plugin.
Definition PluginManager.h:41
@ TYPE_ANY
Any plugin.
Definition PluginManager.h:51
bool loadPlugin(const std::string &name)
Loads a specific plugin.
std::string pluginFileExtension_
File extension for plugins.
Definition PluginManager.h:401
PluginManager()
Creates a new plugin manager object.
static PluginType translateType(const std::string &type)
Translates a plugin type string to a plugin type id.
unsigned int collectPlugins(const std::string &directory, const bool removeAlreadyCollected=true)
Collects all Ocean supported plugins available in a given directory.
std::vector< std::string > Strings
Definition of a vector holding strings.
Definition Base.h:162
The namespace covering the entire Ocean framework.
Definition Accessor.h:15