MSEdgeWeightsStorage Class Reference

#include <MSEdgeWeightsStorage.h>


Detailed Description

A storage for edge travel times and efforts.

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.
MSEdgeWeightsStorageoperator= (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.

Constructor & Destructor Documentation

MSEdgeWeightsStorage::MSEdgeWeightsStorage (  )  throw ()

Constructor.

Definition at line 39 of file MSEdgeWeightsStorage.cpp.

00039                                                    {
00040 }

MSEdgeWeightsStorage::~MSEdgeWeightsStorage (  )  throw ()

Destructor.

Definition at line 43 of file MSEdgeWeightsStorage.cpp.

00043                                                     {
00044 }

MSEdgeWeightsStorage::MSEdgeWeightsStorage ( const MSEdgeWeightsStorage  )  [private]

Invalidated copy constructor.


Member Function Documentation

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.

Parameters:
[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.

Parameters:
[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 }

bool MSEdgeWeightsStorage::knowsEffort ( const MSEdge *const   e  )  const throw ()

Returns the information whether any effort is known for the given edge.

Parameters:
[in] e The investigated edge
Returns:
Whether any travel time information about this edge is stored

Definition at line 130 of file MSEdgeWeightsStorage.cpp.

References myEfforts.

00130                                                                       {
00131     return myEfforts.find((MSEdge*) e)!=myEfforts.end();
00132 }

bool MSEdgeWeightsStorage::knowsTravelTime ( const MSEdge *const   e  )  const throw ()

Returns the information whether any travel time is known for the given edge.

Parameters:
[in] e The investigated edge
Returns:
Whether any travel time information about this edge is stored

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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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
Returns:
Whether 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.

Parameters:
[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
Returns:
Whether 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 }


Field Documentation

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().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:47 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6