]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface.h
5dcd843ab00ff924f2d344a1a06c545d2fe15347
[cpPlugins.git] / lib / cpPlugins / Interface.h
1 #ifndef __CPPLUGINS__INTERFACE__H__
2 #define __CPPLUGINS__INTERFACE__H__
3
4 #include <cpPlugins/Config.h>
5 #include <cpPlugins/ProcessObject.h>
6 #include <map>
7 #include <set>
8 #include <string>
9
10 namespace cpPlugins
11 {
12   /**
13    */
14   class cpPlugins_EXPORT Interface
15   {
16   public:
17     typedef Interface Self;
18
19     typedef cpPlugins::ProcessObject::Pointer ( *TCreator )( );
20     typedef std::pair< std::string, TCreator >               TDynFunc;
21     typedef std::map< std::string, TDynFunc >                TDynFilter;
22     typedef std::map< std::string, TDynFilter >              TDynFilters;
23     typedef std::map< std::string, void* >                   TDynLibraries;
24     typedef std::map< std::string, std::set< std::string > > TFilters;
25
26   public:
27     Interface( );
28     virtual ~Interface( );
29
30     const TFilters& GetFilters( );
31
32     bool LoadConfiguration( const std::string& filename );
33     bool SaveConfiguration( const std::string& filename ) const;
34     void LoadPluginFile( const std::string& filename );
35     void UnloadAll( );
36
37     cpPlugins::ProcessObject::Pointer Create(
38       const std::string& category, const std::string& name
39       );
40
41   protected:
42     static void* _DLOpen( const std::string& fname );
43     static TFilters _DLGetFilters( void* hnd );
44     static TCreator _DLGetCreator(
45       void* hnd, const std::string& category, const std::string& name
46       );
47     static void _DLClose( void* hnd );
48
49   protected:
50     TDynLibraries m_DynLibraries;
51     TDynFilters   m_DynFilters;
52     TFilters      m_Filters;
53   };
54
55 } // ecapseman
56
57 #endif // __CPPLUGINS__INTERFACE__H__
58
59 // eof - $RCSfile$