]> Creatis software - cpPlugins.git/blobdiff - appli/examples/ReadWriteRawFile_02.cxx
Moved to version 1.0
[cpPlugins.git] / appli / examples / ReadWriteRawFile_02.cxx
diff --git a/appli/examples/ReadWriteRawFile_02.cxx b/appli/examples/ReadWriteRawFile_02.cxx
new file mode 100644 (file)
index 0000000..8183d19
--- /dev/null
@@ -0,0 +1,37 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+
+#include <iostream>
+#include <cpPlugins/Pipeline.h>
+
+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$