1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    MSXMLRawOut.h
11 /// @author  Daniel Krajzewicz
12 /// @author  Jakob Erdmann
13 /// @author  Sascha Krieg
14 /// @author  Bjoern Hendriks
15 /// @author  Michael Behrisch
16 /// @date    Mon, 10.05.2004
17 /// @version $Id$
18 ///
19 // Realises dumping the complete network state
20 /****************************************************************************/
21 #ifndef MSXMLRawOut_h
22 #define MSXMLRawOut_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <utils/common/SUMOTime.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OutputDevice;
37 class MSEdgeControl;
38 class MSEdge;
39 class MSBaseVehicle;
40 class MSLane;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
46 /**
47  * @class MSXMLRawOut
48  * @brief Realises dumping the complete network state
49  *
50  * The class offers a static method, which writes the complete dump of
51  *  the given network into the given OutputDevice.
52  *
53  * @todo consider error-handling on write (using IOError)
54  */
55 class MSXMLRawOut {
56 public:
57     /** @brief Writes the complete network state of the given edges into the given device
58      *
59      * Opens the current time step, goes through the edges and writes each using
60      *  writeEdge.
61      *
62      * @param[in] of The output device to use
63      * @param[in] ec The EdgeControl which holds the edges to write
64      * @param[in] timestep The current time step
65      * @param[in] precision The output precision
66      * @exception IOError If an error on writing occurs (!!! not yet implemented)
67      */
68     static void write(OutputDevice& of, const MSEdgeControl& ec,
69                       SUMOTime timestep, int precision);
70 
71 
72     /** @brief Writes the dump of the given vehicle into the given device
73      *
74      * @param[in] of The output device to use
75      * @param[in] veh The vehicle to dump
76      * @exception IOError If an error on writing occurs (!!! not yet implemented)
77      */
78     static void writeVehicle(OutputDevice& of, const MSBaseVehicle& veh);
79 
80 
81 private:
82     /** @brief Writes the dump of the given edge into the given device
83      *
84      * If the edge is not empty or also empty edges shall be dumped, the edge
85      *  description is opened and writeLane is called for each lane.
86      *
87      * @param[in] of The output device to use
88      * @param[in] edge The edge to dump
89      * @todo MSGlobals::gOmitEmptyEdgesOnDump should not be used; rather the according option read in write
90      * @exception IOError If an error on writing occurs (!!! not yet implemented)
91      */
92     static void writeEdge(OutputDevice& of, const MSEdge& edge, SUMOTime timestep);
93 
94 
95     /** @brief Writes the dump of the given lane into the given device
96      *
97      * Opens the lane description and goes through all vehicles, calling writeVehicle
98      *  for each.
99      *
100      * @param[in] of The output device to use
101      * @param[in] lane The lane to dump
102      * @exception IOError If an error on writing occurs (!!! not yet implemented)
103      */
104     static void writeLane(OutputDevice& of, const MSLane& lane);
105 
106     /// @brief write transportable
107     static void writeTransportable(OutputDevice& of, const MSTransportable* p, SumoXMLTag tag);
108 
109 private:
110     /// @brief Invalidated copy constructor.
111     MSXMLRawOut(const MSXMLRawOut&);
112 
113     /// @brief Invalidated assignment operator.
114     MSXMLRawOut& operator=(const MSXMLRawOut&);
115 
116 
117 };
118 
119 
120 #endif
121 
122 /****************************************************************************/
123 
124