SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RORouteDef_Alternatives.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A route with alternative routes
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 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_Alternatives_h
22 #define RORouteDef_Alternatives_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 <vector>
36 #include "RORoute.h"
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class ROEdge;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
53 public:
55  RORouteDef_Alternatives(const std::string& id, unsigned int lastUsed, const int maxRoutes,
56  const bool keepRoutes, const bool skipRouteCalculation) ;
57 
59  virtual ~RORouteDef_Alternatives() ;
60 
63  virtual void addLoadedAlternative(RORoute* alternative);
64 
67  const ROVehicle& veh) const;
68 
71  const ROVehicle* const, RORoute* current, SUMOTime begin);
72 
74  RORouteDef* copy(const std::string& id) const;
75 
76  void invalidateLast();
77 
78  void removeLast();
79 
81  OutputDevice& dev, const ROVehicle* const veh,
82  bool asAlternatives, bool withExitTimes) const;
83 
84  /* @brief Returns destination of this route definition */
85  const ROEdge* getDestination() const;
86 
87 private:
89  int findRoute(RORoute* opt) const;
90 
93  bool operator()(const RORoute* const a, const RORoute* const b) {
94  return a->getProbability() > b->getProbability();
95  }
96  };
97 
98 private:
100  mutable bool myNewRoute;
101 
103  mutable int myLastUsed;
104 
106  typedef std::vector<RORoute*> AlternativesVector;
107 
110 
112  const int myMaxRouteNumber;
113 
115  const bool myKeepRoutes;
116 
119 
120 
121 private:
124 
127 
128 };
129 
130 
131 #endif
132 
133 /****************************************************************************/
134