1 #ifndef __cpPlugins__Interface__Loader__h__
2 #define __cpPlugins__Interface__Loader__h__
4 #include <cpPlugins/Config.h>
5 #include <cpPlugins/Pipeline/ProcessObject.h>
16 class cpPlugins_EXPORT Loader
22 typedef void ( *TContentsFunc )( std::vector< std::string >* );
23 typedef void ( *TCreatorFunc )( itk::LightObject::Pointer& ptr, const std::string& c, const std::string& f );
24 typedef std::tuple< void*, TContentsFunc, TCreatorFunc > THandlers;
25 typedef std::map< std::string, THandlers > TLibraries;
26 typedef std::map< std::string, std::map< std::string, std::string > >
27 TFiltersToLibrariesReferences;
33 void Register( const std::string& filename );
34 void RegisterFromDirectory( const std::string& dirname );
35 void GuessEnvironment( const std::string& dirname );
36 void SaveEnvironment( const std::string& dirname );
37 void UnRegister( const std::string& filename );
38 void UnRegisterAll( );
40 std::map< std::string, std::set< std::string > > GetFilters( ) const;
42 cpPlugins::Pipeline::ProcessObject::Pointer CreateFilter(
43 const std::string& category, const std::string& filter,
44 const std::string& name = ""
48 static TLibraries m_Libraries;
49 static TFiltersToLibrariesReferences m_References;
52 friend std::ostream& operator<<( std::ostream& o, const Loader& l )
54 o << "cpPlugins:" << std::endl;
55 for( auto c : l.m_References )
57 o << " + " << c.first << std::endl;
58 for( auto f : c.second )
59 o << " |--> " << f.first << " (" << f.second << ")" << std::endl;
70 #endif // __cpPlugins__Interface__Loader__h__