00001 #ifndef OBTPlugin_H
00002 #define OBTPlugin_H
00003
00004 #ifdef _MSC_VER
00005 #include <windows.h>
00006 #endif
00007
00008 #include <string>
00009
00010 #include "OBT.h"
00011
00012 namespace OBT
00013 {
00014
00015 class PluginInformation ;
00016
00020 class OBT_API Plugin
00021 {
00022 public:
00023
00025 typedef bool ( *InitFunc )( const char* configurationFile ) ;
00026
00028 typedef bool ( *DeInitFunc )() ;
00029
00031 typedef const PluginInformation& ( *PluginInformationFunc )() ;
00032
00048 Plugin( const char* path, const char* name, const char* configurationFile = 0 ) ;
00049
00053 virtual ~Plugin() ;
00054
00059 bool load() ;
00060
00065 bool unload() ;
00066
00071 bool isLoaded() const ;
00072
00077 const PluginInformation& getInformation() const ;
00078
00083 const char* getPath() const ;
00084
00090 const char* getConfigurationFile() const ;
00091
00092 private:
00093
00095 Plugin( const Plugin& ) ;
00097 Plugin& operator = ( const Plugin& ) ;
00098 #ifdef _MSC_VER
00100 HINSTANCE _pluginHandle ;
00101 #else
00103 void* _pluginHandle ;
00104 #endif
00105
00107 bool _initialised ;
00108
00110 std::string _path ;
00111
00113 std::string _configurationFile ;
00114 } ;
00115
00116
00117
00118
00119 inline bool
00120 Plugin::isLoaded() const
00121 {
00122 return _initialised ;
00123 }
00124
00125
00126
00127
00128 inline const char*
00129 Plugin::getPath() const
00130 {
00131 return _path.c_str() ;
00132 }
00133
00134
00135
00136
00137 inline const char*
00138 Plugin::getConfigurationFile() const
00139 {
00140 return _configurationFile.empty() ? NULL : _configurationFile.c_str() ;
00141 }
00142 }
00143
00144 #endif //OBTPlugin_H