From: Leonardo Flórez-Valencia Date: Thu, 16 Feb 2017 21:14:15 +0000 (-0500) Subject: Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins X-Git-Tag: v0.1~8 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=1fb645d9cf1026ff09297123d104a2b43c963a93;hp=42de9bd72fb773eb94d03b36a08c404cd82769a1;p=cpPlugins.git Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins --- 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$