Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:52

0001 #ifndef ATOOLS_Org_Library_Loader_H
0002 #define ATOOLS_Org_Library_Loader_H
0003 
0004 #include <vector>
0005 #include <map>
0006 #include <string>
0007 
0008 namespace ATOOLS {
0009 
0010   class Library_Loader {
0011   private:
0012 
0013     std::vector<std::string>    m_paths;
0014     std::map<std::string,void*> m_libs;
0015 
0016     size_t m_wait;
0017     bool   m_check;
0018 
0019     bool CreateLockFile(const std::string &lockname);
0020     bool RemoveLockFile(const std::string &lockname);
0021 
0022   public:
0023 
0024     // constructor
0025     Library_Loader();
0026 
0027     // member functions
0028     void *LoadLibrary(const std::string &name);
0029     void *LoadLibrary(const std::string &path,
0030               const std::string &name);
0031     void  UnloadLibrary(const std::string &name,void *module);
0032     bool  LibraryIsLoaded(const std::string &name);
0033 
0034     void *GetLibraryFunction(const std::string &libname,
0035                  const std::string &funcname);
0036     void *GetLibraryFunction(const std::string &libname,
0037                  const std::string &funcname,
0038                  void *&module);
0039     void *GetLibraryFunction(const std::string &funcname,
0040                  void* const & module) const;
0041 
0042     // inline functions
0043     void AddPath(const std::string &path,const int mode=0);
0044 
0045     inline void SetWaitTime(const size_t &wait) { m_wait=wait; }
0046 
0047     inline void SetCheck(const bool check) { m_check=check; }
0048 
0049   };//end of class Library_Loader
0050 
0051   extern Library_Loader *s_loader;
0052 
0053 }// end of namsepace COMPARE
0054 
0055 #endif