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

Abstract interface for Archives. More...

#include <Archive.h>

Inheritance diagram for serialbox::Archive:
serialbox::BinaryArchive serialbox::MockArchive serialbox::NetCDFArchive

Public Member Functions

virtual ~Archive ()
 Vritual destructor.
 
virtual FieldID write (const StorageView &storageView, const std::string &field, const std::shared_ptr< FieldMetainfoImpl > info)=0
 Write the field given by storageView to disk. More...
 
virtual void read (StorageView &storageView, const FieldID &fieldID, std::shared_ptr< FieldMetainfoImpl > info) const =0
 Read the field identified by fieldID and given by storageView from disk. More...
 
virtual void updateMetaData ()=0
 Update the meta-data on disk.
 
virtual std::string name () const =0
 Name of the archive.
 
virtual OpenModeKind mode () const =0
 Open-policy of the archive.
 
virtual std::string directory () const =0
 Directory to write/read files.
 
virtual std::string prefix () const =0
 Prefix of all files.
 
virtual std::string metaDataFile () const =0
 Full file path to the meta-data file.
 
virtual void clear ()=0
 Clear the archive i.e remove all data from disk and reset the internal data-structures.
 
virtual bool isReadingThreadSafe () const
 Indicate whether it's safe for multiple threads to call Archive::read.
 
virtual bool isWritingThreadSafe () const
 Indicate whether it's safe for multiple threads to call Archive::write.
 
virtual bool isSlicedReadingSupported () const
 Indicate whether the archive supports StorageViews with attached slices.
 
virtual std::ostream & toStream (std::ostream &stream) const =0
 Convert the archive to stream.
 

Friends

std::ostream & operator<< (std::ostream &stream, const Archive &archive)
 Convert to stream.
 

Detailed Description

Abstract interface for Archives.

Definition at line 30 of file Archive.h.

Member Function Documentation

◆ read()

virtual void serialbox::Archive::read ( StorageView storageView,
const FieldID fieldID,
std::shared_ptr< FieldMetainfoImpl info 
) const
pure virtual

Read the field identified by fieldID and given by storageView from disk.

Parameters
storageViewAbstract StorageView of the underlying data
fieldIDName and and Id of the field
infoField meta-information (can be a nullptr)

Implemented in serialbox::BinaryArchive, serialbox::NetCDFArchive, and serialbox::MockArchive.

◆ write()

virtual FieldID serialbox::Archive::write ( const StorageView storageView,
const std::string &  field,
const std::shared_ptr< FieldMetainfoImpl info 
)
pure virtual

Write the field given by storageView to disk.

The returned FieldID has to uniquely identify the field i.e it should be possible to read the exact same piece of data when later passing the FieldID to the read method.

Parameters
storageViewAbstract StorageView of the underlying data
fieldName of the field
infoField meta-information (can be a nullptr)
Returns
Unique identidier of the field

Implemented in serialbox::BinaryArchive, serialbox::NetCDFArchive, and serialbox::MockArchive.


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