Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Some helping methods for router
16 /****************************************************************************/
17 #ifndef ROHelper_h
18 #define ROHelper_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <functional>
27 #include <vector>
28 #include "ROEdge.h"
29 #include "ROVehicle.h"
30 
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
42 class ROVehicleByDepartureComperator : public std::less<ROVehicle*> {
43 public:
46 
49 
61  bool operator()(ROVehicle* veh1, ROVehicle* veh2) const {
62  if (veh1->getDepart() == veh2->getDepart()) {
63  return veh1->getID() > veh2->getID();
64  }
65  return veh1->getDepart() > veh2->getDepart();
66  }
67 };
68 
69 
74 namespace ROHelper {
79 void recheckForLoops(ConstROEdgeVector& edges, const ConstROEdgeVector& mandatory);
80 
81 bool noMandatory(const ConstROEdgeVector& mandatory,
82  ConstROEdgeVector::const_iterator start,
83  ConstROEdgeVector::const_iterator end);
84 }
85 
86 #endif
87 
88 /****************************************************************************/
89 
ROHelper::noMandatory
bool noMandatory(const ConstROEdgeVector &mandatory, ConstROEdgeVector::const_iterator start, ConstROEdgeVector::const_iterator end)
Definition: ROHelper.cpp:103
ROVehicle
A vehicle as used by router.
Definition: ROVehicle.h:52
ROVehicle.h
RORoutable::getDepart
SUMOTime getDepart() const
Returns the time the vehicle starts at, -1 for triggered vehicles.
Definition: RORoutable.h:102
ROHelper
Some helping methods for router.
Definition: ROHelper.cpp:35
RORoutable::getID
const std::string & getID() const
Returns the id of the routable.
Definition: RORoutable.h:93
ROVehicleByDepartureComperator
A function for sorting vehicles by their departure time.
Definition: ROHelper.h:42
ROVehicleByDepartureComperator::operator()
bool operator()(ROVehicle *veh1, ROVehicle *veh2) const
Comparing operator.
Definition: ROHelper.h:61
ROVehicleByDepartureComperator::ROVehicleByDepartureComperator
ROVehicleByDepartureComperator()
Constructor.
Definition: ROHelper.h:45
config.h
ROEdge.h
ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
Definition: ROEdge.h:56
ROVehicleByDepartureComperator::~ROVehicleByDepartureComperator
~ROVehicleByDepartureComperator()
Destructor.
Definition: ROHelper.h:48
ROHelper::recheckForLoops
void recheckForLoops(ConstROEdgeVector &edges, const ConstROEdgeVector &mandatory)
Checks whether the given edge list contains loops and removes them.
Definition: ROHelper.cpp:37