diff --git a/source/RobotAPI/libraries/armem/core/workingmemory/Visitor.cpp b/source/RobotAPI/libraries/armem/core/workingmemory/Visitor.cpp index 986612d1e788bee74e572f20b89dbc78fb99ea58..ede63a494a7aff26c54ba1d7149200c91be7d987 100644 --- a/source/RobotAPI/libraries/armem/core/workingmemory/Visitor.cpp +++ b/source/RobotAPI/libraries/armem/core/workingmemory/Visitor.cpp @@ -19,62 +19,82 @@ namespace armarx::armem::wm bool Visitor::applyTo(Memory& memory) { + bool cont = true; + visitEnter(memory); for (auto& [_, coreSeg] : memory) { if (!applyTo(coreSeg)) { - return false; + cont = false; + break; } } - return true; + visitExit(memory); + return cont; } bool Visitor::applyTo(CoreSegment& coreSegment) { + bool cont = true; + visitEnter(coreSegment); for (auto& [_, provSeg] : coreSegment) { if (!applyTo(provSeg)) { - return false; + cont = false; + break; } } - return true; + visitExit(coreSegment); + return cont; } bool Visitor::applyTo(ProviderSegment& providerSegment) { + bool cont = true; + visitEnter(providerSegment); for (auto& [_, entity] : providerSegment) { if (!applyTo(entity)) { - return false; + cont = false; + break; } } - return true; + visitExit(providerSegment); + return cont; } bool Visitor::applyTo(Entity& entity) { + bool cont = true; + visitEnter(entity); for (auto& [_, snapshot] : entity) { if (!applyTo(snapshot)) { - return false; + cont = false; + break; } } - return true; + visitExit(entity); + return cont; } bool Visitor::applyTo(EntitySnapshot& snapshot) { + bool cont = true; + visitEnter(snapshot); for (auto& instance : snapshot) { if (!applyTo(instance)) { - return false; + cont = false; + break; } } - return true; + visitExit(snapshot); + return cont; } bool Visitor::applyTo(EntityInstance& instance) @@ -85,62 +105,82 @@ namespace armarx::armem::wm bool Visitor::applyTo(const Memory& memory) { + bool cont = true; + visitEnter(memory); for (const auto& [_, coreSeg] : memory) { if (!applyTo(coreSeg)) { - return false; + cont = false; + break; } } - return true; + visitExit(memory); + return cont; } bool Visitor::applyTo(const CoreSegment& coreSegment) { + bool cont = true; + visitEnter(coreSegment); for (const auto& [_, provSeg] : coreSegment) { if (!applyTo(provSeg)) { - return false; + cont = false; + break; } } - return true; + visitExit(coreSegment); + return cont; } bool Visitor::applyTo(const ProviderSegment& providerSegment) { + bool cont = true; + visitEnter(providerSegment); for (const auto& [_, entity] : providerSegment) { if (!applyTo(entity)) { - return false; + cont = false; + break; } } - return true; + visitExit(providerSegment); + return cont; } bool Visitor::applyTo(const Entity& entity) { + bool cont = true; + visitEnter(entity); for (const auto& [_, snapshot] : entity) { if (!applyTo(snapshot)) { - return false; + cont = false; + break; } } - return true; + visitExit(entity); + return cont; } bool Visitor::applyTo(const EntitySnapshot& snapshot) { + bool cont = true; + visitEnter(snapshot); for (const auto& instance : snapshot) { if (!applyTo(instance)) { - return false; + cont = false; + break; } } - return true; + visitExit(snapshot); + return cont; } bool Visitor::applyTo(const EntityInstance& instance)