diff --git a/source/RobotAPI/libraries/armem/core/base/CoreSegmentBase.h b/source/RobotAPI/libraries/armem/core/base/CoreSegmentBase.h index 6ea66c74b5216c9e4a92c4e719e01193e39b5ae1..ead811e5a744b9208a30eb7761c381b040cd7e90 100644 --- a/source/RobotAPI/libraries/armem/core/base/CoreSegmentBase.h +++ b/source/RobotAPI/libraries/armem/core/base/CoreSegmentBase.h @@ -140,7 +140,16 @@ namespace armarx::armem::base } else { - throw armem::error::MissingEntry("provider segment", update.entityID.providerSegmentName, getLevelName(), this->getKeyString()); + if (_addMissingProviderSegmentDuringUpdate) + { + // Add the missing provider segment (with this core segment's type). + ProviderSegmentT& provSeg = addProviderSegment(update.entityID.providerSegmentName); + return provSeg.update(update); + } + else + { + throw armem::error::MissingEntry("provider segment", update.entityID.providerSegmentName, getLevelName(), this->getKeyString()); + } } } @@ -230,13 +239,20 @@ namespace armarx::armem::base { Base::_copySelf(other); other.aronType() = _aronType; + other._addMissingProviderSegmentDuringUpdate = _addMissingProviderSegmentDuringUpdate; } virtual void _copySelfEmpty(DerivedT& other) const override { Base::_copySelfEmpty(other); other.aronType() = _aronType; + other._addMissingProviderSegmentDuringUpdate = _addMissingProviderSegmentDuringUpdate; } + + private: + + bool _addMissingProviderSegmentDuringUpdate = true; + }; }