]> Creatis software - cpPlugins.git/blob - appli/examples/plugins/example_plugins_LoadDirectory.cxx
7bd093fce064ccc1c118e9d3c68986bfc3fabf97
[cpPlugins.git] / appli / examples / plugins / example_plugins_LoadDirectory.cxx
1 #include <iostream>
2 #include <cpPlugins/Interface.h>
3
4 int main( int argc, char* argv[] )
5 {
6   // Manage inputs
7   if( argc < 2 )
8   {
9     std::cerr << "Usage: " << argv[ 0 ] << " directory" << std::endl;
10     return( 1 );
11
12   } // fi
13   std::string directory = argv[ 1 ];
14
15   // Create interface and load library
16   cpPlugins::Interface interface;
17   try
18   {
19     interface.LoadEnvironment( );
20     interface.LoadDirectory( directory );
21   }
22   catch( std::exception& err )
23   {
24     std::cerr << "Error caught: " << err.what( ) << std::endl;
25     return( 1 );
26
27   } // yrt
28
29   // Show data
30   std::cout << "----- PATHS -----" << std::endl;
31   auto paths = interface.GetPaths( );
32   for( auto paIt = paths.begin( ); paIt != paths.end( ); ++paIt )
33     std::cout << *paIt << std::endl;
34   std::cout << std::endl << "----- PLUGINS -----" << std::endl;
35   auto plugins = interface.GetPlugins( );
36   for( auto plIt = plugins.begin( ); plIt != plugins.end( ); ++plIt )
37     std::cout << *plIt << std::endl;
38   std::cout << std::endl << "----- FILTERS -----" << std::endl;
39   auto categories = interface.GetCategories( );
40   for( auto cIt = categories.begin( ); cIt != categories.end( ); ++cIt )
41   {
42     std::cout << "\t** Category: " << *cIt << " **" << std::endl;
43     auto filters = interface.GetFilters( *cIt );
44     for( auto fIt = filters.begin( ); fIt != filters.end( ); ++fIt )
45       std::cout << "\t\tFilter: " << *fIt << std::endl;
46
47   } // rof
48
49   // Finish
50   return( 0 );
51 }
52
53 // eof - $RCSfile$