Eclipse SUMO - Simulation of Urban MObility
AGStreet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2010-2019 German Aerospace Center (DLR) and others.
4 // activitygen module
5 // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 // SPDX-License-Identifier: EPL-2.0
11 /****************************************************************************/
19 // Represents a SUMO edge and contains people and work densities
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include "AGStreet.h"
29 #include "router/ROEdge.h"
30 #include <iostream>
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
36 AGStreet::AGStreet(const std::string& id, RONode* from, RONode* to, int index, const int priority) :
37  ROEdge(id, from, to, index, priority), myPopulation(0.), myNumWorkplaces(0.) {
38 }
39 
40 
41 void
42 AGStreet::print() const {
43  std::cout << "- AGStreet: Name=" << getID() << " Length=" << getLength() << " pop=" << myPopulation << " work=" << myNumWorkplaces << std::endl;
44 }
45 
46 
47 double
49  return myPopulation;
50 }
51 
52 
53 void
54 AGStreet::setPopulation(const double population) {
55  myPopulation = population;
56 }
57 
58 
59 double
61  return myNumWorkplaces;
62 }
63 
64 
65 void
66 AGStreet::setWorkplaceNumber(const double workPositions) {
67  myNumWorkplaces = workPositions;
68 }
69 
70 
71 bool
72 AGStreet::allows(const SUMOVehicleClass vclass) const {
73  return (getPermissions() & vclass) == vclass;
74 }
75 
76 
77 /****************************************************************************/
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
AGStreet::AGStreet
AGStreet(const std::string &id, RONode *from, RONode *to, int index, const int priority)
Definition: AGStreet.cpp:36
AGStreet.h
AGStreet::setWorkplaceNumber
void setWorkplaceNumber(const double work)
Modifies the number of work places in this street.
Definition: AGStreet.cpp:66
AGStreet::myPopulation
double myPopulation
Definition: AGStreet.h:108
AGStreet::getWorkplaceNumber
double getWorkplaceNumber() const
Provides the number of work places in this street.
Definition: AGStreet.cpp:60
AGStreet::allows
bool allows(const SUMOVehicleClass vclass) const
Returns whether the given vehicle class is allowed on this street.
Definition: AGStreet.cpp:72
AGStreet::setPopulation
void setPopulation(const double pop)
Modifies the number of persons living in this street.
Definition: AGStreet.cpp:54
AGStreet::getPopulation
double getPopulation() const
Provides the number of persons living in this street.
Definition: AGStreet.cpp:48
AGStreet::print
void print() const
Prints a summary of the properties of this street to standard output.
Definition: AGStreet.cpp:42
ROEdge::getLength
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:204
ROEdge::getPermissions
SVCPermissions getPermissions() const
Definition: ROEdge.h:268
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
config.h
AGStreet::myNumWorkplaces
double myNumWorkplaces
Definition: AGStreet.h:109
RONode
Base class for nodes used by the router.
Definition: RONode.h:45
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
ROEdge.h