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