SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RORoutable.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A routable thing such as a vehicle or person
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef RORoutable_h
21 #define RORoutable_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <iostream>
35 #include <utils/common/StdDefs.h>
36 #include <utils/common/SUMOTime.h>
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class OutputDevice;
45 class ROEdge;
46 class ROLane;
47 class RONode;
48 class ROVehicle;
49 
50 typedef std::vector<const ROEdge*> ConstROEdgeVector;
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
62 class RORoutable {
63 public:
70  : myParameter(pars), myType(type), myRoutingSuccess(false) {}
71 
72 
74  virtual ~RORoutable() {}
75 
76 
83  inline const SUMOVTypeParameter* getType() const {
84  return myType;
85  }
86 
87 
92  inline const std::string& getID() const {
93  return myParameter.id;
94  }
95 
96 
101  inline SUMOTime getDepart() const {
102  return myParameter.depart;
103  }
104 
105 
106  inline SUMOVehicleClass getVClass() const {
107  return getType() != 0 ? getType()->vehicleClass : SVC_IGNORING;
108  }
109 
110 
112  inline SUMOReal getMaxSpeed() const {
113  return myType->maxSpeed;
114  }
115 
116 
117  virtual const ROEdge* getDepartEdge() const = 0;
118 
119 
120  virtual void computeRoute(const RORouterProvider& provider,
121  const bool removeLoops, MsgHandler* errorHandler) = 0;
122 
123 
131  void write(OutputDevice& os, OutputDevice* const altos,
132  OutputDevice* const typeos, OptionsCont& options) const {
133  if (altos == 0 && typeos == 0) {
134  saveAsXML(os, &os, false, options);
135  } else {
136  saveAsXML(os, typeos, false, options);
137  }
138  if (altos != 0) {
139  saveAsXML(*altos, typeos, true, options);
140  }
141  }
142 
143 
144  inline bool getRoutingSuccess() const {
145  return myRoutingSuccess;
146  }
147 
148 
149 protected:
160  virtual void saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const = 0;
161 
162 
163 protected:
166 
169 
172 
173 
174 private:
176  RORoutable(const RORoutable& src);
177 
179  RORoutable& operator=(const RORoutable& src);
180 
181 };
182 
183 
184 #endif
185 
186 /****************************************************************************/
SUMOVehicleParameter myParameter
The vehicle's parameter.
Definition: RORoutable.h:165
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:101
long long int SUMOTime
Definition: SUMOTime.h:43
A single lane the router may use.
Definition: ROLane.h:57
virtual const ROEdge * getDepartEdge() const =0
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
bool getRoutingSuccess() const
Definition: RORoutable.h:144
std::vector< const ROEdge * > ConstROEdgeVector
Definition: RORoutable.h:48
RORoutable & operator=(const RORoutable &src)
Invalidated assignment operator.
Structure representing possible vehicle parameter.
SUMOVehicleClass vehicleClass
The vehicle's class.
bool myRoutingSuccess
Whether the last routing was successful.
Definition: RORoutable.h:171
virtual void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const =0
Saves the complete routable description.
IntermodalRouter< ROEdge, ROLane, RONode, ROVehicle > ROIntermodalRouter
Definition: RORoutable.h:51
A routable thing such as a vehicle or person.
Definition: RORoutable.h:62
RouterProvider< ROEdge, ROLane, RONode, ROVehicle > RORouterProvider
Definition: RORoutable.h:52
SUMOReal getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition: RORoutable.h:112
A vehicle as used by router.
Definition: ROVehicle.h:60
virtual ~RORoutable()
Destructor.
Definition: RORoutable.h:74
const SUMOVTypeParameter * getType() const
Returns the type of the vehicle.
Definition: RORoutable.h:83
SUMOTime depart
The vehicle's departure time.
A basic edge for routing applications.
Definition: ROEdge.h:77
RORoutable(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition: RORoutable.h:69
virtual void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)=0
SUMOReal maxSpeed
The vehicle type's maximum speed [m/s].
const SUMOVTypeParameter *const myType
The type of the vehicle.
Definition: RORoutable.h:168
Structure representing possible vehicle parameter.
const std::string & getID() const
Returns the id of the vehicle.
Definition: RORoutable.h:92
A storage for options typed value containers)
Definition: OptionsCont.h:99
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:214
Base class for nodes used by the router.
Definition: RONode.h:53
void write(OutputDevice &os, OutputDevice *const altos, OutputDevice *const typeos, OptionsCont &options) const
Saves the routable including the vehicle type (if it was not saved before).
Definition: RORoutable.h:131
SUMOVehicleClass getVClass() const
Definition: RORoutable.h:106
vehicles ignoring classes
std::string id
The vehicle's id.