// ========================================================================= // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) // ========================================================================= #include #include #include // ------------------------------------------------------------------------- cpPluginsBase::RawFileReader:: RawFileReader( ) : Superclass( ) { } // ------------------------------------------------------------------------- cpPluginsBase::RawFileReader:: ~RawFileReader( ) { } // ------------------------------------------------------------------------- void cpPluginsBase::RawFileReader:: _Configure( ) { this->ConfigureInValue< std::string >( "FileName" ); this->_ConfigureOutput< cpPluginsBase::RawData >( "Output" ); } // ------------------------------------------------------------------------- void cpPluginsBase::RawFileReader:: _GenerateData( ) { typedef cpPluginsBase::RawData _TData; std::string fname = std::string( this->GetInValue( "FileName" ) ); std::ifstream iStr( fname.c_str( ), std::ios::binary | std::ios::ate ); if( iStr ) { std::streamsize size = iStr.tellg( ); iStr.seekg( 0, std::ios::beg ); char* buffer = new char[ size ]; iStr.read( buffer, size ); this->_GetOutput< _TData >( "Output" )->TakeOwnership( buffer, size ); iStr.close( ); } else cpPluginsErrorMacro( this, << "Could not load file \"" << fname << "\"" ); } // eof - $RCSfile$