Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
Typelib::PluginManager Class Reference

#include <pluginmanager.hh>

List of all members.

Public Types

typedef utilmm::singleton::use
< PluginManager
self

Public Member Functions

bool add (ExportPlugin *plugin)
bool add (ImportPlugin *plugin)
void add (TypeDefinitionPlugin *plugin)
Exporterexporter (std::string const &name) const
Importerimporter (std::string const &name) const
void registerPluginTypes (Registry &registry)

Static Public Member Functions

static Registryload (std::string const &kind, std::istream &stream)
static void load (std::string const &kind, std::istream &stream, Registry &into)
static Registryload (std::string const &kind, std::string const &file)
static void load (std::string const &kind, std::string const &file, Registry &into)
static Registryload (std::string const &kind, std::istream &stream, utilmm::config_set const &config)
static void load (std::string const &kind, std::istream &stream, utilmm::config_set const &config, Registry &into)
static Registryload (std::string const &kind, std::string const &file, utilmm::config_set const &config)
static void load (std::string const &kind, std::string const &file, utilmm::config_set const &config, Registry &into)
static std::string save (std::string const &kind, Registry const &registry)
static std::string save (std::string const &kind, utilmm::config_set const &config, Registry const &registry)
static void save (std::string const &kind, Registry const &registry, std::ostream &into)
static void save (std::string const &kind, utilmm::config_set const &config, Registry const &registry, std::ostream &into)

Private Types

typedef void(* PluginEntryPoint )(PluginManager &)

Private Member Functions

bool loadPlugin (std::string const &path)
bool loadPluginFromDirectory (std::string const &directory)
 PluginManager ()
 ~PluginManager ()

Private Attributes

std::vector
< TypeDefinitionPlugin * > 
m_definition_plugins
std::map< std::string,
ExportPlugin * > 
m_exporters
std::map< std::string,
ImportPlugin * > 
m_importers
std::vector< void * > m_library_handles

Friends

class utilmm::singleton::wrapper< PluginManager >

Detailed Description

The plugin manager

It is a singleton, using utilmm::singleton You have to access it using PluginManager::self manager;

manager->importer()

The object is destroyed when the last of the use<> objects is, and created back when a new use<> object is built.

Definition at line 48 of file pluginmanager.hh.


Member Typedef Documentation

Definition at line 57 of file pluginmanager.hh.

The one PluginManager object. See main PluginManager documentation for its use.

Definition at line 188 of file pluginmanager.hh.


Constructor & Destructor Documentation

Definition at line 40 of file pluginmanager.cc.

Definition at line 71 of file pluginmanager.cc.


Member Function Documentation

bool PluginManager::add ( ExportPlugin plugin)

Registers a new exporter

Definition at line 135 of file pluginmanager.cc.

bool PluginManager::add ( ImportPlugin plugin)

Registers a new importer

Definition at line 137 of file pluginmanager.cc.

Adds a type definition plugin. A type definition plugin defines a set of "default" types that gets added automatically to new registries

Definition at line 139 of file pluginmanager.cc.

Exporter * PluginManager::exporter ( std::string const &  name) const

Build a new export plugin from its plugin name

Exceptions:
PluginNotFound

Definition at line 153 of file pluginmanager.cc.

Importer * PluginManager::importer ( std::string const &  name) const

Build a new import plugin from its plugin name

Exceptions:
PluginNotFound

Definition at line 151 of file pluginmanager.cc.

Registry * PluginManager::load ( std::string const &  kind,
std::istream &  stream 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 180 of file pluginmanager.cc.

void PluginManager::load ( std::string const &  kind,
std::istream &  stream,
Registry into 
) [static]

Imports types from a istream object to an already existing registry

Definition at line 185 of file pluginmanager.cc.

Registry * PluginManager::load ( std::string const &  kind,
std::string const &  file 
) [static]

Creates a registry from a file

See also:
Importer::load

Definition at line 190 of file pluginmanager.cc.

void PluginManager::load ( std::string const &  kind,
std::string const &  file,
Registry into 
) [static]

Imports types from a file into an already existing registry

See also:
Importer::load

Definition at line 195 of file pluginmanager.cc.

Registry * PluginManager::load ( std::string const &  kind,
std::istream &  stream,
utilmm::config_set const &  config 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 201 of file pluginmanager.cc.

void PluginManager::load ( std::string const &  kind,
std::istream &  stream,
utilmm::config_set const &  config,
Registry into 
) [static]

Imports types from a istream object to an already existing registry

Definition at line 207 of file pluginmanager.cc.

Registry * PluginManager::load ( std::string const &  kind,
std::string const &  file,
utilmm::config_set const &  config 
) [static]

Creates a registry from a file

See also:
Importer::load

Definition at line 213 of file pluginmanager.cc.

void PluginManager::load ( std::string const &  kind,
std::string const &  file,
utilmm::config_set const &  config,
Registry into 
) [static]

Imports types from a file into an already existing registry

See also:
Importer::load

Definition at line 219 of file pluginmanager.cc.

bool PluginManager::loadPlugin ( std::string const &  path) [private]

Definition at line 113 of file pluginmanager.cc.

bool PluginManager::loadPluginFromDirectory ( std::string const &  directory) [private]

uses "loadPlugin" to try to load all "*.so" or "*.dylib" files in the given directory

Parameters:
directoryplace to look for "*.so" or "*.dylib" dynamic libraries
Returns:
true if any plugin could be loaded, false if no plugin could be loaded (and prints a warning)

Definition at line 91 of file pluginmanager.cc.

Adds the types from the type definition plugins to registry

Definition at line 142 of file pluginmanager.cc.

std::string PluginManager::save ( std::string const &  kind,
Registry const &  registry 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is provided for backward compatibility only

Definition at line 157 of file pluginmanager.cc.

std::string PluginManager::save ( std::string const &  kind,
utilmm::config_set const &  config,
Registry const &  registry 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 163 of file pluginmanager.cc.

void PluginManager::save ( std::string const &  kind,
Registry const &  registry,
std::ostream &  into 
) [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is provided for backward compatibility only

Definition at line 169 of file pluginmanager.cc.

void PluginManager::save ( std::string const &  kind,
utilmm::config_set const &  config,
Registry const &  registry,
std::ostream &  into 
) [static]

Exports a registry to an ostream object

  • kind the output format. It has to be a valid exporter name
  • config format-specific configuration. See each exporter documentation for details.
  • registry the registry to export
  • into the ostream object to export to
    Exceptions:
    PluginNotFoundif kind is invalid
    UnsupportedTypeif a specific type cannot be exported into this format
    ExportErrorif another error occured during the export

Definition at line 174 of file pluginmanager.cc.


Friends And Related Function Documentation

friend class utilmm::singleton::wrapper< PluginManager > [friend]

Definition at line 191 of file pluginmanager.hh.


Member Data Documentation

Definition at line 52 of file pluginmanager.hh.

std::map<std::string, ExportPlugin*> Typelib::PluginManager::m_exporters [private]

Definition at line 50 of file pluginmanager.hh.

std::map<std::string, ImportPlugin*> Typelib::PluginManager::m_importers [private]

Definition at line 51 of file pluginmanager.hh.

std::vector<void*> Typelib::PluginManager::m_library_handles [private]

Definition at line 53 of file pluginmanager.hh.


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


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 18:49:23