]> Creatis software - cpPlugins.git/blob - appli/examples/plugins/example_LoadPluginsFile.cxx
b9a281799c0042667f756b354fe15386d937501b
[cpPlugins.git] / appli / examples / plugins / example_LoadPluginsFile.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_library" << std::endl;
9     return( 1 );
10
11   } // fi
12
13   // Load interface
14   cpPlugins::Interface interface;
15   try
16   {
17     interface.LoadPluginFile( argv[ 1 ] );
18   }
19   catch( std::exception& err )
20   {
21     std::cerr
22       << "Error caught: "
23       << err.what( )
24       << std::endl;
25     return( 1 );
26
27   } // yrt
28
29   // Show loaded filters
30   auto filters = interface.GetFilters( );
31   for( auto cIt = filters.begin( ); cIt != filters.end( ); ++cIt )
32   {
33     std::cout << "Category: " << cIt->first << std::endl;
34     for( auto nIt = cIt->second.begin( ); nIt != cIt->second.end( ); ++nIt )
35       std::cout
36         << "\tFilter: " << *nIt
37         << std::endl;
38
39   } // rof
40   return( 0 );
41 }
42
43 // eof - $RCSfile$