1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2007-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file MSVehicleDevice.h 11 /// @author Michael Behrisch 12 /// @author Daniel Krajzewicz 13 /// @author Jakob Erdmann 14 /// @date Tue, 04 Dec 2007 15 /// @version $Id$ 16 /// 17 // Abstract in-vehicle device 18 /****************************************************************************/ 19 #ifndef MSVehicleDevice_h 20 #define MSVehicleDevice_h 21 22 23 // =========================================================================== 24 // included modules 25 // =========================================================================== 26 #include <config.h> 27 28 #include <string> 29 #include <vector> 30 #include <map> 31 #include <set> 32 #include <random> 33 #include <utils/vehicle/SUMOVehicle.h> 34 #include <microsim/MSMoveReminder.h> 35 #include "MSDevice.h" 36 37 38 // =========================================================================== 39 // class definitions 40 // =========================================================================== 41 /** 42 * @class MSVehicleDevice 43 * @brief Abstract in-vehicle device 44 * 45 * The MSVehicleDevice-interface brings the following interfaces to a vehicle that 46 * may be overwritten by real devices: 47 * @arg Retrieval of the vehicle that holds the device 48 * @arg Building and retrieval of a device id 49 * @arg Methods called on vehicle movement / state change 50 * 51 * The "methods called on vehicle movement / state change" are called for each 52 * device within the corresponding vehicle methods. MSVehicleDevice brings already 53 * an empty (nothing doing) implementation of these. 54 */ 55 class MSVehicleDevice : public MSMoveReminder, public MSDevice { 56 public: 57 /** @brief Constructor 58 * 59 * @param[in] holder The vehicle that holds this device 60 * @param[in] id The ID of the device 61 */ MSVehicleDevice(SUMOVehicle & holder,const std::string & id)62 MSVehicleDevice(SUMOVehicle& holder, const std::string& id) : 63 MSMoveReminder(id), MSDevice(id), myHolder(holder) { 64 } 65 66 67 /// @brief Destructor ~MSVehicleDevice()68 virtual ~MSVehicleDevice() { } 69 70 71 /** @brief Returns the vehicle that holds this device 72 * 73 * @return The vehicle that holds this device 74 */ getHolder()75 inline SUMOVehicle& getHolder() const { 76 return myHolder; 77 } 78 getNumericalID()79 inline SUMOVehicle::NumericalID getNumericalID() const { 80 return myHolder.getNumericalID(); 81 } 82 83 protected: 84 /// @brief The vehicle that stores the device 85 SUMOVehicle& myHolder; 86 87 private: 88 /// @brief Invalidated copy constructor. 89 MSVehicleDevice(const MSVehicleDevice&); 90 91 /// @brief Invalidated assignment operator. 92 MSVehicleDevice& operator=(const MSVehicleDevice&); 93 94 }; 95 96 97 #endif 98 99 /****************************************************************************/ 100 101