From 49e6a3d9ce0d4d4d575b17017dae982b5f12df93 Mon Sep 17 00:00:00 2001 From: Jupp Tscheak <jupp.tscheak@daimler.com> Date: Thu, 15 Jul 2021 16:20:27 +0200 Subject: [PATCH] Added possibility to register callback function when entity has been created/deleted. If scenario domain entities are having references to the same IEntity, it might be that another instance is deleting this IEntity invalidating all references pointing to it. Those situations could be handled using the callback mechanism. Signed-off-by: Jupp Tscheak <jupp.tscheak@daimler.com> --- MantleAPI/include/MantleAPI/Traffic/i_entity_repository.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MantleAPI/include/MantleAPI/Traffic/i_entity_repository.h b/MantleAPI/include/MantleAPI/Traffic/i_entity_repository.h index bcc1bb1c..c9090777 100644 --- a/MantleAPI/include/MantleAPI/Traffic/i_entity_repository.h +++ b/MantleAPI/include/MantleAPI/Traffic/i_entity_repository.h @@ -45,6 +45,9 @@ class IEntityRepository virtual void Delete(UniqueId id) = 0; virtual const std::vector<std::unique_ptr<mantle_api::IEntity>>& GetEntities() const = 0; + + virtual void RegisterEntityCreatedCallback(const std::function<void(IEntity&)>& callback) = 0; + virtual void RegisterEntityDeletedCallback(const std::function<void(const std::string&)>& callback) = 0; }; } // namespace mantle_api -- GitLab