10 #include "../utils/map_to_index.h" 11 #include "../utils/runtime_error.h" 19 const Str &child_name_,
20 const Str &key_for_parent_id_)
34 check_required_keys(
"id");
42 if (check_optional_keys(key_for_child_ids))
49 for (
const auto &child : el_children->get_data())
52 data[mol_index][key_for_child_ids].push_back(child[
"id"]);
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
std::function< bool(const Json &)> JsonToBoolFunc
An alias for a function accepts a Json object and returns a bool.
std::string Str
Str is an alias for string.
nlohmann::json Json
Json is an alias for nlohmann::json.
ShPtr< Generator > ext_generator
void runtime_error(const Str &msg)
Raise (for Python) and throw (for C++) a runtime error.
This file has a definition of AddChildIDs class, which is a subclass of Adder class.
Namespace for utility functions.
virtual void compute_impl(Json &data, JsonToVoidFunc check_required_keys, JsonToBoolFunc check_optional_keys) override
This method overrides Updater::compute_impl.
std::function< void(const Json &)> JsonToVoidFunc
An alias for a function accepts a Json object.
AddChildIDs(const ElPtr &elem, const Str &child_name_, const Str &key_for_parent_id_)
Constructor of AddChildIDs class.
Map< Json, int > map_to_index(const Json &data, const Str &key)
Create a Map object from values of selected property in an array Json object to corresponding index i...