All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
te::plugin::CppPluginEngine Class Reference

An abstract class for plugin engines. More...

#include <CppPluginEngine.h>

Inheritance diagram for te::plugin::CppPluginEngine:
te::plugin::AbstractPluginEngine

Public Member Functions

 CppPluginEngine ()
 
AbstractPluginload (const PluginInfo &pInfo)
 It try to create and load the informed plugin. More...
 
void unload (AbstractPlugin *plugin)
 It try to unload the informed plugin. More...
 
 ~CppPluginEngine ()
 Destructor. More...
 

Static Public Member Functions

static void getDefaultDirs (std::vector< std::string > &dirs)
 It returns the default plugins libraries search directories. More...
 
static std::string getPluginFileName (const std::string &libName)
 This method will help to form the library name wich contains the plugin. More...
 

Protected Attributes

std::vector< std::string > m_defaultSearchDirs
 The default plugin libraries search directories. More...
 

Detailed Description

An abstract class for plugin engines.

A plugin engine for plugins written in C++.

For each kind of programming language there will be an specific engine capable of loading and preparing the plugin before the startup method is called.

,

See Also
Plugin, PluginInfo, PluginEngineFactory, CppPluginEngine
Plugin, PluginInfo, PluginEngineFactory, PluginEngine

Definition at line 50 of file CppPluginEngine.h.

Constructor & Destructor Documentation

te::plugin::CppPluginEngine::CppPluginEngine ( )

Default construtor.

Definition at line 47 of file CppPluginEngine.cpp.

References getDefaultDirs(), and m_defaultSearchDirs.

te::plugin::CppPluginEngine::~CppPluginEngine ( )
inline

Destructor.

Definition at line 58 of file CppPluginEngine.h.

Member Function Documentation

void te::plugin::CppPluginEngine::getDefaultDirs ( std::vector< std::string > &  dirs)
static

It returns the default plugins libraries search directories.

This method will generate directory paths for the sub-directories ".", "lib", "win32", "win64" and the macro TE_DEFAULT_PLUGINS_DIR within:

  • The current execution directory.
  • The enviromental variable with a name defined by the macro TE_DIR_ENVIRONMENT_VARIABLE
  • The enviromental variable "TERRALIB_DIR"
  • The macro TE_PLUGINS_PATH.
  • Directories listed by the environmental variable LD_LIBRARY_PATH.
  • Directories listed by the environmental variable PATH.
Parameters
dirsThe default plugin libraries search directories (the absolute path) or an empty string if none is found.

Definition at line 168 of file CppPluginEngine.cpp.

References te::common::GetDecompostedLDPathEnvVar(), te::common::GetDecompostedPathEnvVar(), and TE_DEFAULT_PLUGINS_DIR.

Referenced by CppPluginEngine().

std::string te::plugin::CppPluginEngine::getPluginFileName ( const std::string &  libName)
static

This method will help to form the library name wich contains the plugin.

This method may append a prefix and suffix that are platform dependent and also the build mode: DEBUG or RELEASE.

Definition at line 156 of file CppPluginEngine.cpp.

References te::common::Library::getNativeName().

te::plugin::AbstractPlugin * te::plugin::CppPluginEngine::load ( const PluginInfo pInfo)
virtual

It try to create and load the informed plugin.

Parameters
pInfoThe information needed to create and load the plugin.
Returns
It returns a loaded plugin. The caller will take the ownership of the returned plugin.
Exceptions
ExceptionIt throws an exception if the plugin can not be loaded.
Note
If the parameter PluginInfo::m_folder does not contains the required plugin it may be searched and loaded using a set of default paths.

Implements te::plugin::AbstractPluginEngine.

Definition at line 52 of file CppPluginEngine.cpp.

References te::common::LibraryManager::add(), te::common::Singleton< LibraryManager >::getInstance(), te::plugin::PluginInfo::m_folder, te::plugin::PluginInfo::m_name, te::plugin::PluginInfo::m_resources, and TR_PLUGIN.

void te::plugin::CppPluginEngine::unload ( AbstractPlugin plugin)
virtual

It try to unload the informed plugin.

On success the informed plugin will be also destroyed and its pointer will be invalidated.

Parameters
pluginThe plugin to be unloaded.
Exceptions
ExceptionIt throws an exception if the plugin can not be unloaded.

Implements te::plugin::AbstractPluginEngine.

Definition at line 149 of file CppPluginEngine.cpp.

References te::plugin::AbstractPlugin::getInfo(), and te::plugin::PluginInfo::m_engine.

Member Data Documentation

std::vector< std::string > te::plugin::CppPluginEngine::m_defaultSearchDirs
protected

The default plugin libraries search directories.

Definition at line 91 of file CppPluginEngine.h.

Referenced by CppPluginEngine().


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