]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Interface/Interface.h
...
[cpPlugins.git] / lib / cpPlugins / Interface / Interface.h
1 #ifndef __CPPLUGINS__INTERFACE__INTERFACE__H__
2 #define __CPPLUGINS__INTERFACE__INTERFACE__H__
3
4 #include <map>
5 #include <string>
6 #include <vector>
7
8 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
9 #include <cpPlugins/Interface/Object.h>
10 #include <cpPlugins/Interface/ProcessObject.h>
11
12 // Some forward declarations
13 namespace pluma
14 {
15   class Pluma;
16 }
17
18 namespace cpPlugins
19 {
20   namespace Interface
21   {
22     /**
23      */
24     class cpPlugins_Interface_EXPORT Interface
25     {
26     public:
27       typedef Interface Self;
28       typedef std::vector< ProcessObjectProvider* > TProviders;
29       typedef std::map< std::string, unsigned int > TClass;
30       typedef std::map< std::string, TClass >       TClasses;
31       typedef
32         std::map< std::string, std::vector< std::string > >
33         TLoadedPlugins;
34
35       typedef TProviders::const_iterator TProvidersIterator;
36       typedef TClasses::const_iterator   TClassesIterator;
37
38     public:
39       Interface( );
40       virtual ~Interface( );
41
42       bool LoadDefaultConfiguration( const std::string& path );
43       bool SaveDefaultConfiguration( const std::string& path );
44
45       // Plugin access
46       TClasses& GetClasses( );
47       const TClasses& GetClasses( ) const;
48       TLoadedPlugins& GetLoadedPlugins( );
49       const TLoadedPlugins& GetLoadedPlugins( ) const;
50       ProcessObject::Pointer CreateObject( const std::string& name ) const;
51
52       // Interface to PLUMA
53       bool Load( const std::string& path );
54       bool Load( const std::string& folder, const std::string& name );
55       bool LoadFromFolder( const std::string& folder, bool r = false );
56       bool Unload( const std::string& name );
57       void UnloadAll( );
58       bool IsLoaded( const std::string& name ) const;
59
60     protected:
61       void _LoadClasses( );
62
63       static void _SepFName(
64         const std::string& path,
65         std::string& folder,
66         std::string& name
67         );
68
69     protected:
70       pluma::Pluma*  m_Pluma;
71       TProviders     m_Providers;
72       TClasses       m_Classes;
73       TLoadedPlugins m_LoadedPlugins;
74     };
75
76   } // ecapseman
77
78 } // ecapseman
79
80 #endif // __CPPLUGINS__INTERFACE__INTERFACE__H__
81
82 // eof - $RCSfile$