1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
6 #include <cpPluginsBase/RawFileReader.h>
7 #include <cpPluginsBase/RawData.h>
9 // -------------------------------------------------------------------------
10 cpPluginsBase::RawFileReader::
16 // -------------------------------------------------------------------------
17 cpPluginsBase::RawFileReader::
22 // -------------------------------------------------------------------------
23 void cpPluginsBase::RawFileReader::
26 this->ConfigureInValue< std::string >( "FileName" );
27 this->_ConfigureOutput< cpPluginsBase::RawData >( "Output" );
30 // -------------------------------------------------------------------------
31 void cpPluginsBase::RawFileReader::
34 typedef cpPluginsBase::RawData _TData;
36 std::string fname = std::string( this->GetInValue( "FileName" ) );
37 std::ifstream iStr( fname.c_str( ), std::ios::binary | std::ios::ate );
40 std::streamsize size = iStr.tellg( );
41 iStr.seekg( 0, std::ios::beg );
42 char* buffer = new char[ size ];
43 iStr.read( buffer, size );
44 this->_GetOutput< _TData >( "Output" )->TakeOwnership( buffer, size );
49 this, << "Could not load file \"" << fname << "\""