Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::Serialization::ModelSerializer Class Referenceabstractexport

Abstract interface for model and module serialization. More...

Inheritance diagram for Mila::Dnn::Serialization::ModelSerializer:

Public Member Functions

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

Detailed Description

Abstract interface for model and module serialization.

Constructor & Destructor Documentation

◆ ~ModelSerializer()

virtual Mila::Dnn::Serialization::ModelSerializer::~ModelSerializer ( )
virtualdefault

Member Function Documentation

◆ addData()

virtual bool Mila::Dnn::Serialization::ModelSerializer::addData ( const std::string &  path,
const void *  data,
size_t  size 
)
pure virtual

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

Implemented in Mila::Dnn::Serialization::ZipSerializer.

◆ close()

virtual bool Mila::Dnn::Serialization::ModelSerializer::close ( )
pure virtual

Closes the current archive.

Returns
True if archive was successfully closed

Implemented in Mila::Dnn::Serialization::ZipSerializer.

◆ extractData()

virtual size_t Mila::Dnn::Serialization::ModelSerializer::extractData ( const std::string &  path,
void *  data,
size_t  size 
)
pure virtual

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

Implemented in Mila::Dnn::Serialization::ZipSerializer.

◆ hasFile()

virtual bool Mila::Dnn::Serialization::ModelSerializer::hasFile ( const std::string &  path) const
pure virtual

Checks if a file exists in the archive.

Parameters
pathPath within the archive
Returns
True if file exists

Implemented in Mila::Dnn::Serialization::ZipSerializer.

◆ openForRead()

virtual bool Mila::Dnn::Serialization::ModelSerializer::openForRead ( const std::string &  filename)
pure virtual

Opens an archive for reading.

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

Implemented in Mila::Dnn::Serialization::ZipSerializer.

◆ openForWrite()

virtual bool Mila::Dnn::Serialization::ModelSerializer::openForWrite ( const std::string &  filename)
pure virtual

Opens an archive for writing.

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

Implemented in Mila::Dnn::Serialization::ZipSerializer.


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