00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_PLUGIN_H_
00028 #define CEYLAN_PLUGIN_H_
00029
00030
00031 #include "CeylanModule.h"
00032 #include "CeylanFileLocator.h"
00033
00034 #include <string>
00035
00036
00038 #define CEYLAN_SYMBOL_MARKER "_LTX_"
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00096 namespace Ceylan
00097 {
00098
00099
00100
00102 class CEYLAN_DLL PluginException: public Ceylan::ModuleException
00103 {
00104
00105 public:
00106
00107 PluginException( const std::string & message ) ;
00108
00109 virtual ~PluginException() throw() ;
00110
00111 } ;
00112
00113
00114
00115
00128 class CEYLAN_DLL Plugin: public Ceylan::Module
00129 {
00130
00131
00142 struct SystemSpecificPluginHandle ;
00143
00144 typedef Ceylan::Uint32 ReferenceCount ;
00145
00146
00147
00158 typedef void * (*BasicFunctionPointer) (void) ;
00159
00160
00161
00162 public:
00163
00164
00165
00203 explicit Plugin( const std::string & filename = "",
00204 bool autoPrefix = true ) ;
00205
00206
00208 virtual ~Plugin() throw() ;
00209
00210
00211
00218 virtual std::string getEmbeddedName() ;
00219
00220
00221
00228 virtual std::string getFilename() const ;
00229
00230
00231
00241 virtual ReferenceCount getReferenceCount() const ;
00242
00243
00244
00250 bool isOpen() const ;
00251
00252
00253
00266 void * getDataSymbol( const std::string & dataName ) const ;
00267
00268
00269
00288 BasicFunctionPointer getFunctionSymbol(
00289 const std::string & functionName ) const ;
00290
00291
00292
00300 void close() ;
00301
00302
00303
00316 void makeResident() ;
00317
00318
00319
00328 bool isResident() const ;
00329
00330
00331
00340 const std::string & getFileName() const ;
00341
00342
00343
00354 virtual const std::string toString(
00355 VerbosityLevels level = high ) const ;
00356
00357
00358
00363 static Ceylan::System::FileLocator PluginLocator ;
00364
00365
00366
00376 static const std::string SymbolMarker ;
00377
00378
00379
00380
00381 protected:
00382
00383
00391 virtual void retrieveMetadata() ;
00392
00393
00394
00401 static Ceylan::Uint16 PluginSystemInitialized ;
00402
00403
00404
00405
00406 private:
00407
00408
00409
00411 SystemSpecificPluginHandle * _pluginHandle ;
00412
00413
00415 std::string _filename ;
00416
00417
00423 bool _autoPrefix ;
00424
00425
00434 Plugin( const Plugin & source ) ;
00435
00436
00445 Plugin & operator = ( const Plugin & source ) ;
00446
00447
00448
00449 } ;
00450
00451
00452 }
00453
00454
00455
00456 #endif // CEYLAN_PLUGIN_H_
00457