1 #ifndef __CPPLUGINS__INTERFACE__H__
2 #define __CPPLUGINS__INTERFACE__H__
4 #include <cpPlugins/Config.h>
5 #include <cpPlugins/ProcessObject.h>
19 class cpPlugins_EXPORT Interface
22 typedef Interface Self;
24 typedef void* ( *TCreator )( );
25 typedef std::map< std::string, void* > TLibraries;
28 std::string PluginName;
32 typedef std::map< std::string, std::map< std::string, TCreatorData > > TFilters;
35 typedef std::pair< std::string, TCreator > TDynFunc;
36 typedef std::map< std::string, TDynFunc > TDynFilter;
37 typedef std::map< std::string, TDynFilter > TDynFilters;
38 typedef std::pair< std::string, void* > TDynFileInfo;
39 typedef std::map< std::string, TDynFileInfo > TDynLibraries;
44 virtual ~Interface( );
46 const std::set< std::string >& GetPaths( ) const;
47 std::set< std::string > GetLibraries( ) const;
48 std::set< std::string > GetPlugins( ) const;
49 std::set< std::string > GetCategories( ) const;
50 std::set< std::string > GetFilters( const std::string& category ) const;
52 void UpdateEnvironments( const std::string& new_environment );
53 void LoadEnvironment( );
54 void LoadFile( const std::string& fname );
55 void LoadPlugin( const std::string& pname );
56 void LoadDirectory( const std::string& dirname );
59 cpPlugins::ProcessObject::Pointer CreateProcessObject(
60 const std::string& category, const std::string& name
64 std::set< std::string > m_Paths;
65 TLibraries m_Libraries;
71 const TFilters& GetFilters( );
74 void GuessAccesiblePlugins( );
75 void LoadPlugin( const std::string& name );
76 void LoadPluginDir( const std::string& dirname );
77 void LoadPluginFile( const std::string& filename );
80 ProcessObject::Pointer Create(
81 const std::string& category, const std::string& name
83 std::string GetPluginName(
84 const std::string& category, const std::string& name
86 std::string GetPluginName( const ProcessObject* obj ) const;
87 std::set< std::string > GetPlugins( ) const;
90 static void* _DLOpen( const std::string& fname, std::string& error );
91 static const char* _DLGetName( void* hnd );
92 static TFilters _DLGetFilters( void* hnd );
93 static TCreator _DLGetCreator(
94 void* hnd, const std::string& category, const std::string& name
96 static void _DLClose( void* hnd );
99 std::vector< std::string > m_Paths;
100 TDynLibraries m_DynLibraries;
101 TDynFilters m_DynFilters;
104 static unsigned int InterfacesCount;
110 #endif // __CPPLUGINS__INTERFACE__H__