Eclipse SUMO - Simulation of Urban MObility
NBVehicle.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2002-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// A vehicle as used by router
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <string>
26#include <iostream>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
42class NBVehicle {
43public:
50 NBVehicle(const std::string& id, SUMOVehicleClass vClass):
51 myID(id), myVClass(vClass), myLength(getDefaultVehicleLength(vClass)) {}
52
53 const std::string& getID() const {
54 return myID;
55 }
56
58 return myVClass;
59 }
60
61 double getLength() const {
62 return myLength;
63 }
64
66 virtual ~NBVehicle() {}
67
68
69private:
71 std::string myID;
72
75
77 double myLength;
78
79
80private:
82 NBVehicle(const NBVehicle& src);
83
86
87};
double getDefaultVehicleLength(const SUMOVehicleClass vc)
Returns the default vehicle length This put into a function so it can be used by NBVehicle.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
A vehicle as used by router.
Definition: NBVehicle.h:42
virtual ~NBVehicle()
Destructor.
Definition: NBVehicle.h:66
NBVehicle(const NBVehicle &src)
Invalidated copy constructor.
double myLength
The length of the vehicle (for rail-routing)
Definition: NBVehicle.h:77
std::string myID
vehicle ID for error reporting
Definition: NBVehicle.h:71
SUMOVehicleClass myVClass
The vehicle class of the vehicle.
Definition: NBVehicle.h:74
double getLength() const
Definition: NBVehicle.h:61
NBVehicle(const std::string &id, SUMOVehicleClass vClass)
Constructor.
Definition: NBVehicle.h:50
SUMOVehicleClass getVClass() const
Definition: NBVehicle.h:57
NBVehicle & operator=(const NBVehicle &src)
Invalidated assignment operator.
const std::string & getID() const
Definition: NBVehicle.h:53