Skip to content
Snippets Groups Projects
scenario_info.h 2.69 KiB
Newer Older
Arun Das's avatar
Arun Das committed
/*******************************************************************************
Andreas Rauschert's avatar
Andreas Rauschert committed
 * Copyright (c) 2021-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
Arun Das's avatar
Arun Das committed
 *
 * 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
 *******************************************************************************/
Arun Das's avatar
Arun Das committed

//-----------------------------------------------------------------------------
/** @file  scenario_info.h */
//-----------------------------------------------------------------------------

#ifndef MANTLEAPI_EXECUTION_SCENARIO_INFO_H
#define MANTLEAPI_EXECUTION_SCENARIO_INFO_H
Arun Das's avatar
Arun Das committed

#include <MantleAPI/Map/map_details.h>
Arun Das's avatar
Arun Das committed

#include <map>
Andreas Rauschert's avatar
Andreas Rauschert committed
#include <memory>
Arun Das's avatar
Arun Das committed
#include <string>

namespace mantle_api
{
/// Information about the scenario
Arun Das's avatar
Arun Das committed
struct ScenarioInfo
{
Andreas Rauschert's avatar
Andreas Rauschert committed
  /// 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
  Time scenario_timeout_duration;
  /// Specific description of the scenario
  std::string description;
David Weiß's avatar
David Weiß committed
  /// Absolute path to the map
  std::string full_map_path;
  /// Definition of the map area
Andreas Rauschert's avatar
Andreas Rauschert committed
  std::unique_ptr<MapDetails> map_details{std::make_unique<MapDetails>()};
  /// Additional custom information about the scenario
  std::map<std::string, std::string> additional_information;
Arun Das's avatar
Arun Das committed
};

}  // namespace mantle_api

#endif  // MANTLEAPI_EXECUTION_SCENARIO_INFO_H