]> Creatis software - cpPlugins.git/blobdiff - appli/examples/ReadWriteRawFile_00.cxx
Moved to version 1.0
[cpPlugins.git] / appli / examples / ReadWriteRawFile_00.cxx
diff --git a/appli/examples/ReadWriteRawFile_00.cxx b/appli/examples/ReadWriteRawFile_00.cxx
new file mode 100644 (file)
index 0000000..3832e3c
--- /dev/null
@@ -0,0 +1,38 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+
+#include <iostream>
+#include <cpPluginsBase/RawFileReader.h>
+#include <cpPluginsBase/RawFileWriter.h>
+
+int main( int argc, char* argv[] )
+{
+  typedef cpPluginsBase::RawFileReader TReader;
+  typedef cpPluginsBase::RawFileWriter TWriter;
+
+  if( argc != 3 )
+  {
+    std::cerr << "Usage: " << argv[ 0 ] << " input output" << std::endl;
+    return( 1 );
+  } // end if
+
+  try
+  {
+    TReader::SharedPtr reader = TReader::New( );
+    reader->SetInValue( "FileName", std::string( argv[ 1 ] ) );
+
+    TWriter::SharedPtr writer = TWriter::New( );
+    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$