X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fexamples%2FReadWriteRawFile_02.cxx;fp=appli%2Fexamples%2FReadWriteRawFile_02.cxx;h=8183d195f22cda3c9543671054c8c2c6cb63f9a7;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=0000000000000000000000000000000000000000;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/appli/examples/ReadWriteRawFile_02.cxx b/appli/examples/ReadWriteRawFile_02.cxx new file mode 100644 index 0000000..8183d19 --- /dev/null +++ b/appli/examples/ReadWriteRawFile_02.cxx @@ -0,0 +1,37 @@ +// ========================================================================= +// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +// ========================================================================= + +#include +#include + +int main( int argc, char* argv[] ) +{ + if( argc != 3 ) + { + std::cerr << "Usage: " << argv[ 0 ] << " input output" << std::endl; + return( 1 ); + } // end if + + try + { + typedef cpPlugins::Pipeline TPipeline; + + TPipeline::SharedPtr pipeline = TPipeline::New( ); + pipeline->ExecutionDebugOn( ); + pipeline->CreateNode( "cpPluginsBase::RawFileReader", "reader" ); + pipeline->CreateNode( "cpPluginsBase::RawFileWriter", "writer" ); + pipeline->SetInValue( "FileName@reader", std::string( argv[ 1 ] ) ); + pipeline->SetInValue( "FileName@writer", std::string( argv[ 2 ] ) ); + pipeline->Connect( "Output@reader", "Input@writer" ); + pipeline->Update( ); + } + catch( std::exception& err ) + { + std::cerr << "ERROR CAUGHT: " << err.what( ) << std::endl; + return( 1 ); + } // end try + return( 0 ); +} + +// eof - $RCSfile$