Factory to create Archives.
More...
#include <ArchiveFactory.h>
|
static std::unique_ptr< Archive > | create (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...
|
|
Factory to create Archives.
Definition at line 29 of file ArchiveFactory.h.
◆ 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
-
name | Name of the archive |
mode | Policy to open files in the archive |
directory | Directory in which the archive is opened |
prefix | Prefix of all files |
- Exceptions
-
Exception | No 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
-
filename | File to read from |
storageView | StorageView of the field |
archiveName | Archive used to perform serialization |
fieldname | Name 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
-
filename | Newly created file (if file already exists, it's contents will be discarded) |
storageView | StorageView of the field |
archiveName | Archive used to perform serialization |
fieldname | Name 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: