Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
serialbox::ArchiveFactory Class Reference

Factory to create Archives. More...

#include <ArchiveFactory.h>

Static Public Member Functions

static std::unique_ptr< Archivecreate (const std::string &name, OpenModeKind mode, const std::string &directory, const std::string &prefix)
 Construct an instance of the archive ´name´ More...
 
static std::vector< std::string > registeredArchives ()
 Get a vector of strings of the registered archives.
 
static std::string archiveFromExtension (std::string filename)
 Deduce the name of the archive according to the extension of the filename More...
 
static void writeToFile (std::string filename, const StorageView &storageView, std::string archiveName, std::string fieldname)
 Directly write field (given by storageView) to file. More...
 
static void readFromFile (std::string filename, StorageView &storageView, std::string archiveName, std::string fieldname)
 Directly read field (given by storageView) from file. More...
 

Detailed Description

Factory to create Archives.

Definition at line 29 of file ArchiveFactory.h.

Member Function Documentation

◆ archiveFromExtension()

std::string serialbox::ArchiveFactory::archiveFromExtension ( std::string  filename)
static

Deduce the name of the archive according to the extension of the filename

Extensions Archives
.dat, .bin Binary
.nc NetCDF

Definition at line 55 of file ArchiveFactory.cpp.

◆ create()

std::unique_ptr< Archive > serialbox::ArchiveFactory::create ( const std::string &  name,
OpenModeKind  mode,
const std::string &  directory,
const std::string &  prefix 
)
static

Construct an instance of the archive ´name´

Parameters
nameName of the archive
modePolicy to open files in the archive
directoryDirectory in which the archive is opened
prefixPrefix of all files
Exceptions
ExceptionNo archive with given name exists or is registered

Definition at line 24 of file ArchiveFactory.cpp.

◆ readFromFile()

void serialbox::ArchiveFactory::readFromFile ( std::string  filename,
StorageView storageView,
std::string  archiveName,
std::string  fieldname 
)
static

Directly read field (given by storageView) from file.

Parameters
filenameFile to read from
storageViewStorageView of the field
archiveNameArchive used to perform serialization
fieldnameName of the field (might be unused for certain archives)

Definition at line 98 of file ArchiveFactory.cpp.

◆ writeToFile()

void serialbox::ArchiveFactory::writeToFile ( std::string  filename,
const StorageView storageView,
std::string  archiveName,
std::string  fieldname 
)
static

Directly write field (given by storageView) to file.

Parameters
filenameNewly created file (if file already exists, it's contents will be discarded)
storageViewStorageView of the field
archiveNameArchive used to perform serialization
fieldnameName of the field (might be unused for certain archives)

Definition at line 73 of file ArchiveFactory.cpp.


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