]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface.h
Build procedure simplified
[cpPlugins.git] / lib / cpPlugins / Interface.h
index 7c9681a06175e83c6c511ff622d45eceaaf86291..0f4655453df15b46e33d344e766d9ef8c3b1f996 100644 (file)
@@ -5,7 +5,12 @@
 #include <cpPlugins/ProcessObject.h>
 #include <map>
 #include <set>
-#include <string>
+#include <utility>
+#include <vector>
+
+/* TODO
+   #include <string>
+*/
 
 namespace cpPlugins
 {
@@ -17,40 +22,87 @@ namespace cpPlugins
     typedef Interface Self;
 
     typedef void* ( *TCreator )( );
-    typedef std::pair< std::string, TCreator >               TDynFunc;
-    typedef std::map< std::string, TDynFunc >                TDynFilter;
-    typedef std::map< std::string, TDynFilter >              TDynFilters;
-    typedef std::map< std::string, void* >                   TDynLibraries;
-    typedef std::map< std::string, std::set< std::string > > TFilters;
+    typedef std::map< std::string, void* > TLibraries;
+    struct TCreatorData
+    {
+      std::string PluginName;
+      void*       LibraryHandle;
+      TCreator    Creator;
+    };
+    typedef std::map< std::string, std::map< std::string, TCreatorData > > TFilters;
+
+    /* TODO
+       typedef std::pair< std::string, TCreator >               TDynFunc;
+       typedef std::map< std::string, TDynFunc >                TDynFilter;
+       typedef std::map< std::string, TDynFilter >              TDynFilters;
+       typedef std::pair< std::string, void* >                  TDynFileInfo;
+       typedef std::map< std::string, TDynFileInfo >            TDynLibraries;
+    */
 
   public:
     Interface( );
     virtual ~Interface( );
 
-    const TFilters& GetFilters( );
+    const std::set< std::string >& GetPaths( ) const;
+    std::set< std::string > GetLibraries( ) const;
+    std::set< std::string > GetPlugins( ) const;
+    std::set< std::string > GetCategories( ) const;
+    std::set< std::string > GetFilters( const std::string& category ) const;
 
-    bool LoadConfiguration( const std::string& filename );
-    bool SaveConfiguration( const std::string& filename ) const;
-    void LoadPluginFile( const std::string& filename );
-    void LoadPluginDir( const std::string& dirname );
-    void UnloadAll( );
+    void UpdateEnvironments( const std::string& new_environment );
+    void LoadEnvironment( );
+    void LoadFile( const std::string& fname );
+    void LoadPlugin( const std::string& pname );
+    void LoadDirectory( const std::string& dirname );
+    void GuessPlugins( );
 
-    cpPlugins::ProcessObject::Pointer Create(
+    cpPlugins::ProcessObject::Pointer CreateProcessObject(
       const std::string& category, const std::string& name
       );
 
   protected:
-    static void* _DLOpen( const std::string& fname );
-    static TFilters _DLGetFilters( void* hnd );
-    static TCreator _DLGetCreator(
-      void* hnd, const std::string& category, const std::string& name
-      );
-    static void _DLClose( void* hnd );
+    std::set< std::string > m_Paths;
+    TLibraries m_Libraries;
+    TLibraries m_Plugins;
+    TFilters m_Filters;
 
-  protected:
-    TDynLibraries m_DynLibraries;
-    TDynFilters   m_DynFilters;
-    TFilters      m_Filters;
+
+    /* TODO
+       const TFilters& GetFilters( );
+
+       void UpdatePaths( );
+       void GuessAccesiblePlugins( );
+       void LoadPlugin( const std::string& name );
+       void LoadPluginDir( const std::string& dirname );
+       void LoadPluginFile( const std::string& filename );
+       void UnloadAll( );
+
+       ProcessObject::Pointer Create(
+       const std::string& category, const std::string& name
+       );
+       std::string GetPluginName(
+       const std::string& category, const std::string& name
+       ) const;
+       std::string GetPluginName( const ProcessObject* obj ) const;
+       std::set< std::string > GetPlugins( ) const;
+
+       protected:
+       static void* _DLOpen( const std::string& fname, std::string& error );
+       static const char* _DLGetName( void* hnd );
+       static TFilters _DLGetFilters( void* hnd );
+       static TCreator _DLGetCreator(
+       void* hnd, const std::string& category, const std::string& name
+       );
+       static void _DLClose( void* hnd );
+
+       protected:
+       std::vector< std::string > m_Paths;
+       TDynLibraries m_DynLibraries;
+       TDynFilters   m_DynFilters;
+       TFilters      m_Filters;
+
+       static unsigned int InterfacesCount;
+    */
   };
 
 } // ecapseman