Ocean
Ocean::PluginManager Class Reference

This class implements a manager for all plugins available for the Ocean framework. More...

Inheritance diagram for Ocean::PluginManager:

Data Structures

class  Plugin
 This class implements a plugin interface. More...
 

Public Types

enum  PluginType {
  TYPE_UNKNOWN = 0 , TYPE_DEVICE = 1 << 0 , TYPE_INTERACTION = 1 << 1 , TYPE_MEDIA = 1 << 2 ,
  TYPE_RENDERING = 1 << 3 , TYPE_SCENEDESCRIPTION = 1 << 4 , TYPE_PHYSICS = 1 << 5 , TYPE_ANY = TYPE_DEVICE | TYPE_INTERACTION | TYPE_MEDIA | TYPE_RENDERING | TYPE_SCENEDESCRIPTION | TYPE_PHYSICS
}
 Definition of different plugin types. More...
 
enum  PluginPriority {
  PRIORITY_UNDEFINED , PRIORITY_LOW , PRIORITY_MEDIUM , PRIORITY_HIGH ,
  PRIORITY_VERY_HIGH
}
 Definition of different plugin load priority values. More...
 
typedef std::set< PluginTypePluginTypeSet
 Definition of a set holding plugin types. More...
 
typedef std::vector< std::string > Names
 Definition of a vector holding plugin names. More...
 

Public Member Functions

const std::string & fileExtension () const
 Returns the file extension for plugin files. More...
 
bool setPluginFileExtension (const std::string &extension)
 Sets the file extension for plugin files. More...
 
unsigned int collectPlugins (const std::string &directory, const bool removeAlreadyCollected=true)
 Collects all Ocean supported plugins available in a given directory. More...
 
bool loadPlugin (const std::string &name)
 Loads a specific plugin. More...
 
bool loadPlugins (const Names &names)
 Loads several plugins and uses the internal dependency order. More...
 
bool loadPlugins (const PluginType type)
 Loads all plugins with a specified type. More...
 
bool loadAllPlugins ()
 Loads all available plugins. More...
 
bool unloadAllPlugins ()
 Unloads all loaded plugins. More...
 
Names plugins () const
 Returns all available plugins. More...
 
Names loadedPlugins () const
 Returns all loaded plugins. More...
 
Names unloadedPlugins () const
 Returns all not loaded plugins. More...
 
void release ()
 Releases the plugin manager and unloads all plugins. More...
 

Private Types

typedef std::vector< PluginPlugins
 Definition of a vector holding plugin objects. More...
 
typedef std::set< PluginPluginSet
 Definition of a set holding plugin objects. More...
 

Private Member Functions

 PluginManager ()
 Creates a new plugin manager object. More...
 
 ~PluginManager ()
 Destructs a plugin manager object. More...
 

Static Private Member Functions

static bool determinePlugin (const std::string &filename, Plugin &plugin)
 Determines whether a given file is a plugin. More...
 
static bool determinePluginApple (const std::string &filename, Plugin &plugin)
 Determines whether a given file is a plugin (specialization for Apple platforms) More...
 
static PluginType translateType (const std::string &type)
 Translates a plugin type string to a plugin type id. More...
 

Private Attributes

Plugins collectedPlugins_
 Vector holding all collected plugins. More...
 
Plugins loadedPlugins_
 Vector holding all loaded plugins. More...
 
std::string pluginFileExtension_
 File extension for plugins. More...
 
Lock lock_
 Lock for the manager. More...
 

Friends

class Singleton< PluginManager >
 

Additional Inherited Members

- Static Public Member Functions inherited from Ocean::Singleton< PluginManager >
static PluginManagerget ()
 Returns a reference to the unique object. More...
 
- Protected Member Functions inherited from Ocean::Singleton< PluginManager >
 Singleton ()=default
 Default constructor. More...
 

Detailed Description

This class implements a manager for all plugins available for the Ocean framework.

Member Typedef Documentation

◆ Names

typedef std::vector<std::string> Ocean::PluginManager::Names

Definition of a vector holding plugin names.

◆ Plugins

typedef std::vector<Plugin> Ocean::PluginManager::Plugins
private

Definition of a vector holding plugin objects.

◆ PluginSet

typedef std::set<Plugin> Ocean::PluginManager::PluginSet
private

Definition of a set holding plugin objects.

◆ PluginTypeSet

Definition of a set holding plugin types.

Member Enumeration Documentation

◆ PluginPriority

Definition of different plugin load priority values.

Higher priority means that the plugin will be loaded earlier than plugins with lower priority.

Enumerator
PRIORITY_UNDEFINED 

Undefined plugin load priority.

PRIORITY_LOW 

Low plugin load priority.

PRIORITY_MEDIUM 

Medium plugin load priority.

PRIORITY_HIGH 

High plugin load priority.

PRIORITY_VERY_HIGH 

Very high plugin load priority.

◆ PluginType

Definition of different plugin types.

Enumerator
TYPE_UNKNOWN 

Unknown plugin type.

TYPE_DEVICE 

Device plugin.

TYPE_INTERACTION 

Interaction plugin.

TYPE_MEDIA 

Media plugin.

TYPE_RENDERING 

Rendering plugin.

TYPE_SCENEDESCRIPTION 

Scene description plugin.

TYPE_PHYSICS 

Physics plugin.

TYPE_ANY 

Any plugin.

Constructor & Destructor Documentation

◆ PluginManager()

Ocean::PluginManager::PluginManager ( )
private

Creates a new plugin manager object.

◆ ~PluginManager()

Ocean::PluginManager::~PluginManager ( )
private

Destructs a plugin manager object.

Member Function Documentation

◆ collectPlugins()

unsigned int Ocean::PluginManager::collectPlugins ( const std::string &  directory,
const bool  removeAlreadyCollected = true 
)

Collects all Ocean supported plugins available in a given directory.

Parameters
directoryPlugin directory
removeAlreadyCollectedState determining whether previous collected (but not loaded) plugins will be remove before
Returns
Number of collected plugins

◆ determinePlugin()

static bool Ocean::PluginManager::determinePlugin ( const std::string &  filename,
Plugin plugin 
)
staticprivate

Determines whether a given file is a plugin.

Parameters
filenameFilename of the potential plugin
pluginResulting plugin object, if succeeded
Returns
True, if succeeded

◆ determinePluginApple()

static bool Ocean::PluginManager::determinePluginApple ( const std::string &  filename,
Plugin plugin 
)
staticprivate

Determines whether a given file is a plugin (specialization for Apple platforms)

See also
determinePlugin()
Parameters
filenameFilename of the potential plugin
pluginResulting plugin object, if succeeded
Returns
True, if succeeded

◆ fileExtension()

const std::string & Ocean::PluginManager::fileExtension ( ) const
inline

Returns the file extension for plugin files.

Returns
File extension of plugins

◆ loadAllPlugins()

bool Ocean::PluginManager::loadAllPlugins ( )

Loads all available plugins.

Returns
True, if at least one plugin has been loaded

◆ loadedPlugins()

Names Ocean::PluginManager::loadedPlugins ( ) const

Returns all loaded plugins.

Returns
Plugin names

◆ loadPlugin()

bool Ocean::PluginManager::loadPlugin ( const std::string &  name)

Loads a specific plugin.

Parameters
nameThe name of the plugin to load.
Returns
True, if succeeded

◆ loadPlugins() [1/2]

bool Ocean::PluginManager::loadPlugins ( const Names names)

Loads several plugins and uses the internal dependency order.

Parameters
namesNames of the plugins to load
Returns
True, if at least one plugin has been loaded

◆ loadPlugins() [2/2]

bool Ocean::PluginManager::loadPlugins ( const PluginType  type)

Loads all plugins with a specified type.

Parameters
typePlugin type to load, can be a combination of all defined plugin types
Returns
True, if at least one plugin has been loaded

◆ plugins()

Names Ocean::PluginManager::plugins ( ) const

Returns all available plugins.

Returns
Plugin names

◆ release()

void Ocean::PluginManager::release ( )

Releases the plugin manager and unloads all plugins.

◆ setPluginFileExtension()

bool Ocean::PluginManager::setPluginFileExtension ( const std::string &  extension)

Sets the file extension for plugin files.

Parameters
extensionFile extension to be set
Returns
True, if succeeded

◆ translateType()

static PluginType Ocean::PluginManager::translateType ( const std::string &  type)
staticprivate

Translates a plugin type string to a plugin type id.

Parameters
typePlugin type string to translate
Returns
Plugin type id

◆ unloadAllPlugins()

bool Ocean::PluginManager::unloadAllPlugins ( )

Unloads all loaded plugins.

Returns
True, if all plugins could be unloaded successfully

◆ unloadedPlugins()

Names Ocean::PluginManager::unloadedPlugins ( ) const

Returns all not loaded plugins.

Returns
Plugin names

Friends And Related Function Documentation

◆ Singleton< PluginManager >

friend class Singleton< PluginManager >
friend

Field Documentation

◆ collectedPlugins_

Plugins Ocean::PluginManager::collectedPlugins_
private

Vector holding all collected plugins.

◆ loadedPlugins_

Plugins Ocean::PluginManager::loadedPlugins_
private

Vector holding all loaded plugins.

◆ lock_

Lock Ocean::PluginManager::lock_
mutableprivate

Lock for the manager.

◆ pluginFileExtension_

std::string Ocean::PluginManager::pluginFileExtension_
private

File extension for plugins.


The documentation for this class was generated from the following file: