/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GUIMEVehicleControl.h14/// @author Jakob Erdmann15/// @date Okt 201216///17// The class responsible for building and deletion of meso vehicles (gui-version)18/****************************************************************************/19#pragma once20#include <config.h>2122#include <vector>23#include <utils/foxtools/fxheader.h>24#include <utils/gui/globjects/GUIGlObject.h>25#include <mesosim/MEVehicleControl.h>262728// ===========================================================================29// class definitions30// ===========================================================================31/**32* @class GUIMEVehicleControl33* @brief The class responsible for building and deletion of vehicles (gui-version)34*35* @see MEVehicleControl36*/37class GUIMEVehicleControl : public MEVehicleControl {38public:39/// @brief Constructor40GUIMEVehicleControl() ;414243/// @brief Destructor44~GUIMEVehicleControl() ;4546/// @name Vehicle creation47/// @{4849/** @brief Builds a vehicle, increases the number of built vehicles50*51* Instead of a MEVehicle, a GUIMEVehicle is built52*53* @param[in] defs The parameter defining the vehicle54* @param[in] route The route of this vehicle55* @param[in] type The type of this vehicle56* @param[in] ignoreStopErrors whether invalid stops trigger a warning only57* @param[in] source whether we are just reading the route file or creating via trigger, traci, ...58* @return The built vehicle (GUIVehicle instance)59* @see MSVehicleControl::buildVehicle60*/61SUMOVehicle* buildVehicle(SUMOVehicleParameter* defs,62ConstMSRoutePtr route, MSVehicleType* type,63const bool ignoreStopErrors, const VehicleDefinitionSource source = VehicleDefinitionSource::ROUTEFILE,64bool addRouteStops = true) override;65/// @}6667/** @brief Tries to insert the vehicle into the internal vehicle container68*69* Identical to the MSVehicleControl implementation except for locking.70*71* @param[in] id The id of the vehicle72* @param[in] v The vehicle73* @return Whether the vehicle could be inserted (no other vehicle with the same id was inserted before)74*/75bool addVehicle(const std::string& id, SUMOVehicle* v) override;7677/** @brief Deletes the vehicle78*79* Identical to the MSVehicleControl implementation except for locking.80*81* @param[in] v The vehicle to delete82* @param[discard] Whether the vehicle is discard during loading (scale < 1)83*/84void deleteVehicle(SUMOVehicle* v, bool discard = false, bool wasKept = false) override;8586/** @brief Returns the list of all known vehicles by gl-id87* @param[fill] into The list to fill with vehicle ids88* @todo Well, what about concurrent modifications?89*/90void insertVehicleIDs(std::vector<GUIGlID>& into);9192/// @brief get current absolute and relative mean vehicle speed in the network93virtual std::pair<double, double> getVehicleMeanSpeeds() const override;9495/** @brief Returns the number of halting vehicles96* @return The number of halting vehicles97*/98virtual int getHaltingVehicleNo() const override;99100/// @brief lock access to vehicle removal/additions for thread synchronization101void secureVehicles() override;102103/// @brief unlock access to vehicle removal/additions for thread synchronization104void releaseVehicles() override;105106107private:108/// The mutex used to avoid concurrent updates of the vehicle buffer109mutable FXMutex myLock;110111112private:113/// @brief invalidated copy constructor114GUIMEVehicleControl(const GUIMEVehicleControl& s);115116/// @brief invalidated assignment operator117GUIMEVehicleControl& operator=(const GUIMEVehicleControl& s);118119120};121122123