SUMO - Simulation of Urban MObility
ROHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Some helping methods for router
19 /****************************************************************************/
20 #ifndef ROHelper_h
21 #define ROHelper_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 <functional>
34 #include <vector>
35 #include "ROEdge.h"
36 #include "ROVehicle.h"
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
49 class ROVehicleByDepartureComperator : public std::less<ROVehicle*> {
50 public:
53 
56 
68  bool operator()(ROVehicle* veh1, ROVehicle* veh2) const {
69  if (veh1->getDepart() == veh2->getDepart()) {
70  return veh1->getID() > veh2->getID();
71  }
72  return veh1->getDepart() > veh2->getDepart();
73  }
74 };
75 
76 
81 namespace ROHelper {
87 
88 }
89 
90 #endif
91 
92 /****************************************************************************/
93 
ROVehicleByDepartureComperator()
Constructor.
Definition: ROHelper.h:52
void recheckForLoops(ConstROEdgeVector &edges)
Checks whether the given edge list contains loops and removes them.
Definition: ROHelper.cpp:43
bool operator()(ROVehicle *veh1, ROVehicle *veh2) const
Comparing operator.
Definition: ROHelper.h:68
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:62
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:109
Some helping methods for router.
Definition: ROHelper.cpp:41
A vehicle as used by router.
Definition: ROVehicle.h:59
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:100
A function for sorting vehicles by their departure time.
Definition: ROHelper.h:49
~ROVehicleByDepartureComperator()
Destructor.
Definition: ROHelper.h:55