Skip to content
Snippets Groups Projects
Commit dadc2369 authored by René Paris's avatar René Paris
Browse files

Merge branch 'fix_map_details' into 'main'

Fix map details

See merge request !135
parents 6cd48720 5500d0cf
No related branches found
No related tags found
1 merge request!135Fix map details
Pipeline #37568 passed
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2021-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 * available under the terms of the Eclipse Public License 2.0
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <MantleAPI/Common/time_utils.h> #include <MantleAPI/Common/time_utils.h>
#include <map> #include <map>
#include <memory>
#include <string> #include <string>
namespace mantle_api namespace mantle_api
...@@ -25,6 +26,47 @@ namespace mantle_api ...@@ -25,6 +26,47 @@ namespace mantle_api
/// Information about the scenario /// Information about the scenario
struct ScenarioInfo struct ScenarioInfo
{ {
/// Default constructor to avoid nullptr for map details
ScenarioInfo() = default;
/// Copy constructor
/// @param other scenario info to copy
ScenarioInfo(const ScenarioInfo& other)
: scenario_timeout_duration{other.scenario_timeout_duration},
description{other.description},
full_map_path{other.full_map_path},
map_details{other.map_details->Clone()},
additional_information{other.additional_information}
{
}
/// Move constructor
/// @param other scenario info to move
ScenarioInfo(ScenarioInfo&& other) noexcept = default;
/// Copy assignment operator
/// @param other scenario info to copy assign
/// @return copied ScenarioInfo
ScenarioInfo& operator=(const ScenarioInfo& other)
{
if (this != &other)
{
scenario_timeout_duration = other.scenario_timeout_duration;
description = other.description;
full_map_path = other.full_map_path;
map_details = other.map_details->Clone();
additional_information = other.additional_information;
}
return *this;
}
/// Move assignment operator
/// @param other scenario info to move assign
/// @return moved ScenarioInfo
ScenarioInfo& operator=(ScenarioInfo&& other) noexcept = default;
~ScenarioInfo() = default;
/// Duration of the scenario timeout /// Duration of the scenario timeout
Time scenario_timeout_duration; Time scenario_timeout_duration;
/// Specific description of the scenario /// Specific description of the scenario
...@@ -32,7 +74,7 @@ struct ScenarioInfo ...@@ -32,7 +74,7 @@ struct ScenarioInfo
/// Absolute path to the map /// Absolute path to the map
std::string full_map_path; std::string full_map_path;
/// Definition of the map area /// Definition of the map area
MapDetails map_details; std::unique_ptr<MapDetails> map_details{std::make_unique<MapDetails>()};
/// Additional custom information about the scenario /// Additional custom information about the scenario
std::map<std::string, std::string> additional_information; std::map<std::string, std::string> additional_information;
}; };
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2021-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 * available under the terms of the Eclipse Public License 2.0
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <MantleAPI/Common/position.h> #include <MantleAPI/Common/position.h>
#include <memory>
#include <vector> #include <vector>
namespace mantle_api namespace mantle_api
...@@ -26,6 +27,13 @@ struct MapDetails ...@@ -26,6 +27,13 @@ struct MapDetails
{ {
virtual ~MapDetails() = default; virtual ~MapDetails() = default;
/// Cloning MapDetails for usage as unique ptr in ScenarioInfo. Can be overwritten in derived classes.
/// @return Copy of MapDetails
virtual std::unique_ptr<MapDetails> Clone() const
{
return std::make_unique<MapDetails>(*this);
}
/// Area of the map (e.g. GPS latitude, GPS longitude) /// Area of the map (e.g. GPS latitude, GPS longitude)
std::vector<Position> map_region; std::vector<Position> map_region;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment