]> Creatis software - cpPlugins.git/blob - appli/plugins/ExecutePipeline.cxx
...
[cpPlugins.git] / appli / plugins / ExecutePipeline.cxx
1 #include <iostream>
2 #include <cpPlugins/Interface/Plugins.h>
3 #include <cpPlugins/Interface/Workspace.h>
4
5 int main( int argc, char* argv[] )
6 {
7   // Manage inputs
8   if( argc < 2 )
9   {
10     std::cerr
11       << "Usage: " << argv[ 0 ]
12       << " workspace [parameters]" << std::endl;
13     return( 1 );
14
15   } // fi
16
17   // Create interface and load library
18   cpPlugins::Interface::Plugins::Pointer interface =
19     cpPlugins::Interface::Plugins::New( );
20   try
21   {
22     interface->AddEnvironments( "." );
23     interface->LoadPaths( "." );
24     interface->LoadEnvironments( );
25     interface->GuessPlugins( );
26   }
27   catch( std::exception& err )
28   {
29     std::cerr << "Error caught: " << err.what( ) << std::endl;
30     return( 1 );
31
32   } // yrt
33
34   // Workspace
35   cpPlugins::Interface::Workspace::Pointer workspace =
36     cpPlugins::Interface::Workspace::New( );
37   try
38   {
39     workspace->Load( argv[ 1 ] );
40   }
41   catch( std::exception& err )
42   {
43     std::cerr
44       << "Error loading workspace \"" << argv[ 1 ]
45       << "\": " << err.what( ) << std::endl;
46     return( 1 );
47
48   } // yrt
49
50   // Execute filter
51   workspace->PrintExecutionOn( );
52   workspace->Execute( );
53
54   return( 0 );
55 }
56
57 // eof - $RCSfile$