SUMO - Simulation of Urban MObility

NIVisumTL.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Intermediate class for storing visum traffic lights during their import
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This file is part of SUMO.
00014 //   SUMO is free software: you can redistribute it and/or modify
00015 //   it under the terms of the GNU General Public License as published by
00016 //   the Free Software Foundation, either version 3 of the License, or
00017 //   (at your option) any later version.
00018 //
00019 /****************************************************************************/
00020 #ifndef NIVisumTL_h
00021 #define NIVisumTL_h
00022 
00023 
00024 // ===========================================================================
00025 // included modules
00026 // ===========================================================================
00027 #ifdef _MSC_VER
00028 #include <windows_config.h>
00029 #else
00030 #include <config.h>
00031 #endif
00032 
00033 #include <vector>
00034 #include <map>
00035 #include <string>
00036 #include <netbuild/NBConnectionDefs.h>
00037 #include <netbuild/NBNodeCont.h>
00038 #include <utils/common/SUMOTime.h>
00039 
00040 class NBTrafficLightLogicCont;
00041 
00042 
00043 // ===========================================================================
00044 // class declaration
00045 // ===========================================================================
00050 class NIVisumTL {
00051 public:
00053     class TimePeriod {
00054     public:
00055         // constructor
00056         TimePeriod();
00057         TimePeriod(SUMOTime StartTime, SUMOTime EndTime);
00058         // destructor
00059         ~TimePeriod();
00060         void SetStartTime(SUMOTime StartTime);
00061         void SetEndTime(SUMOTime EndTime);
00062         SUMOTime GetStartTime();
00063         SUMOTime GetEndTime();
00064     private:
00065         SUMOTime myStartTime;
00066         SUMOTime myEndTime;
00067     };
00068 
00069     // phase
00070     class Phase : public TimePeriod {
00071     public:
00072         Phase();
00073         Phase(SUMOTime StartTime, SUMOTime EndTime);
00074         ~Phase();
00075     };
00076 
00077     // Vectors
00078     typedef std::vector<NBNode*> NodeVector;
00079     typedef std::map<std::string, Phase*> PhaseMap;
00080 
00081     // SignalGroup
00082     // a Signal Group can be defined either by a time period or by phases
00083     class SignalGroup : public TimePeriod {
00084     public:
00085         // constructor
00086         SignalGroup(const std::string& Name, SUMOTime StartTime, SUMOTime EndTime);
00087         // destructor
00088         ~SignalGroup();
00089     private:
00090         NBConnectionVector myConnections;
00091         PhaseMap myPhases;
00092         std::string myName;
00093     public:
00094         NBConnectionVector* GetConnections();
00095         PhaseMap* GetPhases();
00096         std::string GetName();
00097     };
00098 
00099     // SignalGroupVector
00100     typedef std::map<std::string, SignalGroup*> SignalGroupMap;
00101 public:
00102     // constructor
00103     NIVisumTL();
00104     NIVisumTL(const std::string& Name, SUMOTime CycleTime, SUMOTime IntermediateTime,
00105               bool PhaseDefined);
00106     // destructor
00107     ~NIVisumTL();
00108     // nodes and phases
00109     NodeVector* GetNodes();
00110     PhaseMap* GetPhases();
00111     SignalGroupMap* GetSignalGroups();
00112     // set
00113     void SetPhaseDefined(bool PhaseDefined);
00114     void SetCycleTime(SUMOTime CylcleTime);
00115     void SetIntermediateTime(SUMOTime IntermediateTime);
00116     // get
00117     bool GetPhaseDefined();
00118     SUMOTime GetCycleTime();
00119     SUMOTime GetIntermediateTime();
00120     SUMOTime GetName();
00121     SignalGroup* GetSignalGroup(const std::string Name);
00122     // add
00123     void AddSignalGroup(const std::string Name, SUMOTime StartTime, SUMOTime EndTime);
00124     void AddPhase(const std::string Name, SUMOTime StartTime, SUMOTime EndTime);
00125     // build the trafficlight
00126     void build(NBTrafficLightLogicCont& tlc);
00127 private:
00128     // name of traffic light
00129     std::string myName;
00130 
00131     // cycle time of traffic light in seconds
00132     SUMOTime myCycleTime;
00133 
00134     // length of yellow and red-yellow phases
00135     SUMOTime myIntermediateTime;
00136 
00137     // toogles the usage either of phases or of timeperiods in signalgroups
00138     bool myPhaseDefined;
00139 
00140     // vector of nodes belonging to this traffic light
00141     NodeVector myNodes;
00142 
00143     // vector of used phases if phasedefined
00144     PhaseMap myPhases;
00145 
00146     // vector of used Signalgroups
00147     SignalGroupMap mySignalGroups;
00148 
00149 };
00150 
00151 
00152 #endif
00153 
00154 /****************************************************************************/
00155 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines