]> Creatis software - cpPlugins.git/blob - appli/examples/ReadWriteRawFile_02.cxx
Moved to version 1.0
[cpPlugins.git] / appli / examples / ReadWriteRawFile_02.cxx
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4
5 #include <iostream>
6 #include <cpPlugins/Pipeline.h>
7
8 int main( int argc, char* argv[] )
9 {
10   if( argc != 3 )
11   {
12     std::cerr << "Usage: " << argv[ 0 ] << " input output" << std::endl;
13     return( 1 );
14   } // end if
15
16   try
17   {
18     typedef cpPlugins::Pipeline TPipeline;
19
20     TPipeline::SharedPtr pipeline = TPipeline::New( );
21     pipeline->ExecutionDebugOn( );
22     pipeline->CreateNode( "cpPluginsBase::RawFileReader", "reader" );
23     pipeline->CreateNode( "cpPluginsBase::RawFileWriter", "writer" );
24     pipeline->SetInValue( "FileName@reader", std::string( argv[ 1 ] ) );
25     pipeline->SetInValue( "FileName@writer", std::string( argv[ 2 ] ) );
26     pipeline->Connect( "Output@reader", "Input@writer" );
27     pipeline->Update( );
28   }
29   catch( std::exception& err )
30   {
31     std::cerr << "ERROR CAUGHT: " << err.what( ) << std::endl;
32     return( 1 );
33   } // end try
34   return( 0 );
35 }
36
37 // eof - $RCSfile$