SUMOAbstractRouter.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef SUMOAbstractRouter_h
00020 #define SUMOAbstractRouter_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 <string>
00033 #include <vector>
00034 #include <algorithm>
00035 #include <utils/common/SUMOTime.h>
00036
00037
00038
00039
00040
00045 template<class E, class V>
00046 class SUMOAbstractRouter {
00047 public:
00052 class ROAbstractEdgeEffortRetriever {
00053 public:
00055 ROAbstractEdgeEffortRetriever() { }
00056
00058 virtual ~ROAbstractEdgeEffortRetriever() { }
00059
00061 virtual SUMOReal getEffort(const V *const, SUMOTime time, const E * const edge,
00062 SUMOReal dist) = 0;
00063
00065 virtual const std::string &getID() const = 0;
00066
00067 };
00068
00069
00070 public:
00072 SUMOAbstractRouter() { }
00073
00075 virtual ~SUMOAbstractRouter() { }
00076
00079 virtual void compute(const E *from, const E *to, const V * const vehicle,
00080 SUMOTime time, std::vector<const E*> &into) = 0;
00081
00082 virtual SUMOReal recomputeCosts(const std::vector<const E*> &edges,
00083 const V * const v, SUMOTime time) throw() = 0;
00084
00085 };
00086
00087
00088 template<class E, class V>
00089 struct prohibited_withRestrictions {
00090 public:
00091 inline bool operator()(const E *edge, const V *vehicle) {
00092 if (std::find(myProhibited.begin(), myProhibited.end(), edge)!=myProhibited.end()) {
00093 return true;
00094 }
00095 return edge->prohibits(vehicle);
00096 }
00097
00098 void prohibit(const std::vector<E*> &toProhibit) {
00099 myProhibited = toProhibit;
00100 }
00101
00102 protected:
00103 std::vector<E*> myProhibited;
00104
00105 };
00106
00107 template<class E, class V>
00108 struct prohibited_noRestrictions {
00109 public:
00110 inline bool operator()(const E *, const V *) {
00111 return false;
00112 }
00113 };
00114
00115
00116
00117
00118 #endif
00119
00120
00121