Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::Serialization::ZipSerializer Class Referenceexport

Implementation of ModelSerializer using miniz for ZIP archives. More...

Inheritance diagram for Mila::Dnn::Serialization::ZipSerializer:
Collaboration diagram for Mila::Dnn::Serialization::ZipSerializer:

Public Member Functions

 ZipSerializer ()
 
 ~ZipSerializer ()
 
bool addData (const std::string &path, const void *data, size_t size) override
 Adds a memory buffer to the archive.
 
bool close () override
 Closes the current archive.
 
size_t extractData (const std::string &path, void *data, size_t size) override
 Extracts data from the archive.
 
bool hasFile (const std::string &path) const override
 Checks if a file exists in the archive.
 
bool openForRead (const std::string &filename) override
 Opens an archive for reading.
 
bool openForWrite (const std::string &filename) override
 Opens an archive for writing.
 
- Public Member Functions inherited from Mila::Dnn::Serialization::ModelSerializer
virtual ~ModelSerializer ()=default
 

Private Attributes

std::string filename_
 
bool is_writing_ = false
 
mz_zip_archive zip_
 

Detailed Description

Implementation of ModelSerializer using miniz for ZIP archives.

Constructor & Destructor Documentation

◆ ZipSerializer()

Mila::Dnn::Serialization::ZipSerializer::ZipSerializer ( )
inline

◆ ~ZipSerializer()

Mila::Dnn::Serialization::ZipSerializer::~ZipSerializer ( )
inline
Here is the call graph for this function:

Member Function Documentation

◆ addData()

bool Mila::Dnn::Serialization::ZipSerializer::addData ( const std::string &  path,
const void *  data,
size_t  size 
)
inlineoverridevirtual

Adds a memory buffer to the archive.

Parameters
pathPath within the archive
dataPointer to the data
sizeSize of the data in bytes
Returns
True if successful

Implements Mila::Dnn::Serialization::ModelSerializer.

◆ close()

bool Mila::Dnn::Serialization::ZipSerializer::close ( )
inlineoverridevirtual

Closes the current archive.

Returns
True if archive was successfully closed

Implements Mila::Dnn::Serialization::ModelSerializer.

Here is the caller graph for this function:

◆ extractData()

size_t Mila::Dnn::Serialization::ZipSerializer::extractData ( const std::string &  path,
void *  data,
size_t  size 
)
inlineoverridevirtual

Extracts data from the archive.

Parameters
pathPath within the archive
dataPointer to the buffer where data should be stored
sizeSize of the buffer in bytes
Returns
Actual size of extracted data, 0 if failed

Implements Mila::Dnn::Serialization::ModelSerializer.

◆ hasFile()

bool Mila::Dnn::Serialization::ZipSerializer::hasFile ( const std::string &  path) const
inlineoverridevirtual

Checks if a file exists in the archive.

Parameters
pathPath within the archive
Returns
True if file exists

Implements Mila::Dnn::Serialization::ModelSerializer.

◆ openForRead()

bool Mila::Dnn::Serialization::ZipSerializer::openForRead ( const std::string &  filename)
inlineoverridevirtual

Opens an archive for reading.

Parameters
filenamePath to the archive file
Returns
True if archive was successfully opened

Implements Mila::Dnn::Serialization::ModelSerializer.

Here is the call graph for this function:

◆ openForWrite()

bool Mila::Dnn::Serialization::ZipSerializer::openForWrite ( const std::string &  filename)
inlineoverridevirtual

Opens an archive for writing.

Parameters
filenamePath to the archive file
Returns
True if archive was successfully opened

Implements Mila::Dnn::Serialization::ModelSerializer.

Here is the call graph for this function:

Member Data Documentation

◆ filename_

std::string Mila::Dnn::Serialization::ZipSerializer::filename_
private

◆ is_writing_

bool Mila::Dnn::Serialization::ZipSerializer::is_writing_ = false
private

◆ zip_

mz_zip_archive Mila::Dnn::Serialization::ZipSerializer::zip_
private

The documentation for this class was generated from the following file: