]> Creatis software - cpPlugins.git/blobdiff - appli/examples/ReadRawFile_02.cxx
Moved to version 1.0
[cpPlugins.git] / appli / examples / ReadRawFile_02.cxx
diff --git a/appli/examples/ReadRawFile_02.cxx b/appli/examples/ReadRawFile_02.cxx
new file mode 100644 (file)
index 0000000..1142478
--- /dev/null
@@ -0,0 +1,36 @@
+// =========================================================================
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// =========================================================================
+
+#include <iostream>
+#include <cpPlugins/Pipeline.h>
+
+int main( int argc, char* argv[] )
+{
+  typedef cpPlugins::Pipeline TPipeline;
+  typedef cpPlugins::Filter   TFilter;
+
+  if( argc != 2 )
+  {
+    std::cerr << "Usage: " << argv[ 0 ] << " file" << std::endl;
+    return( 1 );
+  } // end if
+
+  try
+  {
+    TPipeline::SharedPtr pipeline = TPipeline::New( );
+    pipeline->CreateNode( "cpPluginsBase::RawFileReader", "reader" );
+    pipeline->SetInValue( "FileName@reader", std::string( argv[ 1 ] ) );
+    pipeline->Update( );
+
+    std::cout << *( pipeline->GetOutput( "Output@reader" ) ) << std::endl;
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "ERROR CAUGHT: " << err.what( ) << std::endl;
+    return( 1 );
+  } // end try
+  return( 0 );
+}
+
+// eof - $RCSfile$