NBOwnTLDef.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NBOwnTLDef_h
00020 #define NBOwnTLDef_h
00021
00022
00023
00024
00025
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031
00032 #include <vector>
00033 #include <set>
00034 #include "NBTrafficLightDefinition.h"
00035 #include "NBMMLDirections.h"
00036
00037
00038
00039
00040
00041 class NBNode;
00042
00043
00044
00045
00046
00051 class NBOwnTLDef : public NBTrafficLightDefinition {
00052 public:
00057 NBOwnTLDef(const std::string &id,
00058 const std::vector<NBNode*> &junctions) throw();
00059
00060
00065 NBOwnTLDef(const std::string &id, NBNode *junction) throw();
00066
00067
00071 NBOwnTLDef(const std::string &id) throw();
00072
00073
00075 ~NBOwnTLDef() throw();
00076
00077
00081 void setParticipantsInformation() throw();
00082
00083
00086
00093 void remapRemoved(NBEdge *removed,
00094 const EdgeVector &incoming, const EdgeVector &outgoing) throw();
00095
00096
00101 void setTLControllingInformation(const NBEdgeCont &ec) const throw();
00103
00104
00105 protected:
00108
00115 NBTrafficLightLogic *myCompute(const NBEdgeCont &ec,
00116 unsigned int brakingTime) throw();
00117
00118
00122 void collectNodes() throw();
00123
00124
00129 void collectLinks() throw(ProcessError);
00130
00131
00139 void replaceRemoved(NBEdge *removed, int removedLane,
00140 NBEdge *by, int byLane) throw();
00142
00143
00144 protected:
00150 SUMOReal getDirectionalWeight(NBMMLDirection dir) throw();
00151
00152
00157 int getToPrio(const NBEdge * const e) throw();
00158
00159
00165 SUMOReal computeUnblockedWeightedStreamNumber(const NBEdge * const e1, const NBEdge * const e2) throw();
00166
00167
00172 std::pair<NBEdge*, NBEdge*> getBestCombination(const std::vector<NBEdge*> &edges) throw();
00173
00174
00182 std::pair<NBEdge*, NBEdge*> getBestPair(std::vector<NBEdge*> &incoming) throw();
00183
00184
00188 class edge_by_incoming_priority_sorter {
00189 public:
00194 int operator()(const NBEdge * const e1, const NBEdge * const e2) const {
00195 if (e1->getJunctionPriority(e1->getToNode())!=e2->getJunctionPriority(e2->getToNode())) {
00196 return e1->getJunctionPriority(e1->getToNode())> e2->getJunctionPriority(e2->getToNode());
00197 }
00198 return e1->getID() > e2->getID();
00199 }
00200 };
00201
00202 };
00203
00204
00205 #endif
00206
00207
00208