SUMO - Simulation of Urban MObility
RODFRouteCont Class Reference

A container for DFROUTER-routes. More...

#include <RODFRouteCont.h>

Collaboration diagram for RODFRouteCont:
Collaboration graph

Data Structures

class  by_distance_sorter
 A class for sorting route descriptions by their length. More...
 
class  route_finder
 A class for finding a same route (one that passes the same edges) More...
 

Public Member Functions

void addRouteDesc (RODFRouteDesc &desc)
 Adds a route to the container. More...
 
std::vector< RODFRouteDesc > & get ()
 Returns the container of stored routes. More...
 
void removeIllegal (const std::vector< ROEdgeVector > &illegals)
 Removes "illegal" routes. More...
 
bool removeRouteDesc (RODFRouteDesc &desc)
 Removes the given route description from the container. More...
 
 RODFRouteCont ()
 Constructor. More...
 
bool save (std::vector< std::string > &saved, const std::string &prependix, OutputDevice &out)
 Saves routes. More...
 
void sortByDistance ()
 Sorts routes by their distance (length) More...
 
 ~RODFRouteCont ()
 Destructor. More...
 

Protected Member Functions

void setID (RODFRouteDesc &desc) const
 Computes and sets the id of a route. More...
 

Protected Attributes

std::map< std::pair< ROEdge *, ROEdge * >, int > myConnectionOccurences
 Counts how many routes connecting the key-edges were already stored. More...
 
std::vector< RODFRouteDescmyRoutes
 Stored route descriptions. More...
 

Detailed Description

A container for DFROUTER-routes.

The route id is (re)set as soon as the route is added.

As sometimes several routes can be used between two edges and have to be identified, the number of routes connecting them is stored for each edge pair "myConnectionOccurences" and the route is named using this information,

See also
addRouteDesc.
RODFRouteDesc

Definition at line 63 of file RODFRouteCont.h.

Constructor & Destructor Documentation

◆ RODFRouteCont()

RODFRouteCont::RODFRouteCont ( )

Constructor.

Definition at line 46 of file RODFRouteCont.cpp.

◆ ~RODFRouteCont()

RODFRouteCont::~RODFRouteCont ( )

Destructor.

Definition at line 49 of file RODFRouteCont.cpp.

Member Function Documentation

◆ addRouteDesc()

void RODFRouteCont::addRouteDesc ( RODFRouteDesc desc)

Adds a route to the container.

If the same route is already known, its "overallProb" is increased by the value stored in the given route.

An id for the route is generated if it is unset, yet. The id is computed and set via "setID".

Parameters
[in]descThe route description to add
See also
setID

Definition at line 54 of file RODFRouteCont.cpp.

References myRoutes, RODFRouteDesc::overallProb, and setID().

Referenced by RODFDetector::addRoute(), and RODFNet::computeRoutesFor().

◆ get()

std::vector<RODFRouteDesc>& RODFRouteCont::get ( )
inline

◆ removeIllegal()

void RODFRouteCont::removeIllegal ( const std::vector< ROEdgeVector > &  illegals)

Removes "illegal" routes.

"illegal" routes means edge combinations that shall not be passed.

Parameters
[in]illegalsList of edge combinations that shall not be passed
Todo:
Not used, yet

Definition at line 111 of file RODFRouteCont.cpp.

References RODFRouteDesc::edges2Pass, and myRoutes.

Referenced by get().

◆ removeRouteDesc()

bool RODFRouteCont::removeRouteDesc ( RODFRouteDesc desc)

Removes the given route description from the container.

All routes are regarded as being same if they pass the same edges. This is done via the "route_finder".

Parameters
[in]descThe route description to remove
Returns
Whether the route was removed (a similar was found)
See also
RODFRouteCont::route_finder

Definition at line 68 of file RODFRouteCont.cpp.

References myRoutes.

Referenced by RODFNet::computeRoutesFor().

◆ save()

bool RODFRouteCont::save ( std::vector< std::string > &  saved,
const std::string &  prependix,
OutputDevice out 
)

Saves routes.

Parameters
[in,out]savedThe list of ids of routes that shall not be saved (were saved before)
[in]prependixThe prependix for route names
[out]outThe device the routes shall written to
Returns
Whether at least one route was saved
Exceptions
IOErrornot yet implemented

Definition at line 78 of file RODFRouteCont.cpp.

References OutputDevice::closeTag(), RODFRouteDesc::edges2Pass, myRoutes, OutputDevice::openTag(), RODFRouteDesc::routename, SUMO_ATTR_ID, SUMO_TAG_ROUTE, and OutputDevice::writeAttr().

Referenced by RODFDetector::writeRoutes().

◆ setID()

void RODFRouteCont::setID ( RODFRouteDesc desc) const
protected

Computes and sets the id of a route.

The id is <FIRST_EDGE>_to_<LAST_EDGE>_<RUNNING> where <RUNNING> is the number of routes which connect <FIRST_EDGE> and <LAST_EDGE>.

Parameters
[in]descThe route description to add

Definition at line 136 of file RODFRouteCont.cpp.

References RODFRouteDesc::edges2Pass, myConnectionOccurences, RODFRouteDesc::routename, and toString().

Referenced by addRouteDesc(), and get().

◆ sortByDistance()

void RODFRouteCont::sortByDistance ( )

Sorts routes by their distance (length)

Done using by_distance_sorter.

See also
RODFRouteCont::by_distance_sorter

Definition at line 105 of file RODFRouteCont.cpp.

References myRoutes.

Referenced by get().

Field Documentation

◆ myConnectionOccurences

std::map<std::pair<ROEdge*, ROEdge*>, int> RODFRouteCont::myConnectionOccurences
mutableprotected

Counts how many routes connecting the key-edges were already stored.

Definition at line 187 of file RODFRouteCont.h.

Referenced by setID().

◆ myRoutes

std::vector<RODFRouteDesc> RODFRouteCont::myRoutes
protected

Stored route descriptions.

Definition at line 184 of file RODFRouteCont.h.

Referenced by addRouteDesc(), get(), removeIllegal(), removeRouteDesc(), save(), and sortByDistance().


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