X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=appli%2Fexamples%2Fplugins%2Fexample_plugins_LoadFile.cxx;fp=appli%2Fexamples%2Fplugins%2Fexample_plugins_LoadFile.cxx;h=8749aeffa6c78b90ce1c6a2872fdb3b939c94cee;hb=201c5026430f9bcc33f9db6a39f5d03db096c860;hp=0000000000000000000000000000000000000000;hpb=aa77db36cc1d87ba014c982a235239c3c87224f3;p=cpPlugins.git diff --git a/appli/examples/plugins/example_plugins_LoadFile.cxx b/appli/examples/plugins/example_plugins_LoadFile.cxx new file mode 100644 index 0000000..8749aef --- /dev/null +++ b/appli/examples/plugins/example_plugins_LoadFile.cxx @@ -0,0 +1,53 @@ +#include +#include + +int main( int argc, char* argv[] ) +{ + // Manage inputs + if( argc < 2 ) + { + std::cerr << "Usage: " << argv[ 0 ] << " library_file" << std::endl; + return( 1 ); + + } // fi + std::string library_file = argv[ 1 ]; + + // Create interface and load library + cpPlugins::Interface interface; + try + { + interface.LoadEnvironment( ); + interface.LoadFile( library_file ); + } + catch( std::exception& err ) + { + std::cerr << "Error caught: " << err.what( ) << std::endl; + return( 1 ); + + } // yrt + + // Show data + std::cout << "----- PATHS -----" << std::endl; + auto paths = interface.GetPaths( ); + for( auto paIt = paths.begin( ); paIt != paths.end( ); ++paIt ) + std::cout << *paIt << std::endl; + std::cout << std::endl << "----- PLUGINS -----" << std::endl; + auto plugins = interface.GetPlugins( ); + for( auto plIt = plugins.begin( ); plIt != plugins.end( ); ++plIt ) + std::cout << *plIt << std::endl; + std::cout << std::endl << "----- FILTERS -----" << std::endl; + auto categories = interface.GetCategories( ); + for( auto cIt = categories.begin( ); cIt != categories.end( ); ++cIt ) + { + std::cout << "\t** Category: " << *cIt << " **" << std::endl; + auto filters = interface.GetFilters( *cIt ); + for( auto fIt = filters.begin( ); fIt != filters.end( ); ++fIt ) + std::cout << "\t\tFilter: " << *fIt << std::endl; + + } // rof + + // Finish + return( 0 ); +} + +// eof - $RCSfile$