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-sim.org/
11 // Copyright (C) 2001-2014 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 
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 
136 protected:
144  void setID(RODFRouteDesc& desc) const;
145 
146 
149  public:
151  explicit by_distance_sorter() { }
152 
154  int operator()(const RODFRouteDesc& p1, const RODFRouteDesc& p2) {
155  return p1.distance2Last < p2.distance2Last;
156  }
157  };
158 
159 
161  class route_finder {
162  public:
166  explicit route_finder(const RODFRouteDesc& desc) : myDesc(desc) { }
167 
169  bool operator()(const RODFRouteDesc& desc) {
170  return myDesc.edges2Pass == desc.edges2Pass;
171  }
172 
173  private:
176 
177  private:
180  };
181 
182 protected:
184  std::vector<RODFRouteDesc> myRoutes;
185 
187  mutable std::map<std::pair<ROEdge*, ROEdge*>, int> myConnectionOccurences;
188 
189 
190 };
191 
192 
193 #endif
194 
195 /****************************************************************************/
196