diff --git a/include/MantleAPI/Execution/i_scenario_engine.h b/include/MantleAPI/Execution/i_scenario_engine.h index b235ac7ac07d9e4b0f34ab50d2b762b26dc22a33..7d00660e8d9c47da8e687f3520594f62d2bff638 100644 --- a/include/MantleAPI/Execution/i_scenario_engine.h +++ b/include/MantleAPI/Execution/i_scenario_engine.h @@ -29,13 +29,21 @@ class IScenarioEngine public: virtual ~IScenarioEngine() = default; - /// Initialization of the scenario state, e.g. loading the scenario file, map file, etc. + /// Parses and validates the scenario and referenced catalogs. + /// @note A map file referenced from the scenario is not parsed. + /// The map file path can be retrieved after calling this method with GetScenarioInfo(). + /// @throw If the scenario or catalogs contain errors. virtual void Init() = 0; - /// Provide information about the scenario loaded in `Init()` + /// Provide information about the scenario parsed in `Init()` /// @return information about the scenario [[nodiscard]] virtual ScenarioInfo GetScenarioInfo() const = 0; + /// Resets and sets up all dynamic content, e.g. creating entities and controllers. + /// Can be called after Init(). + /// Can be called multiple times for consecutive simulation runs. + virtual void SetupDynamicContent() = 0; + /// Calculate the new state of the scenario implementation. /// /// Calling this function after `IsFinished()` should be a no-op. @@ -49,7 +57,7 @@ public: /// Activates external controller for the host virtual void ActivateExternalHostControl() = 0; - /// Check if the scenario and catalog has been parsed correctly + /// Parses and validates the scenario and referenced catalogs. /// @return Zero on success, /// >0 = Number of scenario errors virtual int ValidateScenario() = 0; diff --git a/include/MantleAPI/Execution/scenario_info.h b/include/MantleAPI/Execution/scenario_info.h index 2e614b14faa860bb16566320943c1b9ec55e93d3..13a1038f6ece740d8e70ad8eb33ea2dbc7125767 100644 --- a/include/MantleAPI/Execution/scenario_info.h +++ b/include/MantleAPI/Execution/scenario_info.h @@ -29,6 +29,10 @@ struct ScenarioInfo Time scenario_timeout_duration; /// Specific description of the scenario std::string description; + /// Absolute path to the map + std::string full_map_path; + /// Definition of the map area + MapDetails map_details; /// Additional custom information about the scenario std::map<std::string, std::string> additional_information; }; diff --git a/include/MantleAPI/Traffic/i_controller_repository.h b/include/MantleAPI/Traffic/i_controller_repository.h index a96187fdb782d2562075e2e0edd5978b9595dad6..fe0deb10c8378b10b560c86bb1746c9f6b92cc28 100644 --- a/include/MantleAPI/Traffic/i_controller_repository.h +++ b/include/MantleAPI/Traffic/i_controller_repository.h @@ -60,6 +60,11 @@ public: /// @param id The Identifier of the controller to be deleted virtual void Delete(UniqueId id) = 0; + /// Resets the controller repository + /// + /// Establishes a defined initial state, + /// such as removing all controllers + virtual void Reset() = 0; }; } // namespace mantle_api diff --git a/include/MantleAPI/Traffic/i_entity_repository.h b/include/MantleAPI/Traffic/i_entity_repository.h index 4d00bea1a61e65f3fccfc38566d92ceab4a6397e..8c07355da15457306e205507adba6331de99b2fb 100644 --- a/include/MantleAPI/Traffic/i_entity_repository.h +++ b/include/MantleAPI/Traffic/i_entity_repository.h @@ -114,6 +114,12 @@ public: /// @param name The name of the entity to be deleted virtual void Delete(const std::string& name) = 0; + /// Resets the entity repository + /// + /// Establishes a defined initial state, + /// such as removing all entities + virtual void Reset() = 0; + /// Deletes the reference entity from the scenario /// /// @param id The Identifier of the scenario entity to be deleted diff --git a/test/MantleAPI/Test/test_utils.h b/test/MantleAPI/Test/test_utils.h index 9cf7adf51eeb4a18658dedf6f9812ea3a4682e1b..a9bf23dc9b4ec05fa644c4e5d1c03a2192b328d9 100755 --- a/test/MantleAPI/Test/test_utils.h +++ b/test/MantleAPI/Test/test_utils.h @@ -399,6 +399,11 @@ public: MOCK_METHOD(void, Delete, (UniqueId), (override)); MOCK_METHOD(void, Delete, (const std::string&), (override)); + MOCK_METHOD(void, + Reset, + (), + (override)); + void RegisterEntityCreatedCallback(const std::function<void(IEntity&)>& callback) override { std::ignore = callback; } void RegisterEntityDeletedCallback(const std::function<void(const std::string&)>& callback) override { std::ignore = callback; } void RegisterEntityDeletedCallback(const std::function<void(UniqueId)>& callback) override { std::ignore = callback; } @@ -461,6 +466,11 @@ public: Delete, (UniqueId id), (override)); + + MOCK_METHOD(void, + Reset, + (), + (override)); }; class MockTrafficSwarmService : public mantle_api::ITrafficSwarmService