Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
OpenMode.ixx File Reference

Archive open mode for model serializers. More...

#include <string_view>

Namespaces

namespace  Mila
 Mila main API namespace.

Enumerations

enum class  Mila::Dnn::Serialization::OpenMode { Read , Write }
 Mode indicating whether the archive is used for reading or writing. More...

Functions

constexpr std::string_view Mila::Dnn::Serialization::archiveModeToString (OpenMode mode)
 Convert ArchiveMode to string.

Detailed Description

Archive open mode for model serializers.

Indicates whether an archive is intended for reading or writing; used to guard operations that are valid only in the corresponding mode.

Enumeration Type Documentation

◆ OpenMode

enum class Mila::Dnn::Serialization::OpenMode
exportstrong

Mode indicating whether the archive is used for reading or writing.

Preconditions:

  • The underlying ModelSerializer should be opened for the matching operation (openForRead for Read, openForWrite for Write) before calling archive helpers.

Semantics:

  • Read : permits read operations (readJson, readBlob, file queries).
  • Write : permits write operations (writeJson, writeBlob, add data).

Example:

auto serializer = std::make_unique<ZipSerializer>( ... );
serializer->openForWrite(...);
ModelArchive archive( std::move(serializer), ArchiveMode::Write );
archive.writeJson("meta.json", j);
Examples
/home/runner/work/Mila/Mila/Mila/Src/Dnn/Serialization/ModelArchive.ixx.