OpendTect-6_4  6.4
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
PluginManager Class Reference

Plugin manager - loads plugins: shared libs or DLLs. More...

Classes

struct  Data
 

Public Member Functions

void loadAuto (bool late)
 see class comments More...
 
bool load (const char *libnm)
 Explicit load of a plugin. More...
 
ObjectSet< Data > & getData ()
 
DatafindData (const char *nm)
 
const DatafindData (const char *nm) const
 
const DatafindDataWithDispName (const char *) const
 
bool isPresent (const char *) const
 
const char * userName (const char *) const
 
const char * getFileName (const Data &) const
 
const char * getAutoDir (bool usr) const
 
void getNotLoadedByUser (BufferStringSet &) const
 

Static Public Member Functions

static PluginManagergetInstance ()
 
static const char * moduleName (const char *)
 returns without path, 'lib' and extension More...
 
static const char * sKeyDontLoad ()
 

Private Member Functions

 PluginManager ()
 
DatafndData (const char *) const
 
void getDefDirs ()
 
void getALOEntries (const char *, bool)
 
void openALOEntries ()
 
void mkALOList ()
 

Private Attributes

ObjectSet< Datadata_
 
BufferString userdir_
 
BufferString appdir_
 
BufferString userlibdir_
 
BufferString applibdir_
 

Friends

PluginManagerPIM ()
 

Detailed Description

Plugin manager - loads plugins: shared libs or DLLs.

Note: there are macros making most of the below stuff not interesting. See header file odplugin.h.

For shared libs to be in any way useful, an init function must be called. The name of that function should predictable. It is constructed as follows: InitxxxPlugin where xxx is the name of the plugin file, where: libxxx.so -> xxx xxx.dll -> xxx etc.

The signature is:

extern "C" { const char* InitxxxPlugin(int,char**); }

Optional extras:

1) If you want the plugin to be loaded automatically at startup define:

extern "C" int GetxxxPluginType(void);

if not defined, PI_AUTO_INIT_NONE is assumed, which means it will not be loaded if not explicitly done so.

Loading from startup is done from $HOME/.od/plugins/$PLFSUBDIR/libs or $dGB_APPL/plugins/$PLFSUBDIR/libs. The plguniins in these directories will be loaded only if they are mentioned in a .alo file in the parent directory, $HOME/.od/plugins/$PLFSUBDIR or $dGB_APPL/plugins/$PLFSUBDIR. The alo files are handled in alphabetical order.

2) It may be a good idea to define a function:

extern "C" PluginInfo* GetxxxPluginInfo(void);

Make sure it returns an object of type PluginManager::Info*. Make sure it points to an existing object (static or made with new/malloc);

3) The user of PIM() can decide not to load all of the .alo load libs. After construction, the getData() list is filled. You can change the source_ to None before calling loadAuto().

Constructor & Destructor Documentation

PluginManager::PluginManager ( )
private

Member Function Documentation

Data* PluginManager::findData ( const char *  nm)
inline
const Data* PluginManager::findData ( const char *  nm) const
inline
const Data* PluginManager::findDataWithDispName ( const char *  ) const
Data* PluginManager::fndData ( const char *  ) const
private
void PluginManager::getALOEntries ( const char *  ,
bool   
)
private
const char* PluginManager::getAutoDir ( bool  usr) const
inline
ObjectSet<Data>& PluginManager::getData ( )
inline
void PluginManager::getDefDirs ( )
private
const char* PluginManager::getFileName ( const Data ) const
static PluginManager& PluginManager::getInstance ( )
static
void PluginManager::getNotLoadedByUser ( BufferStringSet ) const
bool PluginManager::isPresent ( const char *  ) const
bool PluginManager::load ( const char *  libnm)

Explicit load of a plugin.

void PluginManager::loadAuto ( bool  late)

see class comments

void PluginManager::mkALOList ( )
private
static const char* PluginManager::moduleName ( const char *  )
static

returns without path, 'lib' and extension

void PluginManager::openALOEntries ( )
private
static const char* PluginManager::sKeyDontLoad ( )
inlinestatic
const char* PluginManager::userName ( const char *  ) const

returns name in plugin-info, or moduleName if plugin info is not available.

Friends And Related Function Documentation

PluginManager& PIM ( )
friend

Member Data Documentation

BufferString PluginManager::appdir_
private
BufferString PluginManager::applibdir_
private
ObjectSet<Data> PluginManager::data_
private
BufferString PluginManager::userdir_
private
BufferString PluginManager::userlibdir_
private

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019