Multilevel Deduplication Engine (MDE)
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
mde::slz Namespace Reference

Classes

struct  DefaultValueSerializer
 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  SerializationError
 
struct  ValueSerializer
 Struct for serializing/deserializing values in MDE. More...
 

Typedefs

using JSON = nlohmann::json
 

Functions

template<typename MapT >
JSON binary_operation_map_to_json (const MapT &map)
 Converts OperationNode -> integer maps to JSON.
 
template<typename MapT >
void 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 unary_operation_map_to_json (const MapT &map)
 Converts an integer -> integer map to JSON.
 
template<typename MapT >
void 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 storage_array_to_json (const StoreT &store, Serializer &serializer)
 Converts a storage array to its JSON representation.
 
template<typename MDET , typename Serializer >
void 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 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 json_list_to_tuple_internal (const JSON &l, std::index_sequence< Is... >)
 
template<typename Tuple >
Tuple json_list_to_tuple (const JSON &l)
 
template<typename Serializer , typename MDET >
void 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_to_json_internal (MDET &root, JSON &obj, HashSet< void * > &visited, String &path)
 
template<typename MDET >
JSON 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_from_json_internal (MDET &root, const JSON &obj, HashSet< void * > &visited, String &path)
 
template<typename MDET >
void mde_from_json (MDET &root, const JSON &obj)
 Loads all data from the supplied JSON object into MDE.
 
String json_to_string (const JSON &obj)
 Returns a string representation of the supplied JSON object.
 
Vector< uint8_tjson_to_bson (const JSON &obj)
 
bool json_to_file (const JSON &obj, const String &file_path)
 Writes a JSON object to a file.
 
bool json_to_file_bson (const JSON &obj, const String &file_path)
 
JSON load_json_file (const String &file_path)
 
JSON load_bson_file (const String &file_path)
 
template<typename MDET >
bool save (const MDET &mde, const String &file_path)
 
template<typename MDET >
bool save_bson (const MDET &mde, const String &file_path)
 
template<typename MDET >
void load (MDET &mde, const String &file_path)
 
template<typename MDET >
void load_bson (MDET &mde, const String &file_path)
 

Typedef Documentation

◆ JSON

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

Definition at line 24 of file mde_serialization.hpp.

Function Documentation

◆ binary_operation_map_from_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.

Parameters
[in]mapa BinaryOperationMap or analogue.
[in]objThe JSON object.

Definition at line 87 of file mde_serialization.hpp.

◆ binary_operation_map_to_json()

template<typename MapT >
JSON mde::slz::binary_operation_map_to_json ( const MapT map)

Converts OperationNode -> integer maps to JSON.

Parameters
[in]mapa BinaryOperationMap or analogue.
Returns
The JSON representation.

Definition at line 70 of file mde_serialization.hpp.

◆ json_list_to_tuple()

template<typename Tuple >
Tuple mde::slz::json_list_to_tuple ( const JSON l)

Definition at line 241 of file mde_serialization.hpp.

◆ json_list_to_tuple_internal()

template<typename Tuple , std::size_t... Is>
Tuple mde::slz::json_list_to_tuple_internal ( const JSON l,
std::index_sequence< Is... >   
)

Definition at line 236 of file mde_serialization.hpp.

◆ json_to_bson()

Vector< uint8_t > mde::slz::json_to_bson ( const JSON obj)
inline

Definition at line 390 of file mde_serialization.hpp.

Referenced by json_to_file_bson().

◆ json_to_file()

bool mde::slz::json_to_file ( const JSON obj,
const String file_path 
)
inline

Writes a JSON object to a file.

Parameters
[in]objThe object
[in]file_pathThe file path
Returns
true on success, false on failure.

Definition at line 402 of file mde_serialization.hpp.

Referenced by save().

◆ json_to_file_bson()

bool mde::slz::json_to_file_bson ( const JSON obj,
const String file_path 
)
inline

Definition at line 413 of file mde_serialization.hpp.

Referenced by save_bson().

◆ json_to_string()

String mde::slz::json_to_string ( const JSON obj)
inline

Returns a string representation of the supplied JSON object.

Parameters
[in]objThe object
Returns
String representation of obj.

Definition at line 386 of file mde_serialization.hpp.

◆ load()

template<typename MDET >
void mde::slz::load ( MDET mde,
const String file_path 
)

Definition at line 456 of file mde_serialization.hpp.

◆ load_bson()

template<typename MDET >
void mde::slz::load_bson ( MDET mde,
const String file_path 
)

Definition at line 461 of file mde_serialization.hpp.

◆ load_bson_file()

JSON mde::slz::load_bson_file ( const String file_path)
inline

Definition at line 435 of file mde_serialization.hpp.

Referenced by load_bson().

◆ load_json_file()

JSON mde::slz::load_json_file ( const String file_path)
inline

Definition at line 425 of file mde_serialization.hpp.

Referenced by load().

◆ mde_from_json()

template<typename MDET >
void mde::slz::mde_from_json ( MDET root,
const JSON obj 
)

Loads all data from the supplied JSON object into MDE.

Parameters
rootThe MDE object to load data into.
[in]objThe object.

Definition at line 373 of file mde_serialization.hpp.

Referenced by load(), and load_bson().

◆ mde_from_json_internal()

template<typename MDET >
void mde::slz::mde_from_json_internal ( MDET root,
const JSON obj,
HashSet< void * > &  visited,
String path 
)

Definition at line 338 of file mde_serialization.hpp.

Referenced by mde_from_json(), and mde_from_json_internal().

◆ mde_to_json()

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.

Parameters
rootThe MDE object to serialize.
Returns
The JSON representation.

Definition at line 327 of file mde_serialization.hpp.

Referenced by save(), and save_bson().

◆ mde_to_json_internal()

template<typename MDET >
void mde::slz::mde_to_json_internal ( MDET root,
JSON obj,
HashSet< void * > &  visited,
String path 
)

Definition at line 287 of file mde_serialization.hpp.

Referenced by mde_to_json(), and mde_to_json_internal().

◆ register_storage_from_json()

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.

Parameters
mdeThe MDE object
[in]objThe JSON representation
serializerThe serializer

Definition at line 181 of file mde_serialization.hpp.

◆ register_storage_from_json_nested()

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.

Parameters
mdeThe MDE object
[in]objThe JSON representation
serializerThe serializer

Definition at line 256 of file mde_serialization.hpp.

◆ save()

template<typename MDET >
bool mde::slz::save ( const MDET mde,
const String file_path 
)

Definition at line 446 of file mde_serialization.hpp.

◆ save_bson()

template<typename MDET >
bool mde::slz::save_bson ( const MDET mde,
const String file_path 
)

Definition at line 451 of file mde_serialization.hpp.

◆ storage_array_to_json()

JSON mde::slz::storage_array_to_json ( const StoreT store,
Serializer serializer 
)

Converts a storage array to its JSON representation.

Parameters
[in]storeA PropertySetStorage or an analogue.
serializerA serializer structure.
Returns
The JSON representation.

Definition at line 159 of file mde_serialization.hpp.

◆ storage_array_to_json_nested()

JSON mde::slz::storage_array_to_json_nested ( const StoreT store,
Serializer serializer 
)

Converts an MDE storage array to JSON in the nested case.

Parameters
[in]storeA PropertySetStorage object or analogue.
[in]serializerA Serializer object.
Returns
The JSON Representation

Definition at line 210 of file mde_serialization.hpp.

◆ unary_operation_map_from_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.

Parameters
[in]mapa UnaryOperationMap or analogue.
[in]objThe JSON object.

Definition at line 133 of file mde_serialization.hpp.

◆ unary_operation_map_to_json()

template<typename MapT >
JSON mde::slz::unary_operation_map_to_json ( const MapT map)

Converts an integer -> integer map to JSON.

Parameters
[in]mapThe UnaryOperationMap or an analogue.
Returns
The JSON representation.

Definition at line 116 of file mde_serialization.hpp.