SUMO - Simulation of Urban MObility

MSLaneSpeedTrigger.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Changes the speed allowed on a set of lanes
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 MSLaneSpeedTrigger_h
00020 #define MSLaneSpeedTrigger_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 <vector>
00034 #include <utils/common/Command.h>
00035 #include <utils/common/UtilExceptions.h>
00036 #include <utils/xml/SUMOSAXHandler.h>
00037 #include "MSTrigger.h"
00038 
00039 
00040 // ===========================================================================
00041 // class declarations
00042 // ===========================================================================
00043 class MSLane;
00044 
00045 
00046 // ===========================================================================
00047 // class definitions
00048 // ===========================================================================
00057 class MSLaneSpeedTrigger : public MSTrigger, public SUMOSAXHandler, public Command {
00058 public:
00066     MSLaneSpeedTrigger(const std::string& id,
00067                        const std::vector<MSLane*> &destLanes,
00068                        const std::string& file);
00069 
00070 
00072     virtual ~MSLaneSpeedTrigger();
00073 
00074 
00082     SUMOTime execute(SUMOTime currentTime);
00083 
00084 
00085     SUMOTime processCommand(bool move2next, SUMOTime currentTime);
00086 
00087     SUMOReal getDefaultSpeed() const;
00088 
00089     void setOverriding(bool val);
00090 
00091     void setOverridingValue(SUMOReal val);
00092 
00093     SUMOReal getLoadedSpeed();
00094 
00096     SUMOReal getCurrentSpeed() const;
00097 
00098 protected:
00100 
00101 
00109     virtual void myStartElement(int element,
00110                                 const SUMOSAXAttributes& attrs);
00111 
00118     virtual void myEndElement(int element);
00120 
00121 
00122 protected:
00124     std::vector<MSLane*> myDestLanes;
00125 
00127     SUMOReal myCurrentSpeed;
00128 
00130     SUMOReal myDefaultSpeed;
00131 
00133     bool myAmOverriding;
00134 
00136     SUMOReal mySpeedOverrideValue;
00137 
00138     std::vector<std::pair<SUMOTime, SUMOReal> > myLoadedSpeeds;
00139     std::vector<std::pair<SUMOTime, SUMOReal> >::iterator myCurrentEntry;
00140 
00141 private:
00143     MSLaneSpeedTrigger(const MSLaneSpeedTrigger&);
00144 
00146     MSLaneSpeedTrigger& operator=(const MSLaneSpeedTrigger&);
00147 
00148     void init();
00149 
00150 
00151 private:
00153     bool myDidInit;
00154 
00155 };
00156 
00157 
00158 #endif
00159 
00160 /****************************************************************************/
00161 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines