00001 #ifndef _PLUGIN_H_
00002 #define _PLUGIN_H_
00003
00004 #include "../include/ApproxModule.h"
00005 #include "../include/fv_compiler.h"
00006 #include <string>
00007
00008
00009
00010 namespace Approx {
00011
00012 class ApproxManager;
00013
00014
00015 class Plugin {
00016 static size_t DLLRefCount;
00017 public:
00018
00019 #ifdef WIN32
00020 typedef HMODULE hlibModule;
00021 #else
00022 typedef void* hlibModule;
00023 #endif
00024
00025 public:
00026
00027 static hlibModule loadPlugin(const std::string & sModuleName);
00028
00029 static void unloadPlugin(hlibModule pModule);
00030
00031 public:
00032
00033 explicit Plugin(const std::string & sFilename);
00034
00035 Plugin(const Plugin & rh);
00036
00037 ~Plugin();
00038
00039 public:
00040
00041 int GetEngineVersion() const {
00042 return pfnGetEngineVersion();
00043 }
00044
00046 void registerPlugin(ApproxManager &AM) {
00047 pfnRegisterPlugin(AM);
00048 }
00049
00050 private:
00051
00052 Plugin &operator =(const Plugin &Other);
00053
00054
00055 typedef int fnGetEngineVersion();
00056
00057
00058 typedef void fnRegisterPlugin(ApproxManager &);
00059
00060
00061
00062 hlibModule hDLL;
00063 fnGetEngineVersion *pfnGetEngineVersion;
00064 fnRegisterPlugin *pfnRegisterPlugin;
00065
00066 };
00067
00068 }
00069
00070 #endif
00071