OpendTect 8.0
Loading...
Searching...
No Matches
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...

#include <plugins.h>

Inheritance diagram for PluginManager:
[legend]

Classes

class  Data
 

Public Member Functions

 ~PluginManager ()
 
DatafindData (const char *nm)
 
const DatafindData (const char *nm) const
 
const DatafindDataWithDispName (const char *) const
 
const char * getAutoDir (bool usr) const
 
ObjectSet< Data > & getData ()
 
BufferString getFileName (const Data &) const
 return filename with full path
 
void getNotLoadedByUser (BufferStringSet &) const
 
bool isPresent (const char *) const
 
bool load (const char *libnm)
 Explicit load of a plugin.
 
bool load (const char *libnm, Data::AutoSource, int autotype)
 
void loadAuto (bool late, bool withfilter=false)
 see class comments
 
bool unload (const char *libnm)
 Explicit unload of a plugin.
 
void unLoadAll ()
 
const char * userName (const char *) const
 
- Public Member Functions inherited from CallBacker
 CallBacker ()
 
 CallBacker (const CallBacker &)
 
virtual ~CallBacker ()
 
bool attachCB (const NotifierAccess &, const CallBack &, bool onlyifnew=false) const
 
bool attachCB (const NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false) const
 
void detachAllNotifiers () const
 Call from the destructor of your inherited object.
 
void detachCB (const NotifierAccess &, const CallBack &) const
 
void detachCB (const NotifierAccess *notif, const CallBack &cb) const
 
virtual bool isCapsule () const
 
bool isNotifierAttached (const NotifierAccess *) const
 Only for debugging purposes, don't use.
 
CallBackeroperator= (const CallBacker &)=delete
 
void stopReceivingNotifications () const
 
virtual CallBackertrueCaller ()
 

Static Public Member Functions

static const char * getApplDir ()
 
static PluginManagergetInstance ()
 
static const char * getUserDir ()
 
static const char * sKeyApplPluginDir ()
 
static const char * sKeyDontLoad ()
 
static const char * sKeyUserPluginDir ()
 
- Static Public Member Functions inherited from CallBacker
static void createReceiverForCurrentThread ()
 
static void removeReceiverForCurrentThread ()
 

Private Member Functions

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

Private Attributes

BufferString appdir_
 
BufferString applibdir_
 
ObjectSet< Datadata_
 
BufferString userdir_
 
BufferString userlibdir_
 

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 making your own plugins, no need to include this file. Use 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::~PluginManager ( )

◆ PluginManager()

PluginManager::PluginManager ( )
private

Member Function Documentation

◆ findData() [1/2]

Data * PluginManager::findData ( const char * nm)
inline

◆ findData() [2/2]

const Data * PluginManager::findData ( const char * nm) const
inline

◆ findDataWithDispName()

const Data * PluginManager::findDataWithDispName ( const char * ) const

◆ fndData()

Data * PluginManager::fndData ( const char * ) const
private

◆ getALOEntries()

void PluginManager::getALOEntries ( const char * ,
bool  )
private

◆ getApplDir()

static const char * PluginManager::getApplDir ( )
static

◆ getAutoDir()

const char * PluginManager::getAutoDir ( bool usr) const
inline

◆ getData()

ObjectSet< Data > & PluginManager::getData ( )
inline

◆ getDefDirs()

void PluginManager::getDefDirs ( )
private

◆ getFileName()

BufferString PluginManager::getFileName ( const Data & ) const

return filename with full path

◆ getInstance()

static PluginManager & PluginManager::getInstance ( )
static

◆ getNotLoadedByUser()

void PluginManager::getNotLoadedByUser ( BufferStringSet & ) const

◆ getUserDir()

static const char * PluginManager::getUserDir ( )
static

◆ isPresent()

bool PluginManager::isPresent ( const char * ) const

◆ load() [1/2]

bool PluginManager::load ( const char * libnm)

Explicit load of a plugin.

◆ load() [2/2]

bool PluginManager::load ( const char * libnm,
Data::AutoSource ,
int autotype )

◆ loadAuto()

void PluginManager::loadAuto ( bool late,
bool withfilter = false )

see class comments

◆ mkALOList()

void PluginManager::mkALOList ( )
private

◆ openALOEntries()

void PluginManager::openALOEntries ( )
private

◆ sKeyApplPluginDir()

static const char * PluginManager::sKeyApplPluginDir ( )
static

◆ sKeyDontLoad()

static const char * PluginManager::sKeyDontLoad ( )
inlinestatic

◆ sKeyUserPluginDir()

static const char * PluginManager::sKeyUserPluginDir ( )
static

◆ unload()

bool PluginManager::unload ( const char * libnm)

Explicit unload of a plugin.

◆ unLoadAll()

void PluginManager::unLoadAll ( )

◆ userName()

const char * PluginManager::userName ( const char * ) const

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

Friends And Related Symbol Documentation

◆ PIM

PluginManager & PIM ( )
friend

Member Data Documentation

◆ appdir_

BufferString PluginManager::appdir_
private

◆ applibdir_

BufferString PluginManager::applibdir_
private

◆ data_

ObjectSet<Data> PluginManager::data_
private

◆ userdir_

BufferString PluginManager::userdir_
private

◆ userlibdir_

BufferString PluginManager::userlibdir_
private

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