X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface.h;h=0f4655453df15b46e33d344e766d9ef8c3b1f996;hb=8ada00da37d8c4dc70b9387c1147566c62dbd41f;hp=7c9681a06175e83c6c511ff622d45eceaaf86291;hpb=b67cad9ff3c38b4e99ac48a4852e9e94cb879c6a;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface.h b/lib/cpPlugins/Interface.h index 7c9681a..0f46554 100644 --- a/lib/cpPlugins/Interface.h +++ b/lib/cpPlugins/Interface.h @@ -5,7 +5,12 @@ #include #include #include -#include +#include +#include + +/* TODO + #include +*/ 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