7 #include "fwDataIO/reader/GzArrayReader.hpp" 9 #include "fwDataIO/reader/registry/macros.hpp" 11 #include <fwDataTools/helper/Array.hpp> 42 assert( ::fwData::location::SingleFile::dynamicCast(
m_location) );
43 ::boost::filesystem::path file = ::fwData::location::SingleFile::dynamicCast(
m_location)->getPath();
45 assert( file.empty() == false );
48 size_t arraySizeInBytes = array->resize(array->getSize());
52 gzFile rawFile = gzopen(file.string().c_str(),
"rb");
56 std::string str =
"Unable to open ";
58 throw std::ios_base::failure(str);
61 unsigned int uncompressedBytesReaded = gzread(rawFile, buff, arraySizeInBytes);
63 if ( uncompressedBytesReaded != arraySizeInBytes )
65 std::string str =
"Unable to read ";
67 throw std::ios_base::failure(str);
FWDATAIO_API GzArrayReader(::fwDataIO::reader::IObjectReader::Key key)
Constructor. Do nothing.
virtual FWDATAIO_API ~GzArrayReader()
Destructor. Do nothing.
This namespace fwDataIO contains reader and writer for several framework's data.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
virtual FWDATAIO_API void read() override
Read the file with zlib API.
FWDATAIO_API std::string extension() override
Defines extension supported by this reader ".raw.gz".
virtual std::shared_ptr< DataType > getConcreteObject()
m_object getter.
Base class for all object readers.
Contains the representation of the data objects used in the framework.
::fwData::location::ILocation::sptr m_location
Object location ( file path, directory path, url, etc )
Array Reader. Read file format .raw.gz.