60 template <typename V = T>
64 [&p](
const auto &e) { return *e == *p; });
84 template <
typename V = T>
89 LOG_DBG(
"Adding nested element {} at path '{}'", p->name(),
99 p->set_parent_element_id(parent.value().id());
101 .
template add_element<V>(std::move(p));
106 throw std::runtime_error(
125 return get_element<V>(
path[0]);
128 auto p = get_element<T>(
path[0]);
147 template <
typename V = T>
auto get_element(
const std::string &name)
const
152 [&](
const auto &p) { return name == p->name(); });
157 assert(it->get() !=
nullptr);
159 if (
dynamic_cast<V *
>(it->get()))
175 [&](
const auto &p) { return name == p->name(); }) !=
185 template <
typename F>
bool all_of(F &&f)
const
189 const auto *package_ptr =
190 dynamic_cast<nested_trait<T, Path> *>(e.get());
192 if (package_ptr != nullptr)
193 return package_ptr->all_of(f);
208 const auto *package_ptr =
209 dynamic_cast<nested_trait<T, Path> *>(e.get());
210 return package_ptr != nullptr && package_ptr->is_empty();
232 const auto &d = *
this;
235 std::cout <<
"--- Printing tree:\n";
237 for (
const auto &e : d) {
239 std::cout << std::string(level,
' ') <<
"[" << *e <<
"]\n";
244 std::cout << std::string(level,
' ') <<
"- " << *e <<
"]\n";
249 void remove(
const std::set<eid_t> &element_ids)
253 [&element_ids](
auto &&e) {
254 return element_ids.count(e->id()) > 0;