io.h File Reference

CPP API: io.h File Reference
io.h File Reference
#include "memilio/utils/metaprogramming.h"
#include "memilio/utils/compiler_diagnostics.h"
#include "memilio/math/eigen_util.h"
#include "boost/outcome/result.hpp"
#include "boost/outcome/try.hpp"
#include "boost/optional.hpp"
#include <bitset>
#include <concepts>
#include <cstddef>
#include <string>
#include <tuple>
#include <iostream>
#include <type_traits>
#include <utility>
Include dependency graph for io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mio::details::FlattenIOResult< T >
 
struct  mio::details::FlattenIOResult< IOResult< T > >
 
class  mio::IOStatus
 IOStatus represents the result of an operation. More...
 
struct  std::is_error_code_enum< mio::StatusCode >
 
struct  mio::details::IsIOResult< T >
 
struct  mio::details::IsIOResult< IOResult< T > >
 
class  mio::details::StatusCodeCategory
 category that describes StatusCode in std::error_code More...
 

Namespaces

 mio
 A collection of classes to simplify handling of matrix shapes in meta programming.
 
 mio::details
 
 std
 

Typedefs

template<class F , class... T>
using mio::details::ApplyResultT = FlattenIOResultT< std::invoke_result_t< F, T... > >
 
template<class T >
using mio::details::FlattenIOResultT = typename FlattenIOResult< T >::Type
 
template<class T >
using mio::IOResult = boost::outcome_v2::unchecked< T, IOStatus >
 Value-or-error type for operations that return a value but can fail. More...
 
template<class T >
using mio::Tag = boost::outcome_v2::in_place_type_t< T >
 Type that is used for overload resolution. More...
 

Enumerations

enum  mio::IOFlags { mio::IOF_None = 0 , mio::IOF_OmitDistributions = 1 << 0 , mio::IOF_OmitValues = 1 << 1 , mio::IOF_IncludeTypeInfo = 1 << 2 }
 flags to determine the behavior of the serialization process. More...
 
enum class  mio::StatusCode {
  mio::OK = 0 , mio::UnknownError = 1 , mio::OutOfRange , mio::InvalidValue ,
  mio::InvalidFileFormat , mio::KeyNotFound , mio::InvalidType , mio::FileNotFound
}
 code to indicate the result of an operation. More...
 

Functions

obj mio::add_list ("Items", container.begin(), container.end())
 
return mio::apply (io, [](auto &&i_) { return Container(i_.begin(), i_.end());}, i)
 
IOResult< bool > mio::create_directory (std::string const &rel_path)
 Creates a directory in the file system. More...
 
IOResult< bool > mio::create_directory (std::string const &rel_path, std::string &abs_path)
 Creates a directory in the file system. More...
 
template<class IOContext , class T >
IOResult< T > mio::deserialize (IOContext &io, Tag< T > tag)
 Restores an object from the data stored in an IO context. More...
 
template<class IOContext , class E >
requires std::is_enum_v< E > IOResult< E > mio::deserialize_internal (IOContext &io, Tag< E >)
 deserialize an enum value from its underlying type. More...
 
template<class IOContext , IsMatrixExpression M>
IOResult< M > mio::deserialize_internal (IOContext &io, Tag< M >)
 deserialize an Eigen matrix. More...
 
template<class IOContext , size_t N>
IOResult< std::bitset< N > > mio::deserialize_internal (IOContext &io, Tag< std::bitset< N >> tag)
 Deserialize an std::bitset. More...
 
template<class IOContext , IsDefaultDeserializable< IOContext > T>
IOResult< T > mio::deserialize_internal (IOContext &io, Tag< T > tag)
 Deserialization implementation for the default serialization feature. More...
 
template<class IOContext , template< class... > class Tup, class... T>
requires std::same_as< Tup< T... >, std::pair< T... > > std::same_as< Tup< T... >, std::tuple< T... > > IOResult< Tup< T... > > mio::deserialize_internal (IOContext &io, Tag< Tup< T... >> tag)
 deserialize a tuple-like object, e.g. More...
 
template<class IOObj , class Tup , class... Ts>
IOResult< Tup > mio::details::deserialize_tuple_element (IOObj &obj, Tag< Tup > tag, const IOResult< Ts > &... rs)
 
template<class F , class... T>
ApplyResultT< F, T... > mio::details::eval (F f, const IOResult< T > &... rs)
 Evaluates a function f using values of the given IOResults as arguments, assumes all IOResults are succesful. More...
 
auto mio::failure (const IOStatus &s)
 Create an object that is implicitly convertible to an error IOResult<T>. More...
 
auto mio::failure (std::error_code c, const std::string &msg="")
 Create an object that is implicitly convertible to an error IOResult<T>. More...
 
bool mio::file_exists (std::string const &rel_path, std::string &abs_path)
 Check if a file exists. More...
 
std::string mio::get_current_dir_name ()
 Returns the current working directory name. More...
 
const std::error_code & mio::make_error_code (const IOStatus &status)
 Convert IOStatus to std::error_code. More...
 
std::error_code mio::make_error_code (StatusCode e)
 Convert StatusCode to std::error_code. More...
 
template<size_t Idx>
std::string mio::details::make_tuple_element_name ()
 
void mio::PrintTo (const IOStatus &status, std::ostream *os)
 gtest printer for IOStatus. More...
 
template<class IOContext , IsContainer Container>
 mio::requires (!HasSerialize< IOContext, Container >) void serialize_internal(IOContext &io
 serialize an STL compatible container. More...
 
template<class IOContext , class T >
void mio::serialize (IOContext &io, const T &t)
 Save data that describes an object in a format determined by the given context. More...
 
template<class IOContext , class M >
void mio::serialize_internal (IOContext &io, const Eigen::EigenBase< M > &mat)
 serialize an Eigen matrix expression. More...
 
template<class IOContext , size_t N>
void mio::serialize_internal (IOContext &io, const std::bitset< N > bitset)
 Serialize an std::bitset. More...
 
template<class IOContext , IsDefaultSerializable< IOContext > T>
void mio::serialize_internal (IOContext &io, const T &a)
 Serialization implementation for the default serialization feature. More...
 
template<class IOContext , template< class... > class Tup, class... T>
requires std::same_as< Tup< T... >, std::pair< T... > > std::same_as< Tup< T... >, std::tuple< T... > > void mio::serialize_internal (IOContext &io, const Tup< T... > &tup)
 serialize a tuple-like object, e.g. More...
 
template<class IOContext , class E >
requires std::is_enum_v< E > void mio::serialize_internal (IOContext &io, E e)
 serialize an enum value as its underlying type. More...
 
template<size_t Idx, class IOObj , class Tup >
void mio::details::serialize_tuple_element (IOObj &obj, const Tup &tup)
 
const details::StatusCodeCategory & mio::status_code_category ()
 singleton StatusCodeCategory instance. More...
 
auto mio::success ()
 Create an object that is implicitly convertible to a succesful IOResult<void>. More...
 
template<class T >
auto mio::success (T &&t)
 Create an object that is implicitly convertible to a succesful IOResult. More...
 
template<class IOContext , class F , class... T>
details::ApplyResultT< F, T... > mio::apply (IOContext &io, F f, const IOResult< T > &... rs)
 Evaluate a function with zero or more unpacked IOResults as arguments. More...
 
template<class IOContext , class F , class... T>
details::ApplyResultT< F, T... > mio::apply (IOContext &io, F f, const std::tuple< IOResult< T >... > &results)
 Evaluate a function with zero or more unpacked IOResults as arguments. More...
 

Variables

const Container & mio::container
 
template<class T , class IOContext >
concept mio::HasDeserialize
 
template<class T , class IOContext >
concept mio::HasSerialize = requires(IOContext& ctxt, const T& t) { t.serialize(ctxt); }
 
auto mio::i = obj.expect_list("Items", Tag<typename Container::value_type>{})
 
template<class C >
concept mio::IsContainer
 Concept to check whether C is a STL compatible container. More...
 
 mio::Tag< Container >