Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • eclipse/openpass/mantle-api
  • adascri/scenario_api
  • jtschea/scenario_api
  • mstump/mantle-api
  • xiaopan/scenario_api
  • AndreasB/scenario_api
  • kcantero/scenario_api
  • dweiwg6/scenario_api
  • shankarpatali/mantle-api
  • etiennep/mantle-api
  • nutario/mantle-api
  • rbiegel/mantle-api
  • nmraghu/mantle-api
  • rparisha2/mantle-api
  • naidagoro/mantle-api
  • kim10101/mantle-api
  • mbehrischv52/mantle-api
  • khbner/mantle-api
  • lappino/mantle-api
  • anastasiiavolkova/mantle-api
  • daniilnikulin/mantle-api
  • mkellerer/mantle-api
  • ansssardesa/mantle-api
  • tonweenink/mantle-api
24 results
Show changes
/*******************************************************************************
* Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
#ifndef MANTLEAPI_EXECUTION_I_ENVIRONMENT_ENGINE_H
#define MANTLEAPI_EXECUTION_I_ENVIRONMENT_ENGINE_H
#include <MantleAPI/Execution/i_environment.h>
#include <MantleAPI/Execution/i_steppable.h>
namespace mantle_api
{
/// Interface for classes that manage the environment
struct IEnvironmentEngine : public ISteppable
{
virtual ~IEnvironmentEngine() = default;
/// \brief Get the environment
virtual mantle_api::IEnvironment* GetEnvironment() noexcept = 0;
};
} // namespace mantle_api
#endif // MANTLEAPI_EXECUTION_I_ENVIRONMENT_ENGINE_H
/*******************************************************************************
* Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* Copyright (c) 2022 Ansys, Inc.
* Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
......@@ -16,15 +17,14 @@
#ifndef MANTLEAPI_EXECUTION_I_SCENARIO_ENGINE_H
#define MANTLEAPI_EXECUTION_I_SCENARIO_ENGINE_H
#include <MantleAPI/Execution/i_steppable.h>
#include <MantleAPI/Execution/scenario_info.h>
#include <string>
namespace mantle_api
{
/// Base interface for the scenario
class IScenarioEngine
class IScenarioEngine : public ISteppable
{
public:
virtual ~IScenarioEngine() = default;
......@@ -44,12 +44,6 @@ public:
/// 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.
/// @see IsFinished()
virtual void Step() = 0;
/// Indicates whether the scenario implementation has finished processing the scenario (end of scenario is reached).
/// @return `true` if processing the scenario is complete, `false` otherwise.
[[nodiscard]] virtual bool IsFinished() const = 0;
......
/*******************************************************************************
* Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
#ifndef MANTLEAPI_EXECUTION_I_STEPPABLE_H
#define MANTLEAPI_EXECUTION_I_STEPPABLE_H
#include <MantleAPI/Common/time_utils.h>
#include <optional>
namespace mantle_api
{
/// Interface for classes that can be stepped in time
struct ISteppable
{
virtual ~ISteppable() = default;
/// \brief Calculate the new state
/// \param[in] size The time step size
virtual void Step(Time size) = 0;
/// \brief Get the time step size
/// \return The time step size
[[nodiscard]] virtual std::optional<mantle_api::Time> GetStepSize() const noexcept = 0;
};
} // namespace mantle_api
#endif // MANTLEAPI_EXECUTION_I_STEPPABLE_H
################################################################################
# Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH
# Copyright (c) 2023-2024, Mercedes-Benz Tech Innovation GmbH
#
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License 2.0 which is available at
......@@ -9,3 +9,4 @@
################################################################################
add_subdirectory(Common)
add_subdirectory(Execution)
################################################################################
# Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH
#
# This program and the accompanying materials are made available under the terms
# of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
################################################################################
add_executable(ExecutionTest)
target_sources(ExecutionTest PUBLIC environment_engine_test.cc)
target_include_directories(ExecutionTest PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/test>)
target_link_libraries(ExecutionTest PUBLIC MantleAPI::MantleAPI GTest::gmock_main)
include(GoogleTest)
gtest_discover_tests(ExecutionTest)
/*******************************************************************************
* Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "MantleAPI/Execution/i_environment_engine.h"
#include "MantleAPI/Execution/mock_environment_engine.h"
namespace
{
using testing::_;
using testing::Const;
class EnvironmentEngineTest : public testing::Test
{
protected:
mantle_api::MockEnvironmentEngine mock_environment_engine_;
mantle_api::IEnvironmentEngine &environment_engine_{mock_environment_engine_};
};
TEST_F(EnvironmentEngineTest, GetEnvironment)
{
EXPECT_CALL(mock_environment_engine_, GetEnvironment()).Times(1);
ASSERT_FALSE(environment_engine_.GetEnvironment());
}
TEST_F(EnvironmentEngineTest, Step)
{
EXPECT_CALL(mock_environment_engine_, Step(_)).Times(1);
ASSERT_NO_THROW(environment_engine_.Step({}));
}
TEST_F(EnvironmentEngineTest, GetStepSize)
{
EXPECT_CALL(Const(mock_environment_engine_), GetStepSize()).Times(1);
ASSERT_FALSE(environment_engine_.GetStepSize());
}
} // namespace
/*******************************************************************************
* Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
#ifndef MANTLEAPI_COMMON_MOCK_ENVIRONMENT_ENGINE_H
#define MANTLEAPI_COMMON_MOCK_ENVIRONMENT_ENGINE_H
#include <gmock/gmock.h>
#include "MantleAPI/Execution/i_environment_engine.h"
namespace mantle_api
{
class MockEnvironmentEngine final : public IEnvironmentEngine
{
public:
MOCK_METHOD(mantle_api::IEnvironment*, GetEnvironment, (), (noexcept, override));
MOCK_METHOD(void, Step, (Time size), (override));
MOCK_METHOD(std::optional<mantle_api::Time>, GetStepSize, (), (const, noexcept, override));
};
} // namespace mantle_api
#endif // MANTLEAPI_COMMON_MOCK_ENVIRONMENT_ENGINE_H