diff --git a/source/RobotAPI/libraries/armem/util/util.h b/source/RobotAPI/libraries/armem/util/util.h index 2f45b843a0419a639e000cc2594b59783df06267..050df3f880d715e44f2e07f37e06bf9b6708d760 100644 --- a/source/RobotAPI/libraries/armem/util/util.h +++ b/source/RobotAPI/libraries/armem/util/util.h @@ -88,18 +88,15 @@ namespace armarx::armem // loop over all entities and their snapshots for (const auto &[s, entity] : entities) { - for (const auto &[ss, entitySnapshot] : entity.history()) + entity.forEachInstance([&outV](const wm::EntityInstance& entityInstance) { - for (const auto& entityInstance : entitySnapshot.instances()) - { - const auto o = tryCast<AronClass>(entityInstance); + const auto o = tryCast<AronClass>(entityInstance); - if (o) - { - outV.push_back(*o); - } + if (o) + { + outV.push_back(*o); } - } + }); } return outV; @@ -139,25 +136,15 @@ namespace armarx::armem // loop over all entities and their snapshots for (const auto &[s, entity] : entities) { - if (entity.history().empty()) + entity.forEachInstance([&outV, &pred](const wm::EntityInstance& entityInstance) { - ARMARX_WARNING << "Empty history for " << s; - } - - ARMARX_DEBUG << "History size: " << entity.history().size(); + const auto o = tryCast<AronClass>(entityInstance); - for (const auto &[ss, entitySnapshot] : entity.history()) - { - for (const auto& entityInstance : entitySnapshot.instances()) + if (o) { - const auto o = tryCast<AronClass>(entityInstance); - - if (o) - { - outV.push_back(pred(*o)); - } + outV.push_back(pred(*o)); } - } + }); } return outV;