Commit 8ea5e2af authored by Jupp Tscheak's avatar Jupp Tscheak
Browse files

Merge branch 'mb_proposal_entity_repository' into 'master'

Interface function IEntityRepository::Get is returning an optional reference to query an IEntity.

See merge request !9
parents 760ae39a 1bc23c18
......@@ -18,6 +18,8 @@
#include <MantleAPI/Traffic/entity_properties.h>
#include <MantleAPI/Traffic/i_entity.h>
#include <functional>
#include <optional>
#include <string>
#include <vector>
......@@ -35,14 +37,18 @@ class IEntityRepository
virtual IStaticObject& Create(UniqueId id, const std::string& name, const StaticObjectProperties& properties) = 0;
virtual IVehicle& GetHost() = 0;
virtual IEntity& Get(const std::string& name) = 0;
virtual IEntity& Get(UniqueId id) = 0;
virtual std::optional<std::reference_wrapper<IEntity>> Get(const std::string& name) = 0;
virtual std::optional<std::reference_wrapper<IEntity>> Get(UniqueId id) = 0;
virtual bool Contains(UniqueId id) const = 0;
virtual void Delete(const std::string& name) = 0;
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;
virtual void RegisterEntityDeletedCallback(const std::function<void(UniqueId)>& callback) = 0;
};
} // namespace mantle_api
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment