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 2001-2010 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 {
00058 public:
00066     MSLaneSpeedTrigger(const std::string &id,
00067                        const std::vector<MSLane*> &destLanes,
00068                        const std::string &file) throw(ProcessError);
00069 
00071     virtual ~MSLaneSpeedTrigger() throw();
00072 
00073     SUMOTime execute(SUMOTime currentTime) throw(ProcessError);
00074 
00075     SUMOTime processCommand(bool move2next, SUMOTime currentTime);
00076 
00077     SUMOReal getDefaultSpeed() const;
00078 
00079     void setOverriding(bool val);
00080 
00081     void setOverridingValue(SUMOReal val);
00082 
00083     SUMOReal getLoadedSpeed();
00084 
00086     SUMOReal getCurrentSpeed() const;
00087 
00088 protected:
00090 
00091 
00099     virtual void myStartElement(SumoXMLTag element,
00100                                 const SUMOSAXAttributes &attrs) throw(ProcessError);
00101 
00108     virtual void myEndElement(SumoXMLTag element) throw(ProcessError);
00110 
00111 
00112 protected:
00114     std::vector<MSLane*> myDestLanes;
00115 
00117     SUMOReal myCurrentSpeed;
00118 
00120     SUMOReal myDefaultSpeed;
00121 
00123     bool myAmOverriding;
00124 
00126     SUMOReal mySpeedOverrideValue;
00127 
00128     std::vector<std::pair<SUMOTime, SUMOReal> > myLoadedSpeeds;
00129     std::vector<std::pair<SUMOTime, SUMOReal> >::iterator myCurrentEntry;
00130 
00131 private:
00133     MSLaneSpeedTrigger(const MSLaneSpeedTrigger&);
00134 
00136     MSLaneSpeedTrigger& operator=(const MSLaneSpeedTrigger&);
00137 
00138     void init() throw(ProcessError);
00139 
00140 
00141 private:
00143     bool myDidInit;
00144 
00145 };
00146 
00147 
00148 #endif
00149 
00150 /****************************************************************************/
00151 

Generated on Wed May 5 00:06:31 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6