SyTen
persistent.h File Reference

Saving, loading, caching and uncaching of objects using the boost libraries. More...

#include <fstream>
#include <sstream>
#include <string>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cerrno>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/complex.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
#include "inc/util/lz4_filter.h"
#include "inc/util/configuration.h"
#include "inc/util/boost_versioning.h"
#include "inc/util/macros.h"
#include "inc/util/scalars.h"
+ Include dependency graph for persistent.h:
+ This graph shows which files directly or indirectly include this file:

Classes

struct  syten::load
 helper class to load an object from a file, uses a struct to imitate return-value-based function overloading More...
 
struct  syten::loadCache
 Shortcut to load("file",true), delete supplied input file. More...
 
struct  syten::loadInput
 Shortcut to load("file",false), don't delete input file. More...
 
class  syten::Excp::NoSuchFile
 Thrown if a file to be opened does not exist. More...
 
class  syten::Excp::UnexpectedFile
 Throw this exception if the UUID of a file does not match your expectations. More...
 

Namespaces

 syten
 The topmost namespace for this project.
 
 syten::Excp
 Namespace for exceptions otherwise polluting the global syten:: namespace.
 

Functions

std::string syten::cacheFilename (std::string const &f)
 Given a string f, return the temporary cache filename, i.e. syten::cacheDir + "/" + f More...
 
void syten::initCache (std::string const &c)
 Set the cache directory syten::cacheDir for temporary objects. More...
 
template<typename T >
void syten::save (T &t, std::string const &where)
 Save an object into a file. More...
 
template<typename T >
std::string syten::save (T &t)
 Save an object into a temporary file. More...
 
template<typename T >
int syten::serialise_configuration (T &ar, std::string const &file)
 Writes and reads configuration data from files, ensuring compatibility between the read file and the reading binary. More...
 
loading facilities
template<typename Type >
void syten::load_archive (boost::archive::binary_iarchive &ar, Type &r, std::string const &file)
 Loads from the archive ar into the object r. More...
 
template<typename Type >
void syten::loadFile (std::string file, bool const fromCache, Type &r)
 Loads an object of type Type from file into r. More...
 
template<typename Type >
Type syten::loadFile (std::string file, bool const fromCache)
 Returns an object of type Type loaded from file. More...
 
template<typename Type >
void syten::loadInputRef (std::string const &file, Type &r)
 Loads from an input file file into an object r without deleting the input file or discarding non-overwritten properties of r. More...
 
template<typename Type >
void syten::loadCacheRef (std::string const &file, Type &r)
 Loads from a cache file file into an object r without discarding non-overwritten properties of r. More...
 
void syten::clearCache (std::string const &f)
 If non-empty, delete the corresponding file. More...
 

Variables

constexpr int syten::file_id_magic = 20150526 + 1
 magic number identitfying SYTEN files (date of first commit in recorded git history plus current version) More...
 

Detailed Description

Saving, loading, caching and uncaching of objects using the boost libraries.