10 #include "../utils/map_to_index.h" 11 #include "../utils/runtime_error.h" 23 std::sort(vec.begin(), vec.end());
25 auto tmp = Json::array();
26 tmp.get_ref<Json::array_t&>().reserve(vec.size());
28 for (
const auto &pair : vec)
30 tmp.push_back(data[pair.second]);
void sort_by_id(Json &data)
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
This file has a definition of Starter class, which is a subclass of Updater class.
nlohmann::json Json
Json is an alias for nlohmann::json.
std::vector< T > Vec
Vec is an alias for vector (same as list in Python).
static const bool do_sorting_by_id
void runtime_error(const Str &msg)
Raise (for Python) and throw (for C++) a runtime error.
Namespace for utility functions.
virtual void compute_body(const ElPtr &elem, Json &data) override
Compute or parse properties and set them to Element::data given as a mutable reference.
virtual void compute_common(const ElPtr &elem, Json &data)
Common part of compute_body.
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...