Multilevel Deduplication Engine (MDE)
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions
mde_serialization.hpp File Reference

Describes serialization building blocks for MDE. More...

#include "mde_common.hpp"
#include <fstream>
#include <nlohmann/json.hpp>
Include dependency graph for mde_serialization.hpp:

Go to the source code of this file.

Classes

struct  mde::slz::ValueSerializer< T >
 Struct for serializing/deserializing values in MDE. More...
 
struct  mde::slz::DefaultValueSerializer< T >
 Default serialization behavior. If the type of the property in MDE is something that can be directly serialized to JSON (like numbers, strings), or has a serializer routine already written for it (see nlohmann/json documentation), this struct will do so. More...
 
struct  mde::slz::SerializationError
 

Namespaces

namespace  mde
 
namespace  mde::slz
 

Typedefs

using mde::slz::JSON = nlohmann::json
 

Functions

template<typename MapT >
JSON mde::slz::binary_operation_map_to_json (const MapT &map)
 Converts OperationNode -> integer maps to JSON.
 
template<typename MapT >
void mde::slz::binary_operation_map_from_json (MapT &map, const JSON &obj)
 Inserts data from the JSON representation to the equivalent C++ data strucure for the OperationNode -> integer map.
 
template<typename MapT >
JSON mde::slz::unary_operation_map_to_json (const MapT &map)
 Converts an integer -> integer map to JSON.
 
template<typename MapT >
void mde::slz::unary_operation_map_from_json (MapT &map, const JSON &obj)
 Inserts data from the JSON representation to the equivalent C++ data strucure for the integer -> integer map.
 
template<typename StoreT , typename Serializer >
JSON mde::slz::storage_array_to_json (const StoreT &store, Serializer &serializer)
 Converts a storage array to its JSON representation.
 
template<typename MDET , typename Serializer >
void mde::slz::register_storage_from_json (MDET &mde, const JSON &obj, Serializer &serializer)
 Inserts data from the JSON representation to the equivalent C++ data strucure for a PropertySetStorage. It needs direct access to the MDE object to use register_set.
 
template<typename Serializer , typename StoreT >
JSON mde::slz::storage_array_to_json_nested (const StoreT &store, Serializer &serializer)
 Converts an MDE storage array to JSON in the nested case.
 
template<typename Tuple , std::size_t... Is>
Tuple mde::slz::json_list_to_tuple_internal (const JSON &l, std::index_sequence< Is... >)
 
template<typename Tuple >
Tuple mde::slz::json_list_to_tuple (const JSON &l)
 
template<typename Serializer , typename MDET >
void mde::slz::register_storage_from_json_nested (MDET &mde, const JSON &obj, Serializer &serializer)
 Inserts data from the JSON representation to the equivalent C++ data strucure for a PropertySetStorage in the nested case. It needs direct access to the MDE object to use register_set.
 
template<typename MDET >
void mde::slz::mde_to_json_internal (MDET &root, JSON &obj, HashSet< void * > &visited, String &path)
 
template<typename MDET >
JSON mde::slz::mde_to_json (MDET &root)
 Converts an MDE and its referenced child MDEs to JSON. The individual MDEs are identified using paths starting from the root MDE (the one supplied as a parameter). A depth-first search is performed without any traversals to already visited references. A JSON object is then created using the string paths as the keys referring to each MDE.
 
template<typename MDET >
void mde::slz::mde_from_json_internal (MDET &root, const JSON &obj, HashSet< void * > &visited, String &path)
 
template<typename MDET >
void mde::slz::mde_from_json (MDET &root, const JSON &obj)
 Loads all data from the supplied JSON object into MDE.
 
String mde::slz::json_to_string (const JSON &obj)
 Returns a string representation of the supplied JSON object.
 
Vector< uint8_tmde::slz::json_to_bson (const JSON &obj)
 
bool mde::slz::json_to_file (const JSON &obj, const String &file_path)
 Writes a JSON object to a file.
 
bool mde::slz::json_to_file_bson (const JSON &obj, const String &file_path)
 
JSON mde::slz::load_json_file (const String &file_path)
 
JSON mde::slz::load_bson_file (const String &file_path)
 
template<typename MDET >
bool mde::slz::save (const MDET &mde, const String &file_path)
 
template<typename MDET >
bool mde::slz::save_bson (const MDET &mde, const String &file_path)
 
template<typename MDET >
void mde::slz::load (MDET &mde, const String &file_path)
 
template<typename MDET >
void mde::slz::load_bson (MDET &mde, const String &file_path)
 

Detailed Description

Describes serialization building blocks for MDE.

Note
You may notice that a majority of these functions could be inside the MDE class itself. These functions are added here, and largely as templates for a clean separation of concerns and dependencies from the actual MDE structure. The second factor is that the serialization routine needs to traverse the DAG of MDEs in order to extract all of the data, and thus is made a separate entity from MDE rather than a member function.

Definition in file mde_serialization.hpp.