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