SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RORouteDef.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Base class for a vehicle's route definition
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef RORouteDef_h
22 #define RORouteDef_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <iostream>
36 #include <utils/common/Named.h>
37 #include "ReferencedItem.h"
39 #include "RORoute.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class ROEdge;
46 class OptionsCont;
47 class ROVehicle;
48 class OutputDevice;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
63 class RORouteDef : public ReferencedItem, public Named {
64 public:
70  RORouteDef(const std::string& id, const unsigned int lastUsed,
71  const bool tryRepair);
72 
73 
75  virtual ~RORouteDef();
76 
77 
80  void addLoadedAlternative(RORoute* alternative);
81 
83  void addAlternativeDef(const RORouteDef* alternative);
84 
88  const ROVehicle& veh) const;
89 
93  const ROVehicle& veh) const;
94 
98  const ROVehicle& veh) const;
99 
104  const ROVehicle* const, RORoute* current, SUMOTime begin);
105 
106  const ROEdge* getDestination() const;
107 
116  OutputDevice& writeXMLDefinition(OutputDevice& dev, const ROVehicle* const veh,
117  bool asAlternatives, bool withExitTimes) const;
118 
127  RORouteDef* copyOrigDest(const std::string& id) const;
128 
137  RORouteDef* copy(const std::string& id) const;
138 
140  SUMOReal getOverallProb() const;
141 
142 protected:
145 
147  mutable unsigned int myLastUsed;
148 
150  std::vector<RORoute*> myAlternatives;
151 
153  mutable bool myNewRoute;
154 
155  const bool myTryRepair;
156 
157 private:
160  bool operator()(const RORoute* const a, const RORoute* const b) {
161  return a->getProbability() > b->getProbability();
162  }
163  };
164 
165 private:
167  RORouteDef(const RORouteDef& src);
168 
170  RORouteDef& operator=(const RORouteDef& src);
171 
172 };
173 
174 
175 #endif
176 
177 /****************************************************************************/
178 
bool myNewRoute
Information whether a new route was generated.
Definition: RORouteDef.h:153
RORouteDef * copyOrigDest(const std::string &id) const
Returns a origin-destination copy of the route definition.
Definition: RORouteDef.cpp:339
const bool myTryRepair
Definition: RORouteDef.h:155
void addAlternative(SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const, RORoute *current, SUMOTime begin)
Adds an alternative to the list of routes.
Definition: RORouteDef.cpp:229
RORoute * buildCurrentRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime begin, const ROVehicle &veh) const
Triggers building of the complete route (via preComputeCurrentRoute) or returns precomputed route...
Definition: RORouteDef.cpp:87
void addAlternativeDef(const RORouteDef *alternative)
Adds an alternative loaded from the file.
Definition: RORouteDef.cpp:80
void preComputeCurrentRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime begin, const ROVehicle &veh) const
Builds the complete route (or chooses her from the list of alternatives, when existing) ...
Definition: RORouteDef.cpp:97
void repairCurrentRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime begin, const ROVehicle &veh) const
Builds the complete route (or chooses her from the list of alternatives, when existing) ...
Definition: RORouteDef.cpp:145
RORoute * myPrecomputed
precomputed route for out-of-order computation
Definition: RORouteDef.h:144
A vehicle as used by router.
Definition: ROVehicle.h:57
Helper base for things that are referenced and have to be saved only once.
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, bool asAlternatives, bool withExitTimes) const
Saves the built route / route alternatives.
Definition: RORouteDef.cpp:323
SUMOReal getProbability() const
Returns the probability the driver will take this route with.
Definition: RORoute.h:126
const ROEdge * getDestination() const
Definition: RORouteDef.cpp:317
A basic edge for routing applications.
Definition: ROEdge.h:67
Base class for objects which have an id.
Definition: Named.h:45
virtual ~RORouteDef()
Destructor.
Definition: RORouteDef.cpp:66
unsigned int myLastUsed
Index of the route used within the last step.
Definition: RORouteDef.h:147
bool operator()(const RORoute *const a, const RORoute *const b)
Definition: RORouteDef.h:160
RORouteDef(const std::string &id, const unsigned int lastUsed, const bool tryRepair)
Constructor.
Definition: RORouteDef.cpp:59
RORouteDef * copy(const std::string &id) const
Returns a deep copy of the route definition.
Definition: RORouteDef.cpp:352
A storage for options typed value containers)
Definition: OptionsCont.h:108
Base class for a vehicle&#39;s route definition.
Definition: RORouteDef.h:63
void addLoadedAlternative(RORoute *alternative)
Adds a single alternative loaded from the file An alternative may also be generated during DUA...
Definition: RORouteDef.cpp:74
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
#define SUMOReal
Definition: config.h:221
RORouteDef & operator=(const RORouteDef &src)
Invalidated assignment operator.
std::vector< RORoute * > myAlternatives
The alternatives.
Definition: RORouteDef.h:150
SUMOReal getOverallProb() const
Returns the sum of the probablities of the contained routes.
Definition: RORouteDef.cpp:364
A complete router&#39;s route.
Definition: RORoute.h:58