|
SUMO - Simulation of Urban MObility
|
The router's network representation. More...
#include <RONet.h>
Public Member Functions | |
| void | closeOutput () throw () |
| closes the file output for computed routes | |
| const std::map< std::string, ROEdge * > & | getEdgeMap () const |
| unsigned int | getEdgeNo () const |
| Returns the number of edges thenetwork contains. | |
| const ROEdge * | getRandomDestination () const throw () |
| Returns a random edge which may be used as an ending point. | |
| ROEdge * | getRandomDestination () throw () |
| Returns a random edge which may be used as an ending point. | |
| ROEdge * | getRandomSource () throw () |
| Returns a random edge which may be used as a starting point. | |
| const ROEdge * | getRandomSource () const throw () |
| Returns a random edge which may be used as a starting point. | |
| bool | hasRestrictions () const |
| void | openOutput (const std::string &filename, bool useAlternatives) throw (IOError) |
| Opens the output for computed routes. | |
| RONet () throw () | |
| Constructor. | |
| void | setRestrictionFound () |
| virtual | ~RONet () throw () |
| Destructor. | |
Insertion and retrieval of graph parts | |
| virtual bool | addEdge (ROEdge *edge) throw () |
| ROEdge * | getEdge (const std::string &name) const throw () |
| Retrieves an edge from the network. | |
| void | addNode (RONode *node) throw () |
| RONode * | getNode (const std::string &id) const throw () |
| Retrieves an node from the network. | |
Insertion and retrieval of vehicle types, vehicles, routes, and route definitions | |
| virtual bool | addVehicleType (SUMOVTypeParameter *type) throw () |
| SUMOVTypeParameter * | getVehicleTypeSecure (const std::string &id) throw () |
| Retrieves the named vehicle type. | |
| bool | addRouteDef (RORouteDef *def) throw () |
| RORouteDef * | getRouteDef (const std::string &name) const throw () |
| Returns the named route definition. | |
| virtual bool | addVehicle (const std::string &id, ROVehicle *veh) throw () |
Processing stored vehicle definitions | |
| SUMOTime | saveAndRemoveRoutesUntil (OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime time) |
| Computes routes described by their definitions and saves them. | |
| virtual bool | furtherStored () |
| Returns the information whether further vehicles are stored. | |
Protected Member Functions | |
| void | checkSourceAndDestinations () const |
| Initialises the lists of source and destination edges. | |
| bool | computeRoute (OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const veh) |
Protected Attributes | |
| std::vector< ROEdge * > | myDestinationEdges |
| List of destination edges. | |
| unsigned int | myDiscardedRouteNo |
| The number of discarded routes. | |
| NamedObjectCont< ROEdge * > | myEdges |
| Known edges. | |
| bool | myHaveRestrictions |
| Whether the network contains edges which not all vehicles may pass. | |
| NamedObjectCont< RONode * > | myNodes |
| Known nodes. | |
| unsigned int | myReadRouteNo |
| The number of read routes. | |
| OutputDevice * | myRouteAlternativesOutput |
| The file to write the computed route alternatives into. | |
| NamedObjectCont< RORouteDef * > | myRoutes |
| Known routes. | |
| OutputDevice * | myRoutesOutput |
| The file to write the computed routes into. | |
| std::vector< ROEdge * > | mySourceEdges |
| List of source edges. | |
| ROVehicleCont | myVehicles |
| Known vehicles. | |
| NamedObjectCont < SUMOVTypeParameter * > | myVehicleTypes |
| Known vehicle types. | |
| std::set< std::string > | myVehIDs |
| Known vehicle ids. | |
| unsigned int | myWrittenRouteNo |
| The number of written routes. | |
Private Member Functions | |
| RONet & | operator= (const RONet &src) |
| Invalidated assignment operator. | |
| RONet (const RONet &src) | |
| Invalidated copy constructor. | |
The router's network representation.
A router network is responsible for watching loaded edges, nodes,!!!
| RONet::~RONet | ( | ) | throw () [virtual] |
Destructor.
Definition at line 66 of file RONet.cpp.
References ROVehicleCont::clear(), NamedObjectCont< T >::clear(), myEdges, myNodes, myRoutes, myVehicles, and myVehicleTypes.
| RONet::RONet | ( | const RONet & | src | ) | [private] |
Invalidated copy constructor.
Definition at line 76 of file RONet.cpp.
References WRITE_ERROR.
Referenced by RONetHandler::parseEdge().
| void RONet::addNode | ( | RONode * | node | ) | throw () |
Definition at line 87 of file RONet.cpp.
References WRITE_ERROR.
Referenced by RONetHandler::parseEdge(), and RONetHandler::parseJunction().
| bool RONet::addRouteDef | ( | RORouteDef * | def | ) | throw () |
Definition at line 96 of file RONet.cpp.
Referenced by RORDGenerator_ODAmounts::FlowDef::addSingleRoute(), and RORDGenerator_ODAmounts::myEndFlowAmountDef().
Definition at line 165 of file RONet.cpp.
References WRITE_ERROR.
Referenced by RORDGenerator_ODAmounts::FlowDef::addSingleRoute(), and RORDLoader_SUMOBase::closeVehicle().
| bool RONet::addVehicleType | ( | SUMOVTypeParameter * | type | ) | throw () [virtual] |
Definition at line 154 of file RONet.cpp.
References WRITE_ERROR.
| void RONet::checkSourceAndDestinations | ( | ) | const [protected] |
Initialises the lists of source and destination edges.
Definition at line 317 of file RONet.cpp.
References ROEdge::ET_SINK, ROEdge::ET_SOURCE, NamedObjectCont< T >::getMyMap(), ROEdge::getType(), myDestinationEdges, myEdges, and mySourceEdges.
Referenced by getRandomDestination(), and getRandomSource().
| void RONet::closeOutput | ( | ) | throw () |
closes the file output for computed routes
Definition at line 118 of file RONet.cpp.
References OutputDevice::close(), myRouteAlternativesOutput, and myRoutesOutput.
Referenced by computeRoutes().
| bool RONet::computeRoute | ( | OptionsCont & | options, |
| SUMOAbstractRouter< ROEdge, ROVehicle > & | router, | ||
| const ROVehicle *const | veh | ||
| ) | [protected] |
Definition at line 177 of file RONet.cpp.
References RORouteDef::addAlternative(), RORouteDef::buildCurrentRoute(), OptionsCont::getBool(), ROVehicle::getDepartureTime(), MsgHandler::getErrorInstance(), ROVehicle::getID(), ROVehicle::getRouteDefinition(), MsgHandler::getWarningInstance(), MsgHandler::inform(), ReferencedItem::isSaved(), RORoute::recheckForLoops(), and RORoute::size().
Referenced by saveAndRemoveRoutesUntil().
| bool RONet::furtherStored | ( | ) | [virtual] |
Returns the information whether further vehicles are stored.
Definition at line 262 of file RONet.cpp.
References myVehicles, and NamedObjectCont< T >::size().
Referenced by ROLoader::processRoutesStepWise().
| ROEdge* RONet::getEdge | ( | const std::string & | name | ) | const throw () [inline] |
Retrieves an edge from the network.
This is not very pretty, but necessary, though, as routes run over instances, not over ids.
| [in] | name | The name of the edge to retrieve |
Definition at line 100 of file RONet.h.
References NamedObjectCont< T >::get(), and myEdges.
Referenced by RODFNet::getDetectorEdge(), RORDLoader_TripDefs::getEdge(), loadJTRDefinitions(), RONetHandler::parseConnectedEdge(), RONetHandler::parseConnection(), RONetHandler::parseDistrictEdge(), AGActivityGenHandler::parseStreets(), RODFDetectorCon::writeEmitters(), and RODFDetectorCon::writeSpeedTrigger().
| const std::map< std::string, ROEdge * > & RONet::getEdgeMap | ( | ) | const |
Definition at line 343 of file RONet.cpp.
References NamedObjectCont< T >::getMyMap(), and myEdges.
Referenced by RODFNet::buildApproachList(), AGCity::completeStreets(), initNet(), and ROLoader::loadWeights().
| unsigned int RONet::getEdgeNo | ( | ) | const |
Returns the number of edges thenetwork contains.
Definition at line 337 of file RONet.cpp.
References myEdges, and NamedObjectCont< T >::size().
Referenced by computeRoutes(), and main().
| RONode* RONet::getNode | ( | const std::string & | id | ) | const throw () [inline] |
Retrieves an node from the network.
| [in] | name | The name of the node to retrieve |
Definition at line 122 of file RONet.h.
References NamedObjectCont< T >::get(), and myNodes.
Referenced by RONetHandler::parseEdge(), and RONetHandler::parseJunction().
| ROEdge * RONet::getRandomDestination | ( | ) | throw () |
Returns a random edge which may be used as an ending point.
If the list of possible destinations (roads with no successor, "myDestinationEdges") is empty, it is tried to be built, first.
Definition at line 293 of file RONet.cpp.
References checkSourceAndDestinations(), RandHelper::getRandomFrom(), and myDestinationEdges.
| const ROEdge * RONet::getRandomDestination | ( | ) | const throw () |
Returns a random edge which may be used as an ending point.
If the list of possible destinations (roads with no successor, "myDestinationEdges") is empty, it is tried to be built, first.
Definition at line 305 of file RONet.cpp.
References checkSourceAndDestinations(), RandHelper::getRandomFrom(), and myDestinationEdges.
| const ROEdge * RONet::getRandomSource | ( | ) | const throw () |
Returns a random edge which may be used as a starting point.
If the list of possible sources (roads with no predecessor, "mySourceEdges") is empty, it is tried to be built, first.
Definition at line 280 of file RONet.cpp.
References checkSourceAndDestinations(), RandHelper::getRandomFrom(), and mySourceEdges.
| ROEdge * RONet::getRandomSource | ( | ) | throw () |
Returns a random edge which may be used as a starting point.
If the list of possible source (roads with no predecessor, "mySourceEdges") is empty, it is tried to be built, first.
Definition at line 268 of file RONet.cpp.
References checkSourceAndDestinations(), RandHelper::getRandomFrom(), and mySourceEdges.
| RORouteDef* RONet::getRouteDef | ( | const std::string & | name | ) | const throw () [inline] |
Returns the named route definition.
| [in] | name | The name of the route definition to retrieve |
Check whether a const pointer may be returned
Rename myRoutes to myRouteDefinitions
Definition at line 179 of file RONet.h.
References NamedObjectCont< T >::get(), and myRoutes.
Referenced by RORDLoader_SUMOBase::closeVehicle().
| SUMOVTypeParameter * RONet::getVehicleTypeSecure | ( | const std::string & | id | ) | throw () |
Retrieves the named vehicle type.
If the named vehicle type was not added to the net before, a default vehicle type which consists of the id only is generated, added to the net and returned.
Only if the name is "", 0 is returned.
| [in] | id | The id of the vehicle type to return |
Definition at line 132 of file RONet.cpp.
References SUMOVTypeParameter::id, and SUMOVTypeParameter::onlyReferenced.
Referenced by RORDLoader_SUMOBase::closeVehicle(), and RORDGenerator_ODAmounts::myEndFlowAmountDef().
| bool RONet::hasRestrictions | ( | ) | const |
Definition at line 349 of file RONet.cpp.
References myHaveRestrictions.
Referenced by computeRoutes().
Opens the output for computed routes.
If the second parameter is true, a second file for route alternatives will be opened. The route alternatives files is simply the given name with ".alt" appended (before the ".xml"-suffix). If one of the file outputs can not be build, an IOError is thrown
| [in] | filename | The (base) name of the file(s) to create |
| [in] | useAlternatives | Whether a file for writing alternatives shall be created |
Definition at line 102 of file RONet.cpp.
References OutputDevice::getDevice().
Referenced by computeRoutes().
| SUMOTime RONet::saveAndRemoveRoutesUntil | ( | OptionsCont & | options, |
| SUMOAbstractRouter< ROEdge, ROVehicle > & | router, | ||
| SUMOTime | time | ||
| ) |
Computes routes described by their definitions and saves them.
As long a vehicle with a departure time not larger than the given exists, its route is computed and it is written and removed from the internal container.
| [in] | options | The options used during this process |
| [in] | router | The router to use for routes computation |
| [in] | options | The time until which route definitions shall be processed |
Definition at line 218 of file RONet.cpp.
References computeRoute(), ROVehicleCont::erase(), OptionsCont::getBool(), ROVehicle::getDepartureTime(), ROVehicle::getID(), OptionsCont::getInt(), ROVehicleCont::getTopVehicle(), myDiscardedRouteNo, myReadRouteNo, myRouteAlternativesOutput, myRoutesOutput, myVehicles, myWrittenRouteNo, ROVehicle::saveAllAsXML(), NamedObjectCont< T >::size(), toString(), and WRITE_MESSAGE.
Referenced by ROLoader::makeSingleStep(), and ROLoader::processAllRoutes().
| void RONet::setRestrictionFound | ( | ) |
Definition at line 355 of file RONet.cpp.
References myHaveRestrictions.
Referenced by RONetHandler::parseLane().
std::vector<ROEdge*> RONet::myDestinationEdges [mutable, protected] |
List of destination edges.
Definition at line 321 of file RONet.h.
Referenced by checkSourceAndDestinations(), and getRandomDestination().
unsigned int RONet::myDiscardedRouteNo [protected] |
The number of discarded routes.
Definition at line 333 of file RONet.h.
Referenced by saveAndRemoveRoutesUntil().
NamedObjectCont<ROEdge*> RONet::myEdges [protected] |
Known edges.
Definition at line 306 of file RONet.h.
Referenced by checkSourceAndDestinations(), getEdge(), getEdgeMap(), getEdgeNo(), and ~RONet().
bool RONet::myHaveRestrictions [protected] |
Whether the network contains edges which not all vehicles may pass.
Definition at line 339 of file RONet.h.
Referenced by hasRestrictions(), and setRestrictionFound().
NamedObjectCont<RONode*> RONet::myNodes [protected] |
unsigned int RONet::myReadRouteNo [protected] |
The number of read routes.
Definition at line 330 of file RONet.h.
Referenced by saveAndRemoveRoutesUntil().
OutputDevice* RONet::myRouteAlternativesOutput [protected] |
The file to write the computed route alternatives into.
Definition at line 327 of file RONet.h.
Referenced by closeOutput(), and saveAndRemoveRoutesUntil().
NamedObjectCont<RORouteDef*> RONet::myRoutes [protected] |
OutputDevice* RONet::myRoutesOutput [protected] |
The file to write the computed routes into.
Definition at line 324 of file RONet.h.
Referenced by closeOutput(), and saveAndRemoveRoutesUntil().
std::vector<ROEdge*> RONet::mySourceEdges [mutable, protected] |
List of source edges.
Definition at line 318 of file RONet.h.
Referenced by checkSourceAndDestinations(), and getRandomSource().
ROVehicleCont RONet::myVehicles [protected] |
Known vehicles.
Definition at line 315 of file RONet.h.
Referenced by furtherStored(), saveAndRemoveRoutesUntil(), and ~RONet().
NamedObjectCont<SUMOVTypeParameter*> RONet::myVehicleTypes [protected] |
std::set<std::string> RONet::myVehIDs [protected] |
unsigned int RONet::myWrittenRouteNo [protected] |
The number of written routes.
Definition at line 336 of file RONet.h.
Referenced by saveAndRemoveRoutesUntil().