7 #include "fwDataIO/writer/ArrayWriter.hpp" 9 #include "fwDataIO/writer/registry/macros.hpp" 11 #include <fwDataTools/helper/ArrayGetter.hpp> 13 #include <boost/filesystem/path.hpp> 42 ::boost::filesystem::path file =
getFile();
45 size_t arraySizeInBytes = array->getSizeInBytes();
47 const char* buff = arrayHelper.
begin();
49 std::ofstream fs(file.string().c_str(), std::ios::binary|std::ios::trunc);
51 FW_RAISE_IF(
"Unable to open " << file, !fs.good());
53 fs.write(buff, arraySizeInBytes);
Array Writer. Write file format .raw.
This namespace fwDataIO contains reader and writer for several framework's data.
virtual FWDATAIO_API void write() override
Read the file with zlib API.
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.
Base class for all object writers.
virtual FWDATAIO_API ~ArrayWriter()
Destructor. Do nothing.
FWDATAIO_API ArrayWriter(::fwDataIO::writer::IObjectWriter::Key key)
Constructor. Do nothing.
ILocation::PathType getFile()
Get file system path.
virtual FWDATAIO_API std::string extension() override
Defines extension supported by this writer ".raw".
Contains the representation of the data objects used in the framework.