Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
json_utils.hpp File Reference
#include "shamcomm/logs.hpp"
#include "shamcomm/worldInfo.hpp"
#include "shamrock/io/json_print_diff.hpp"
+ Include dependency graph for json_utils.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  shamrock
 namespace for the main framework
 

Macros

#define SHAMROCK_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...)
 Macro to serialize/deserialize an enum to/from a JSON object modified from the NLOHMANN_JSON_SERIALIZE_ENUM macro, throw an exception if the enum value is invalid and do not use the first case by default.
 

Functions

std::string shamrock::log_json_changes (const nlohmann::json &j_current, const nlohmann::json &j, bool has_used_defaults, bool has_updated_config)
 Shown the changes between two JSON objects to log config changes.
 
template<class T >
void shamrock::get_to_if_contains (const nlohmann::json &j, const std::string &key, T &value, bool &has_used_defaults)
 
template<class T >
void shamrock::get_to_if_contains_fallbacks (const nlohmann::json &j, const std::string &key, T &value, std::initializer_list< const char * > fallbacks, bool &has_used_defaults, bool &has_updated_config)
 

Detailed Description

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file json_utils.hpp.

Macro Definition Documentation

◆ SHAMROCK_JSON_SERIALIZE_ENUM

#define SHAMROCK_JSON_SERIALIZE_ENUM (   ENUM_TYPE,
  ... 
)

Macro to serialize/deserialize an enum to/from a JSON object modified from the NLOHMANN_JSON_SERIALIZE_ENUM macro, throw an exception if the enum value is invalid and do not use the first case by default.

Parameters
ENUM_TYPEThe enum type to serialize/deserialize.
...The pairs of enum values and their JSON representations.

Definition at line 86 of file json_utils.hpp.