SUMO - Simulation of Urban MObility
GNEDestProbReroute.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <utils/common/ToString.h>
31 
32 #include "GNEDestProbReroute.h"
33 #include "GNEEdge.h"
34 
35 #ifdef CHECK_MEMORY_LEAKS
36 #include <foreign/nvwa/debug_new.h>
37 #endif
38 
39 // ===========================================================================
40 // member method definitions
41 // ===========================================================================
42 
43 GNEDestProbReroute::GNEDestProbReroute(GNERerouterInterval& rerouterIntervalParent, GNEEdge* newEdgeDestination, SUMOReal probability):
44  myRerouterIntervalParent(&rerouterIntervalParent),
45  myNewEdgeDestination(newEdgeDestination),
46  myProbability(0),
48  // set probability manually to avoid non valid values
49  setProbability(probability);
50 }
51 
52 
54 }
55 
56 
57 GNEEdge*
59  return myNewEdgeDestination;
60 }
61 
62 
63 void
65  myNewEdgeDestination = edge;
66 }
67 
68 
71  return myProbability;
72 }
73 
74 
75 bool
77  if (probability >= 0 && probability <= 1) {
78  myProbability = probability;
79  return true;
80  } else {
81  return false;
82  }
83 }
84 
85 
88  return myTag;
89 }
90 
91 
95 }
96 
97 
98 bool
100  if ((myRerouterIntervalParent == destProbReroute.myRerouterIntervalParent) &&
101  (myNewEdgeDestination == destProbReroute.myNewEdgeDestination) &&
102  (myProbability == destProbReroute.myProbability)) {
103  return true;
104  } else {
105  return false;
106  }
107 }
108 
109 
110 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLTag myTag
XML Tag of destiny probability reroute.
GNEEdge * myNewEdgeDestination
id of new edge destination
SUMOReal myProbability
probability with which a vehicle will use the given edge as destination
GNERerouterInterval * myRerouterIntervalParent
reference to rerouter interval parent
bool operator==(const GNEDestProbReroute &destProbReroute)
overload operator ==
void setNewDestination(GNEEdge *edge)
set edge destination
SumoXMLTag getTag() const
get tag
GNEEdge * getNewDestination() const
get edge destination
probability of destiny of a reroute
~GNEDestProbReroute()
destructor
bool setProbability(SUMOReal probability)
set probability, if new probability is valid
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
SUMOReal getProbability() const
get probability
#define SUMOReal
Definition: config.h:208
const GNERerouterInterval & getRerouterIntervalParent() const
get rerouter interval parent
GNEDestProbReroute(GNERerouterInterval &rerouterIntervalParent, GNEEdge *newEdgeDestination, SUMOReal probability)
constructor