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