#include <MSEdgeWeightsStorage.h>
Definition at line 50 of file MSEdgeWeightsStorage.h.
Public Member Functions | |
| void | addEffort (const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value) throw () |
| Adds an effort information for an edge and a time span. | |
| void | addTravelTime (const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value) throw () |
| Adds a travel time information for an edge and a time span. | |
| bool | knowsEffort (const MSEdge *const e) const throw () |
| Returns the information whether any effort is known for the given edge. | |
| bool | knowsTravelTime (const MSEdge *const e) const throw () |
| Returns the information whether any travel time is known for the given edge. | |
| MSEdgeWeightsStorage () throw () | |
| Constructor. | |
| void | removeEffort (const MSEdge *const e) throw () |
| Removes the effort information for an edge. | |
| void | removeTravelTime (const MSEdge *const e) throw () |
| Removes the travel time information for an edge. | |
| bool | retrieveExistingEffort (const MSEdge *const e, const SUMOVehicle *const v, SUMOReal t, SUMOReal &value) const throw () |
| Returns an effort for an edge and time if stored. | |
| bool | retrieveExistingTravelTime (const MSEdge *const e, const SUMOVehicle *const v, SUMOReal t, SUMOReal &value) const throw () |
| Returns a travel time for an edge and time if stored. | |
| ~MSEdgeWeightsStorage () throw () | |
| Destructor. | |
Private Member Functions | |
| MSEdgeWeightsStorage (const MSEdgeWeightsStorage &) | |
| Invalidated copy constructor. | |
| MSEdgeWeightsStorage & | operator= (const MSEdgeWeightsStorage &) |
| Invalidated assignment operator. | |
Private Attributes | |
| std::map< MSEdge *, ValueTimeLine< SUMOReal > > | myEfforts |
| A map of edge->time->effort. | |
| std::map< MSEdge *, ValueTimeLine< SUMOReal > > | myTravelTimes |
| A map of edge->time->travel time. | |
| MSEdgeWeightsStorage::MSEdgeWeightsStorage | ( | ) | throw () |
| MSEdgeWeightsStorage::~MSEdgeWeightsStorage | ( | ) | throw () |
| MSEdgeWeightsStorage::MSEdgeWeightsStorage | ( | const MSEdgeWeightsStorage & | ) | [private] |
Invalidated copy constructor.
| void MSEdgeWeightsStorage::addEffort | ( | const MSEdge *const | e, | |
| SUMOReal | begin, | |||
| SUMOReal | end, | |||
| SUMOReal | value | |||
| ) | throw () |
Adds an effort information for an edge and a time span.
| [in] | e | The described edge |
| [in] | begin | The begin of the described time span |
| [in] | end | The end of the described time span |
| [in] | value | Theeffort value for this edge and time span |
Definition at line 93 of file MSEdgeWeightsStorage.cpp.
References myEfforts.
Referenced by TraCIServerAPI_Vehicle::processSet(), and TraCIServerAPI_Edge::processSet().
00095 { 00096 std::map<MSEdge*, ValueTimeLine<SUMOReal> >::iterator i = myEfforts.find((MSEdge*) e); 00097 if (i==myEfforts.end()) { 00098 myEfforts[(MSEdge*)e] = ValueTimeLine<SUMOReal>(); 00099 i = myEfforts.find((MSEdge*) e); 00100 } 00101 (*i).second.add(begin, end, value); 00102 }
| void MSEdgeWeightsStorage::addTravelTime | ( | const MSEdge *const | e, | |
| SUMOReal | begin, | |||
| SUMOReal | end, | |||
| SUMOReal | value | |||
| ) | throw () |
Adds a travel time information for an edge and a time span.
| [in] | e | The described edge |
| [in] | begin | The begin of the described time span |
| [in] | end | The end of the described time span |
| [in] | value | The travel time value for this edge and time span |
Definition at line 80 of file MSEdgeWeightsStorage.cpp.
References myTravelTimes.
Referenced by traci::TraCIServer::commandChangeRoute(), TraCIServerAPI_Vehicle::processSet(), and TraCIServerAPI_Edge::processSet().
00082 { 00083 std::map<MSEdge*, ValueTimeLine<SUMOReal> >::iterator i = myTravelTimes.find((MSEdge*) e); 00084 if (i==myTravelTimes.end()) { 00085 myTravelTimes[(MSEdge*)e] = ValueTimeLine<SUMOReal>(); 00086 i = myTravelTimes.find((MSEdge*) e); 00087 } 00088 (*i).second.add(begin, end, value); 00089 }
Returns the information whether any effort is known for the given edge.
| [in] | e | The investigated edge |
Definition at line 130 of file MSEdgeWeightsStorage.cpp.
References myEfforts.
Returns the information whether any travel time is known for the given edge.
| [in] | e | The investigated edge |
Definition at line 124 of file MSEdgeWeightsStorage.cpp.
References myTravelTimes.
Referenced by traci::TraCIServer::commandChangeRoute().
00124 { 00125 return myTravelTimes.find((MSEdge*) e)!=myTravelTimes.end(); 00126 }
| MSEdgeWeightsStorage& MSEdgeWeightsStorage::operator= | ( | const MSEdgeWeightsStorage & | ) | [private] |
Invalidated assignment operator.
| void MSEdgeWeightsStorage::removeEffort | ( | const MSEdge *const | e | ) | throw () |
Removes the effort information for an edge.
| [in] | e | The described edge |
Definition at line 115 of file MSEdgeWeightsStorage.cpp.
References myEfforts.
00115 { 00116 std::map<MSEdge*, ValueTimeLine<SUMOReal> >::iterator i = myEfforts.find((MSEdge*) e); 00117 if (i!=myEfforts.end()) { 00118 myEfforts.erase(i); 00119 } 00120 }
| void MSEdgeWeightsStorage::removeTravelTime | ( | const MSEdge *const | e | ) | throw () |
Removes the travel time information for an edge.
| [in] | e | The described edge |
Definition at line 106 of file MSEdgeWeightsStorage.cpp.
References myTravelTimes.
Referenced by traci::TraCIServer::commandChangeRoute().
00106 { 00107 std::map<MSEdge*, ValueTimeLine<SUMOReal> >::iterator i = myTravelTimes.find((MSEdge*) e); 00108 if (i!=myTravelTimes.end()) { 00109 myTravelTimes.erase(i); 00110 } 00111 }
| bool MSEdgeWeightsStorage::retrieveExistingEffort | ( | const MSEdge *const | e, | |
| const SUMOVehicle *const | v, | |||
| SUMOReal | t, | |||
| SUMOReal & | value | |||
| ) | const throw () |
Returns an effort for an edge and time if stored.
| [in] | e | The edge for which the effort shall be retrieved |
| [in] | v | Unused |
| [in] | t | The time for which the effort shall be retrieved |
| [in] | value | The value if the requested edge/time is described |
Definition at line 64 of file MSEdgeWeightsStorage.cpp.
References ValueTimeLine< T >::describesTime(), ValueTimeLine< T >::getValue(), and myEfforts.
Referenced by MSNet::EdgeWeightsProxi::getEffort(), and TraCIServerAPI_Vehicle::processGet().
00065 { 00066 std::map<MSEdge*, ValueTimeLine<SUMOReal> >::const_iterator i = myEfforts.find((MSEdge*) e); 00067 if (i==myEfforts.end()) { 00068 return false; 00069 } 00070 const ValueTimeLine<SUMOReal> &tl = (*i).second; 00071 if (!tl.describesTime(t)) { 00072 return false; 00073 } 00074 value = tl.getValue(t); 00075 return true; 00076 }
| bool MSEdgeWeightsStorage::retrieveExistingTravelTime | ( | const MSEdge *const | e, | |
| const SUMOVehicle *const | v, | |||
| SUMOReal | t, | |||
| SUMOReal & | value | |||
| ) | const throw () |
Returns a travel time for an edge and time if stored.
| [in] | e | The edge for which the travel time shall be retrieved |
| [in] | v | Unused |
| [in] | t | The time for which the travel time shall be retrieved |
| [in] | value | The value if the requested edge/time is described |
Definition at line 48 of file MSEdgeWeightsStorage.cpp.
References ValueTimeLine< T >::describesTime(), ValueTimeLine< T >::getValue(), and myTravelTimes.
Referenced by MSNet::EdgeWeightsProxi::getTravelTime(), and TraCIServerAPI_Vehicle::processGet().
00049 { 00050 std::map<MSEdge*, ValueTimeLine<SUMOReal> >::const_iterator i = myTravelTimes.find((MSEdge*) e); 00051 if (i==myTravelTimes.end()) { 00052 return false; 00053 } 00054 const ValueTimeLine<SUMOReal> &tl = (*i).second; 00055 if (!tl.describesTime(t)) { 00056 return false; 00057 } 00058 value = tl.getValue(t); 00059 return true; 00060 }
std::map<MSEdge*, ValueTimeLine<SUMOReal> > MSEdgeWeightsStorage::myEfforts [private] |
A map of edge->time->effort.
Definition at line 131 of file MSEdgeWeightsStorage.h.
Referenced by addEffort(), knowsEffort(), removeEffort(), and retrieveExistingEffort().
std::map<MSEdge*, ValueTimeLine<SUMOReal> > MSEdgeWeightsStorage::myTravelTimes [private] |
A map of edge->time->travel time.
Definition at line 128 of file MSEdgeWeightsStorage.h.
Referenced by addTravelTime(), knowsTravelTime(), removeTravelTime(), and retrieveExistingTravelTime().
1.5.6