SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RODFRouteCont.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A container for 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 RODFRouteCont_h
22 #define RODFRouteCont_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 <vector>
35 #include <map>
37 #include "RODFRouteDesc.h"
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class RODFNet;
44 class OutputDevice;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
64 public:
66  RODFRouteCont() ;
67 
69  ~RODFRouteCont() ;
70 
71 
83  void addRouteDesc(RODFRouteDesc& desc) ;
84 
85 
95  bool removeRouteDesc(RODFRouteDesc& desc) ;
96 
97 
106  bool save(std::vector<std::string> &saved,
107  const std::string& prependix, OutputDevice& out);
108 
109 
113  std::vector<RODFRouteDesc> &get() {
114  return myRoutes;
115  }
116 
117 
123  void sortByDistance() ;
124 
125 
133  void removeIllegal(const std::vector<std::vector<ROEdge*> > &illegals) ;
134 
135 
138  void addAllEndFollower() ;
139 
140 
141 protected:
149  void setID(RODFRouteDesc& desc) const ;
150 
151 
154  public:
156  explicit by_distance_sorter() { }
157 
159  int operator()(const RODFRouteDesc& p1, const RODFRouteDesc& p2) {
160  return p1.distance2Last < p2.distance2Last;
161  }
162  };
163 
164 
166  class route_finder {
167  public:
171  explicit route_finder(const RODFRouteDesc& desc) : myDesc(desc) { }
172 
174  bool operator()(const RODFRouteDesc& desc) {
175  return myDesc.edges2Pass == desc.edges2Pass;
176  }
177 
178  private:
181 
182  };
183 
184 protected:
186  std::vector<RODFRouteDesc> myRoutes;
187 
189  mutable std::map<std::pair<ROEdge*, ROEdge*>, int> myConnectionOccurences;
190 
191 
192 };
193 
194 
195 #endif
196 
197 /****************************************************************************/
198