Loading...
Searching...
No Matches
serialization_utils.h
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): Vincent Rouvreau
*
* Copyright (C) 2023 Inria
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/
#ifndef SIMPLEX_TREE_SERIALIZATION_UTILS_H_
#define SIMPLEX_TREE_SERIALIZATION_UTILS_H_
#include <cstring> // for memcpy and std::size_t
#include <iostream>
namespace Gudhi {
namespace simplex_tree {
template<class ArgumentType>
char* serialize_trivial(ArgumentType value, char* start) {
std::size_t arg_size = sizeof(ArgumentType);
memcpy(start, &value, arg_size);
return start + arg_size;
}
template<class ArgumentType>
const char* deserialize_trivial(ArgumentType& value, const char* start) {
std::size_t arg_size = sizeof(ArgumentType);
memcpy(&value, start, arg_size);
return (start + arg_size);
}
} // namespace simplex_tree
} // namespace Gudhi
#endif // SIMPLEX_TREE_SERIALIZATION_UTILS_H_
Gudhi
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14