From: Leonardo Flórez-Valencia Date: Thu, 16 Feb 2017 21:14:04 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~9 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=cpPlugins.git;a=commitdiff_plain;h=48a7afec5e50ba091f7724cdb7120c56caf5ad68 ... --- diff --git a/tools/ExecutePipeline.cxx b/tools/ExecutePipeline.cxx index 2c59a03..0532fa2 100644 --- a/tools/ExecutePipeline.cxx +++ b/tools/ExecutePipeline.cxx @@ -1,7 +1,45 @@ +#include +#include +#include +#include int main( int argc, char* argv[] ) { - return( 0 ); + if( argc < 2 ) + { + std::cerr + << "Usage: " << argv[ 0 ] << " workspace" + << std::endl; + return( 1 ); + + } // fi + + // Get plugins loader + cpPlugins::Interface::Loader loader; + loader.GuessEnvironment( cpPlugins::OS::FileSystem::CanonicalPath( "." ) ); + + int ret = 0; + try + { + // Prepare workspace + cpPlugins::Interface::Workspace::Pointer workspace = + cpPlugins::Interface::Workspace::New( ); + workspace->Load( argv[ 1 ] ); + + // Execute workspace + workspace->PrintExecutionOn( ); + workspace->Update( ); + } + catch( std::exception& err ) + { + std::cerr << "Error caught: " << err.what( ) << std::endl; + ret = 1; + + } // yrt + + // Close connection to loaded plugins file and finish execution + loader.UnRegisterAll( ); + return( ret ); } // eof - $RCSfile$