OpendTect-6_4  6.4
plugins.h
Go to the documentation of this file.
1 #ifndef plugins_h
2 #define plugins_h
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H.Bril
8  Date: Aug 2003
9  Contents: Plugins
10 
11  RCS: $Id$
12 
13  For making your own plugins, no need to include this file. Use odplugin.h.
14 ________________________________________________________________________
15 
16 -*/
17 
18 #include "basicmod.h"
19 #include "sharedlibs.h"
20 #include "bufstringset.h"
21 
22 
23 extern "C" {
24 
25 #include "pluginbase.h"
26 
27 /* C Access. C++ should use PluginManager! */
28 
30 void LoadAutoPlugins(int inittype);
32 int LoadPlugin(const char* libnm);
33 
34 }
35 
86 {
87 public:
88 
89  mGlobal(Basic) friend PluginManager& PIM();
90 
91  static PluginManager& getInstance();
92 
93  void loadAuto(bool late);
95  bool load(const char* libnm);
97 
98  struct Data
99  {
100  enum AutoSource { None, UserDir, AppDir, Both };
101  static bool isUserDir( AutoSource src )
102  { return src != AppDir && src != None; }
103 
104  Data( const char* nm )
105  : name_(nm)
106  , info_(0)
107  , autosource_(None)
108  , autotype_(PI_AUTO_INIT_NONE)
109  , isloaded_( false )
110  , sla_(0) {}
111  ~Data() { delete sla_; }
112 
118  bool isloaded_;
119  };
120 
121  ObjectSet<Data>& getData() { return data_; }
122  Data* findData( const char* nm ) { return fndData( nm ); }
123  const Data* findData( const char* nm ) const {return fndData( nm );}
124  const Data* findDataWithDispName(const char*) const;
125 
126  bool isPresent(const char*) const;
127  const char* userName(const char*) const;
131  static const char* moduleName(const char*);
133  const char* getFileName(const Data&) const;
134 
135  const char* getAutoDir( bool usr ) const
136  { return usr ? userlibdir_ : applibdir_; }
137 
138  static const char* sKeyDontLoad() { return "dTect.Dont load plugins"; }
139  void getNotLoadedByUser(BufferStringSet&) const;
140 
141 private:
142 
143  PluginManager();
144 
146 
151 
152  Data* fndData(const char*) const;
153  void getDefDirs();
154  void getALOEntries(const char*,bool);
155  void openALOEntries();
156  void mkALOList();
157 };
158 
159 mGlobal(Basic) PluginManager& PIM();
160 
161 
162 #endif
#define mExpClass(module)
Definition: commondefs.h:160
~Data()
Definition: plugins.h:111
const char * getAutoDir(bool usr) const
Definition: plugins.h:135
Plugin manager - loads plugins: shared libs or DLLs.
Definition: plugins.h:85
#define mGlobal(module)
Definition: commondefs.h:163
static const char * sKeyDontLoad()
Definition: plugins.h:138
Data(const char *nm)
Definition: plugins.h:104
BufferString userlibdir_
Definition: plugins.h:149
Data * findData(const char *nm)
Definition: plugins.h:122
Definition: plugins.h:100
Set of BufferString objects.
Definition: bufstringset.h:28
BufferString appdir_
Definition: plugins.h:148
ObjectSet< Data > & getData()
Definition: plugins.h:121
FixedString None()
Definition: keystrs.h:90
int LoadPlugin(const char *libnm)
BufferString applibdir_
Definition: plugins.h:150
Set of pointers to objects.
Definition: commontypes.h:32
Definition: plugins.h:98
BufferString userdir_
Definition: plugins.h:147
const Data * findData(const char *nm) const
Definition: plugins.h:123
#define PI_AUTO_INIT_NONE
Definition: pluginbase.h:30
ObjectSet< Data > data_
Definition: plugins.h:145
Gives access to shared libs on runtime. Plugins should be loaded via the Plugin Manager (see plugins...
Definition: sharedlibs.h:30
SharedLibAccess * sla_
Definition: plugins.h:117
BufferString name_
Definition: plugins.h:113
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
void LoadAutoPlugins(int inittype)
Information about plugin for outside world.
Definition: pluginbase.h:52
int autotype_
Definition: plugins.h:116
AutoSource
Definition: plugins.h:100
static bool isUserDir(AutoSource src)
Definition: plugins.h:101
PluginManager & PIM()
const PluginInfo * info_
Definition: plugins.h:114
bool isloaded_
Definition: plugins.h:118
AutoSource autosource_
Definition: plugins.h:115

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