SUMO - Simulation of Urban MObility
ROMARouteHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Parser and container for routes during their loading
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
30 #include <od/ODMatrix.h>
31 #include "ROMARouteHandler.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38  SUMOSAXHandler(""),
39  myMatrix(matrix) {
40  if (OptionsCont::getOptions().isSet("taz-param")) {
42  }
43 }
44 
45 
47 }
48 
49 
50 void
52  const SUMOSAXAttributes& attrs) {
53  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
55  } else if (element == SUMO_TAG_PARAM && !myTazParamKeys.empty()) {
56  if (attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[0]) {
58  }
59  if (myTazParamKeys.size() > 1 && attrs.getString(SUMO_ATTR_KEY) == myTazParamKeys[1]) {
61  }
62  }
63 }
64 
65 
66 void
68  if (element == SUMO_TAG_TRIP || element == SUMO_TAG_VEHICLE) {
69  std::pair<const std::string, const std::string> od = std::make_pair(myVehicleParameter->fromTaz, myVehicleParameter->toTaz);
71  delete myVehicleParameter;
72  }
73 }
74 
75 
76 /****************************************************************************/
ODMatrix & myMatrix
The matrix to fill.
ROMARouteHandler(ODMatrix &matrix)
standard constructor
std::string vtypeid
The vehicle&#39;s type id.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle&#39;s attributes.
virtual ~ROMARouteHandler()
standard destructor
SAX-handler base for SUMO-files.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
std::string toTaz
The vehicle&#39;s destination zone (district)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::vector< std::string > myTazParamKeys
The keys for reading taz.
Encapsulated SAX-Attributes.
parameter associated to a certain key
An O/D (origin/destination) matrix.
Definition: ODMatrix.h:69
SUMOTime depart
The vehicle&#39;s departure time.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
std::string fromTaz
The vehicle&#39;s origin zone (district)
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
bool add(double vehicleNumber, SUMOTime begin, SUMOTime end, const std::string &origin, const std::string &destination, const std::string &vehicleType)
Builds a single cell from the given values, verifying them.
Definition: ODMatrix.cpp:64
description of a vehicle
SUMOVehicleParameter * myVehicleParameter
The current vehicle parameters.
a single trip definition (used by router)
std::string id
The vehicle&#39;s id.