SUMO - Simulation of Urban MObility

ROEdge.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A basic edge for routing applications
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef ROEdge_h
00020 #define ROEdge_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <map>
00034 #include <vector>
00035 #include <algorithm>
00036 #include <utils/common/ValueTimeLine.h>
00037 #include <utils/common/SUMOVehicleClass.h>
00038 #include "RONode.h"
00039 
00040 
00041 // ===========================================================================
00042 // class declarations
00043 // ===========================================================================
00044 class ROLane;
00045 class ROVehicle;
00046 
00047 
00048 // ===========================================================================
00049 // class definitions
00050 // ===========================================================================
00060 class ROEdge {
00061 public:
00066     enum EdgeType {
00068         ET_NORMAL,
00070         ET_DISTRICT,
00072         ET_SOURCE,
00074         ET_SINK
00075     };
00076 
00077 
00088     ROEdge(const std::string& id, RONode* from, RONode* to, unsigned int index,
00089            bool useBoundariesOnOverride, bool interpolate=false) throw();
00090 
00091 
00093     virtual ~ROEdge() throw();
00094 
00095 
00097 
00098 
00107     virtual void addLane(ROLane* lane) throw();
00108 
00109 
00117     virtual void addFollower(ROEdge* s) throw();
00118 
00119 
00123     void setType(EdgeType type) throw();
00124 
00125 
00135     void buildTimeLines(const std::string& measure) throw();
00137 
00138 
00139 
00141 
00142 
00146     const std::string& getID() const throw() {
00147         return myID;
00148     }
00149 
00150 
00155     EdgeType getType() const throw() {
00156         return myType;
00157     }
00158 
00159 
00163     SUMOReal getLength() const throw() {
00164         return myLength;
00165     }
00166 
00170     unsigned int getNumericalID() const throw() {
00171         return myIndex;
00172     }
00173 
00174 
00178     SUMOReal getSpeed() const throw() {
00179         return mySpeed;
00180     }
00181 
00182 
00186     unsigned int getLaneNo() const throw() {
00187         return (unsigned int) myLanes.size();
00188     }
00189 
00190 
00194     RONode* getFromNode() const throw() {
00195         return myFromNode;
00196     }
00197 
00198 
00202     RONode* getToNode() const throw() {
00203         return myToNode;
00204     }
00205 
00206 
00212     bool isConnectedTo(const ROEdge* const e) const throw() {
00213         return std::find(myFollowingEdges.begin(), myFollowingEdges.end(), e)!=myFollowingEdges.end();
00214     }
00215 
00216 
00221     bool prohibits(const ROVehicle* const vehicle) const throw();
00222 
00223 
00228     bool allFollowersProhibit(const ROVehicle* const vehicle) const throw();
00230 
00231 
00232 
00234 
00235 
00242     void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd) throw();
00243 
00244 
00251     void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd) throw();
00252 
00253 
00261     unsigned int getNoFollowing() const throw();
00262 
00263 
00268     ROEdge* getFollower(unsigned int pos) const throw() {
00269         return myFollowingEdges[pos];
00270     }
00271 
00272 
00280     SUMOReal getEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00281 
00282 
00290     SUMOReal getTravelTime(const ROVehicle* const veh, SUMOReal time) const throw();
00291 
00292 
00293     SUMOReal getCOEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00294     SUMOReal getCO2Effort(const ROVehicle* const veh, SUMOReal time) const throw();
00295     SUMOReal getPMxEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00296     SUMOReal getHCEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00297     SUMOReal getNOxEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00298     SUMOReal getFuelEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00299     SUMOReal getNoiseEffort(const ROVehicle* const veh, SUMOReal time) const throw();
00301 
00303     static ROEdge* dictionary(size_t index) throw();
00304 
00305 
00306 protected:
00313     bool getStoredEffort(SUMOReal time, SUMOReal& ret) const throw();
00314 
00315 
00316 
00317 protected:
00319     std::string myID;
00320 
00322     SUMOReal mySpeed;
00323 
00325     unsigned int myIndex;
00326 
00328     SUMOReal myLength;
00329 
00330 
00332     mutable ValueTimeLine<SUMOReal> myTravelTimes;
00334     bool myUsingTTTimeLine;
00336     bool myUseBoundariesOnOverrideTT;
00338     static bool myHaveTTWarned;
00339 
00341     mutable ValueTimeLine<SUMOReal> myEfforts;
00343     bool myUsingETimeLine;
00345     bool myUseBoundariesOnOverrideE;
00347     static bool myHaveEWarned;
00348 
00350     bool myInterpolate;
00351 
00352 
00354     std::vector<ROEdge*> myFollowingEdges;
00355 
00357     EdgeType myType;
00358 
00360     std::vector<ROLane*> myLanes;
00361 
00363     SUMOVehicleClasses myAllowedClasses;
00364 
00366     SUMOVehicleClasses myNotAllowedClasses;
00367 
00369     RONode* myFromNode, *myToNode;
00370 
00371     static std::vector<ROEdge*> myEdges;
00372 
00373 private:
00375     ROEdge(const ROEdge& src);
00376 
00378     ROEdge& operator=(const ROEdge& src);
00379 
00380 };
00381 
00382 
00383 #endif
00384 
00385 /****************************************************************************/
00386 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines