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