SharedLibrary.h
Go to the documentation of this file.00001 /*<!--------------------------------------------------------------------> 00002 @class SharedLibrary 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @date Summer 2008 00005 00006 @brief 00007 Platform-independent utility wrapper around a dynamically loaded shared 00008 library. 00009 <!-------------------------------------------------------------------->**/ 00010 00011 #ifndef SHARED_LIBRARY_H_ 00012 #define SHARED_LIBRARY_H_ 00013 00014 #include <dynamic/SharedLibraryCommon.h> 00015 00016 class SharedLibraryPlatform; 00017 00018 class DLLEXPORT SharedLibrary { 00019 public: 00020 ///@name Constructors 00021 //@{----------------------------------------------------------------- 00022 00023 /** 00024 * @brief 00025 * Creates a utility wrapper around the handle given which is assumed 00026 * to be a valid platform-dependent handle to a previously loaded shared 00027 * library 00028 */ 00029 SharedLibrary(const std::string &name, SharedLibraryHandle *handle, 00030 SharedLibraryPlatform *platform); 00031 00032 virtual ~SharedLibrary(); 00033 00034 00035 //@}----------------------------------------------------------------- 00036 ///@name Main usage interface 00037 //@{----------------------------------------------------------------- 00038 00039 /** 00040 * @returns a reference to the given symbol in this SharedLibrary or 00041 * NULL on error 00042 * 00043 * @note if an error occurred, you may call getLastError to obtain a 00044 * human-readable string describing the error 00045 */ 00046 virtual void *getSymbol(const std::string &symbol); 00047 00048 /** 00049 * @returns a human-readable string describing the last error which 00050 * occurred within this SharedLibrary 00051 */ 00052 virtual std::string getLastError(); 00053 00054 /** 00055 * @returns the string used to find/load this SharedLibrary 00056 */ 00057 inline const std::string &getName() const { 00058 return m_name; 00059 } 00060 00061 00062 //@}----------------------------------------------------------------- 00063 00064 protected: 00065 const std::string m_name; 00066 00067 SharedLibraryHandle *m_handle; 00068 SharedLibraryPlatform *m_platform; 00069 }; 00070 00071 #endif // SHARED_LIBRARY_H_ 00072
Generated on 28 Feb 2009 for Milton by
1.5.6