64 template <
typename V = T>
67 if (
auto id = p->id();
69 std::move(
id), p->type_name()))) {
89 template <
typename V = T>
94 LOG_TRACE(
"Adding nested element {} at path '{}{}'", p->name(),
104 auto *nested_trait_ptr =
106 if (nested_trait_ptr !=
nullptr) {
107 p->set_parent_element_id(parent.value().id());
108 return (*nested_trait_ptr)
109 .template add_element<V>(std::move(p));
115 throw std::runtime_error(
156 template <
typename V = T>
169 if (it == matches_end)
174 auto [element_name, element_index] = *it;
177 if (
auto element_ptr =
178 dynamic_cast<V *
>(
elements_.at(element_index).get());
179 element_ptr !=
nullptr) {
183 if (nt_ptr->is_root_ ==
is_root)
203 template <
typename F>
bool all_of(F &&f)
const
207 const auto *package_ptr =
208 dynamic_cast<nested_trait<T, Path> *>(e.get());
210 if (package_ptr != nullptr)
211 return package_ptr->all_of(f);
222 bool is_empty(
bool include_inner_packages =
false)
const
226 if (include_inner_packages)
233 const auto *package_ptr =
234 dynamic_cast<nested_trait<T, Path> *>(e.get());
235 return package_ptr != nullptr && package_ptr->is_empty();
257 const auto &d = *
this;
260 std::cout <<
"--- Printing tree:\n";
262 for (
const auto &e : d) {
264 std::cout << std::string(level,
'.') <<
"[" << *e <<
"]\n";
269 std::cout << std::string(level,
'.') <<
"- " << *e <<
"]\n";
274 void remove(
const std::set<eid_t> &element_ids)
279 if (element_ids.count(e->id()) > 0) {
282 for (
auto it = range.first; it != range.second; ++it) {
283 if (it->second == idx) {
295 [&element_ids](
auto &&e) {
296 return element_ids.count(e->id()) > 0;
303 if (element_ids.count(e.first) == 0)