HMSBEAGLE
1.0.0
|
00001 00008 #ifndef __SHAREDLIBRARY_H__ 00009 #define __SHAREDLIBRARY_H__ 00010 00011 #ifdef HAVE_CONFIG_H 00012 #include "libhmsbeagle/config.h" 00013 #endif 00014 00015 #include <string> 00016 00017 namespace beagle { 00018 namespace plugin { 00019 00020 class SharedLibraryException 00021 { 00022 public: 00023 SharedLibraryException(const char* error) : m_error(error) { } 00024 const char* getError() const {return m_error.c_str();} 00025 private: 00026 std::string m_error; 00027 }; 00028 00029 class SharedLibrary 00030 { 00031 public: 00032 static SharedLibrary* openSharedLibrary(const char* name); 00033 virtual ~SharedLibrary() {} 00034 virtual void* findSymbol(const char* name) = 0; 00035 00036 // ... 00037 }; 00038 00039 template<class T> 00040 T findSymbol(SharedLibrary& sl, const char* name) 00041 { 00042 return (T)sl.findSymbol(name); 00043 } 00044 00045 } // namespace plugin 00046 } // namespace beagle 00047 00048 #endif // __SHAREDLIBRARY_H__ 00049