RunTimeLibraryLoader.hxx

Go to the documentation of this file.
00001 #ifndef RunTimeLibraryLoader_hxx
00002 #define RunTimeLibraryLoader_hxx
00003 
00004 #include <string>
00005 #include <vector>
00006 #include <map>
00007 #include <list>
00008 
00009 
00010 class RunTimeLibraryLoader
00011 {
00012 public:
00013 
00014         virtual ~RunTimeLibraryLoader() {}
00015         void Load() const;
00016         void ReLoad();
00017 
00018         const std::string CompletePathFor(const std::string & subpathAndName) const; // if subpathAndName exists on environment paths, returns full path
00019 
00020         // static methods for dynamic libraries handles
00021         static void * FullyLoadLibrary(const std::string & libraryPath);
00022         static void * LazyLoadLibrary(const std::string & libraryPath);
00023         static bool ReleaseLibraryHandler(void * handle, const std::string pluginFullFilename="");
00024         static const std::string LibraryLoadError();
00025         static const std::string FileOfSymbol (void * symbolAddress);
00026         static void * GetSymbol(void * libraryHandler, const std::string & symbolName);
00027 
00028 protected:
00029         void LoadLibrariesFromPath(const std::string & path) const;
00030         std::vector<std::string> SplitPathVariable(const std::string & pathVariable) const;
00031         void * GetLibraryHandler(const std::string & libraryPath) const;
00032         const char * pathSeparator() const
00033         {
00034                 return 
00035                         #ifdef WIN32
00036                                 ";";
00037                         #else
00038                                 ":";
00039                         #endif
00040         }
00041         // to implement by subclasses (ex. Ladspa, CLAM processings, etc)
00042         virtual const char ** standardPaths() const = 0;
00043         virtual const char * homePath() const = 0;
00044         virtual const char * pathEnvironmentVar() const = 0;
00045         virtual const char * libraryType() const = 0;
00046         virtual const bool needReleaseHandlerOnReload() const =0;
00047         virtual void SetupLibrary( void* handle, const std::string & pluginFullFilename ) const {}
00048         const std::string getPathFromFullFileName(const std::string & fullFileNameConst) const
00049         {
00050                 std::string fullFileName = fullFileNameConst;
00051                 return fullFileName.substr(0,fullFileName.rfind("/"));
00052         }
00053         bool IsOnPath(const std::string & path) const;
00054         virtual std::list<std::string> GetUsedLibraries();
00055 
00056 private:
00057         const std::string GetPaths() const;
00058 };
00059 
00060 #endif //RunTimeLibraryLoader_hxx
00061 
Generated by  doxygen 1.6.3