]> Creatis software - cpPlugins.git/blob - appli/examples/plugins/example_LoadPluginsDirectory.cxx
... and on linux again
[cpPlugins.git] / appli / examples / plugins / example_LoadPluginsDirectory.cxx
1 #include <iostream>
2 #include <cpPlugins/Interface.h>
3
4 int main( int argc, char* argv[] )
5 {
6   if( argc < 2 )
7   {
8     std::cerr << "Usage: " << argv[ 0 ] << " plugins_libraries_dir" << std::endl;
9     return( 1 );
10
11   } // fi
12
13   // Load interface
14   cpPlugins::Interface interface;
15   try
16   {
17     interface.LoadPluginDir( argv[ 1 ] );
18   }
19   catch( std::exception& err )
20   {
21     std::cerr << "Error caught: " << err.what( ) << std::endl;
22     return( 1 );
23
24   } // yrt
25
26   // Show loaded filters
27   auto filters = interface.GetFilters( );
28   for( auto cIt = filters.begin( ); cIt != filters.end( ); ++cIt )
29   {
30     std::cout << "Category: " << cIt->first << std::endl;
31     for( auto nIt = cIt->second.begin( ); nIt != cIt->second.end( ); ++nIt )
32       std::cout
33         << "\tFilter: " << *nIt
34         << std::endl;
35
36   } // rof
37   return( 0 );
38 }
39
40 // eof - $RCSfile$