Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
ArchiveFactory.h
Go to the documentation of this file.
1 //===-- serialbox/core/archive/ArchiveFactory.h -------------------------------------*- C++ -*-===//
2 //
3 // S E R I A L B O X
4 //
5 // This file is distributed under terms of BSD license.
6 // See LICENSE.txt for more information
7 //
8 //===------------------------------------------------------------------------------------------===//
9 //
13 //===------------------------------------------------------------------------------------------===//
14 
15 #ifndef SERIALBOX_CORE_ARCHIVE_ARCHIVEFACTORY_H
16 #define SERIALBOX_CORE_ARCHIVE_ARCHIVEFACTORY_H
17 
18 #include "serialbox/core/Type.h"
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 namespace serialbox {
25 
30  ArchiveFactory() = delete;
31 
32 public:
41  static std::unique_ptr<Archive> create(const std::string& name, OpenModeKind mode,
42  const std::string& directory, const std::string& prefix);
43 
45  static std::vector<std::string> registeredArchives();
46 
54  static std::string archiveFromExtension(std::string filename);
55 
63  static void writeToFile(std::string filename, const StorageView& storageView,
64  std::string archiveName, std::string fieldname);
65 
72  static void readFromFile(std::string filename, StorageView& storageView, std::string archiveName,
73  std::string fieldname);
74 };
75 
76 } // namespace serialbox
77 
78 #endif
static std::string archiveFromExtension(std::string filename)
Deduce the name of the archive according to the extension of the filename
Factory to create Archives.
Represent a mutable view to a multi-dimensional storage.
Definition: StorageView.h:33
static std::vector< std::string > registeredArchives()
Get a vector of strings of the registered archives.
Namespace of the serialbox library.
Definition: Archive.h:25
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´
static void readFromFile(std::string filename, StorageView &storageView, std::string archiveName, std::string fieldname)
Directly read field (given by storageView) from file.
static void writeToFile(std::string filename, const StorageView &storageView, std::string archiveName, std::string fieldname)
Directly write field (given by storageView) to file.
OpenModeKind
Policy for opening files in the Serializer and Archive.
Definition: Type.h:40