SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Command_SaveTLSSwitchStates.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // Writes the switch times of a tls into a file when the tls switches
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
33 #include <microsim/MSNet.h>
37 
38 #ifdef CHECK_MEMORY_LEAKS
39 #include <foreign/nvwa/debug_new.h>
40 #endif // CHECK_MEMORY_LEAKS
41 
42 
43 // ===========================================================================
44 // method definitions
45 // ===========================================================================
47  OutputDevice& od)
48  : myOutputDevice(od), myLogics(logics) {
50  myOutputDevice.writeXMLHeader("tls-switch-states");
51 }
52 
53 
55 }
56 
57 
60  const std::string& state = myLogics.getActive()->getCurrentPhaseDef().getState();
62  myOutputDevice << " <tlsstate time=\"" << time2string(currentTime)
63  << "\" id=\"" << myLogics.getActive()->getID()
64  << "\" programID=\"" << myLogics.getActive()->getProgramID()
65  << "\" phase=\"" << myLogics.getActive()->getCurrentPhaseIndex()
66  << "\" state=\"" << state << "\"/>\n";
67  myPreviousState = state;
69  }
70  return DELTA_T;
71 }
72 
73 
74 
75 /****************************************************************************/
76