SUMO - Simulation of Urban MObility
Command_SaveTLCoupledDet.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Writes e2 state on each tls switch
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
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 "Command_SaveTLCoupledDet.h"
00033 #include <microsim/MSNet.h>
00034 #include <microsim/traffic_lights/MSTrafficLightLogic.h>
00035 #include <microsim/MSEventControl.h>
00036 #include <microsim/output/MSDetectorFileOutput.h>
00037 #include <utils/common/UtilExceptions.h>
00038 #include <utils/common/MsgHandler.h>
00039 #include <utils/iodevices/OutputDevice.h>
00040 
00041 #ifdef CHECK_MEMORY_LEAKS
00042 #include <foreign/nvwa/debug_new.h>
00043 #endif // CHECK_MEMORY_LEAKS
00044 
00045 
00046 // ===========================================================================
00047 // method definitions
00048 // ===========================================================================
00049 Command_SaveTLCoupledDet::Command_SaveTLCoupledDet(MSTLLogicControl::TLSLogicVariants& tlls,
00050         MSDetectorFileOutput* dtf, unsigned int begin, OutputDevice& device)
00051     : myDevice(device), myLogics(tlls), myDetector(dtf),
00052       myStartTime(begin) {
00053     tlls.addSwitchCommand(this);
00054     dtf->writeXMLDetectorProlog(device);
00055 }
00056 
00057 
00058 Command_SaveTLCoupledDet::~Command_SaveTLCoupledDet() {
00059 }
00060 
00061 
00062 void
00063 Command_SaveTLCoupledDet::execute() {
00064     SUMOTime end = MSNet::getInstance()->getCurrentTimeStep();
00065     if (myStartTime != end) {
00066         myDetector->writeXMLOutput(myDevice, myStartTime, end);
00067         myStartTime = end;
00068     }
00069 }
00070 
00071 
00072 
00073 /****************************************************************************/
00074 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines