]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 16 Feb 2017 21:14:04 +0000 (16:14 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 16 Feb 2017 21:14:04 +0000 (16:14 -0500)
tools/ExecutePipeline.cxx

index 2c59a03a9d707a623b1c06a966d181591825999f..0532fa203f2a5f352460e14a46ea10cb7e328f26 100644 (file)
@@ -1,7 +1,45 @@
+#include <iostream>
+#include <cpPlugins/Interface/Loader.h>
+#include <cpPlugins/OS/FileSystem.h>
+#include <cpPlugins/Interface/Workspace.h>
 
 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$