7 #include "fwDataIO/writer/GzArrayWriter.hpp" 9 #include "fwDataIO/writer/registry/macros.hpp" 11 #include <fwDataTools/helper/ArrayGetter.hpp> 13 #include <boost/filesystem/path.hpp> 43 assert(
getFile().empty() ==
false );
48 gzFile rawFile = gzopen( this->
getFile().
string().c_str(),
"wb1");
51 std::string str =
"GzArrayWriter::write unable to open ";
54 throw std::ios_base::failure(str);
59 const size_t arraySizeInBytes = array->getSizeInBytes();
61 const unsigned int uncompressedbyteswrited = gzwrite(rawFile, arrayHelper.
getBuffer(), arraySizeInBytes);
63 if ( uncompressedbyteswrited != arraySizeInBytes )
65 std::string str =
"GzArrayWriter::write unable to write ";
67 throw std::ios_base::failure(str);
FWDATAIO_API GzArrayWriter(::fwDataIO::writer::IObjectWriter::Key key)
Constructor. Do nothing.
This namespace fwDataIO contains reader and writer for several framework's data.
virtual std::shared_ptr< const DataType > getConcreteObject() const
m_object getter.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Array Writer. Write file format .raw.gz.
virtual FWDATAIO_API std::string extension() override
Defines extension supported by this writer ".raw.gz".
virtual FWDATAIO_API void write() override
Read the file with zlib API.
Base class for all object writers.
ILocation::PathType getFile()
Get file system path.
Contains the representation of the data objects used in the framework.
virtual FWDATAIO_API ~GzArrayWriter()
Destructor. Do nothing.