Path: blob/main/src/traci-server/TraCIServerAPI_Simulation.h
169665 views
/****************************************************************************/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 TraCIServerAPI_Simulation.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date 07.05.200917///18// APIs for getting/setting edge values via TraCI19/****************************************************************************/20#pragma once21#include <config.h>2223#include <string>24#include <map>25#include <vector>26#include "TraCIServer.h"27#include <foreign/tcpip/storage.h>282930// ===========================================================================31// class definitions32// ===========================================================================33/**34* @class TraCIServerAPI_Simulation35* @brief APIs for getting/setting simulation values via TraCI36*/37class TraCIServerAPI_Simulation {38public:39/** @brief Processes a get value command (Command 0xab: Get Simulation Variable)40*41* @param[in] server The TraCI-server-instance which schedules this request42* @param[in] inputStorage The storage to read the command from43* @param[out] outputStorage The storage to write the result to44*/45static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage,46tcpip::Storage& outputStorage);4748/** @brief Processes a set value command (Command 0xcb: Set Simulation Variable)49*50* @param[in] server The TraCI-server-instance which schedules this request51* @param[in] inputStorage The storage to read the command from52* @param[out] outputStorage The storage to write the result to53*/54static bool processSet(TraCIServer& server, tcpip::Storage& inputStorage,55tcpip::Storage& outputStorage);5657private:58/**59* Converts a road map position to a cartesian position60*61* @param pos road map position that is to be convertes62* @return closest 2D position63*/6465static bool commandPositionConversion(TraCIServer& server, tcpip::Storage& inputStorage,66const int compoundSize, tcpip::Storage& outputStorage,67const int commandId);6869static bool commandDistanceRequest(TraCIServer& server, tcpip::Storage& inputStorage,70tcpip::Storage& outputStorage, int commandId);7172static void writeVehicleStateNumber(TraCIServer& server, tcpip::Storage& outputStorage, MSNet::VehicleState state);73static void writeVehicleStateIDs(TraCIServer& server, tcpip::Storage& outputStorage, MSNet::VehicleState state);7475static void writeTransportableStateNumber(TraCIServer& server, tcpip::Storage& outputStorage, MSNet::TransportableState state);76static void writeTransportableStateIDs(TraCIServer& server, tcpip::Storage& outputStorage, MSNet::TransportableState state);777879private:80/// @brief invalidated copy constructor81TraCIServerAPI_Simulation(const TraCIServerAPI_Simulation& s);8283/// @brief invalidated assignment operator84TraCIServerAPI_Simulation& operator=(const TraCIServerAPI_Simulation& s);858687};888990