]> Creatis software - cpPlugins.git/blob - appli/examples/example_LoadPluginsFromPath.cxx
451d3330c94abac36473595128d0c5f8ea6383f7
[cpPlugins.git] / appli / examples / example_LoadPluginsFromPath.cxx
1 #include <iostream>
2 #include <string>
3
4 #include <cpPlugins/Interface/Interface.h>
5
6 // -------------------------------------------------------------------------
7 typedef cpPlugins::Interface::Interface TInterface;
8
9 // -------------------------------------------------------------------------
10 int main( int argc, char* argv[] )
11 {
12   if( argc < 2 )
13   {
14     std::cerr << "Usage: " << argv[ 0 ] << " plugins_file(s)" << std::endl;
15     return( 1 );
16
17   } // fi
18
19   // Create interface and load plugins
20   TInterface interface;
21   interface.LoadFromFolder( argv[ 1 ], true );
22
23   // Show info
24   auto i = interface.GetLoadedPlugins( ).begin( );
25   for( ; i != interface.GetLoadedPlugins( ).end( ); ++i )
26   {
27     std::cout << "Folder: " << i->first << std::endl;
28     auto j = i->second.begin( );
29     for( ; j != i->second.end( ); ++j )
30       std::cout << "\tPlugin: " << *j << std::endl;
31
32   } // rof
33
34   // Show loaded classes
35   auto cat = interface.GetClasses( ).begin( );
36   for( ; cat != interface.GetClasses( ).end( ); ++cat )
37   {
38     std::cout << "Catergory -> " << cat->first << std::endl;
39     auto cla = cat->second.begin( );
40     for( ; cla != cat->second.end( ); ++cla )
41       std::cout << "\tClass -> " << cla->first << std::endl;
42     
43   } // rof
44
45   return( 0 );
46 }
47
48 // eof - $RCSfile$