]> Creatis software - cpPlugins.git/blobdiff - appli/examples/plugins/example_plugins_LoadFile.cxx
Code cleaning
[cpPlugins.git] / appli / examples / plugins / example_plugins_LoadFile.cxx
diff --git a/appli/examples/plugins/example_plugins_LoadFile.cxx b/appli/examples/plugins/example_plugins_LoadFile.cxx
new file mode 100644 (file)
index 0000000..8749aef
--- /dev/null
@@ -0,0 +1,53 @@
+#include <iostream>
+#include <cpPlugins/Interface.h>
+
+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$