SUMO - Simulation of Urban MObility
MSStopOut.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // Ouput information about planned vehicle stop
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef MSStopOut_h
21 #define MSStopOut_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <map>
34 #include <utils/common/SUMOTime.h>
35 #include <microsim/MSVehicle.h>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class OutputDevice;
42 class SUMOVehicle;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
57 class MSStopOut {
58 public:
59 
62  static void init();
63 
64  static bool active() {
65  return myInstance != 0;
66  }
67 
68  static MSStopOut* getInstance() {
69  return myInstance;
70  }
71 
73  MSStopOut(OutputDevice& dev);
74 
76  virtual ~MSStopOut();
77 
78  void stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers);
79 
80  void loadedPersons(const SUMOVehicle* veh, int n);
81  void unloadedPersons(const SUMOVehicle* veh, int n);
82 
83  void loadedContainers(const SUMOVehicle* veh, int n);
84  void unloadedContainers(const SUMOVehicle* veh, int n);
85 
86  void stopEnded(const SUMOVehicle* veh, const MSVehicle::Stop& stop);
87 
88 
89 private:
90  struct StopInfo {
91 
92  StopInfo(SUMOTime t, int numPersons, int numContainers) :
93  started(t),
94  initialNumPersons(numPersons),
95  loadedPersons(0),
96  unloadedPersons(0),
97  initialNumContainers(numContainers),
98  loadedContainers(0),
99  unloadedContainers(0) {
100  }
101 
102  // @note: need default constructor or std::map doesn't work
104  started(-1),
106  loadedPersons(0),
107  unloadedPersons(0),
109  loadedContainers(0),
110  unloadedContainers(0) {
111  }
112 
120  };
121 
122  typedef std::map<const SUMOVehicle*, StopInfo> Stopped;
123  Stopped myStopped;
124 
126 
128 
130  MSStopOut(const MSStopOut&);
131 
133  MSStopOut& operator=(const MSStopOut&);
134 
135 
136 };
137 
138 
139 #endif
140 
141 /****************************************************************************/
142 
static bool active()
Definition: MSStopOut.h:64
static void init()
Static intialization.
Definition: MSStopOut.cpp:43
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:820
Stopped myStopped
Definition: MSStopOut.h:123
void loadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:81
void unloadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:76
Representation of a vehicle.
Definition: SUMOVehicle.h:67
MSStopOut & operator=(const MSStopOut &)
Invalidated assignment operator.
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers)
Definition: MSStopOut.cpp:61
static MSStopOut * myInstance
Definition: MSStopOut.h:127
void stopEnded(const SUMOVehicle *veh, const MSVehicle::Stop &stop)
Definition: MSStopOut.cpp:91
void unloadedContainers(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:86
virtual ~MSStopOut()
Destructor.
Definition: MSStopOut.cpp:57
OutputDevice & myDevice
Definition: MSStopOut.h:125
static MSStopOut * getInstance()
Definition: MSStopOut.h:68
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
long long int SUMOTime
Definition: TraCIDefs.h:52
std::map< const SUMOVehicle *, StopInfo > Stopped
Definition: MSStopOut.h:122
void loadedPersons(const SUMOVehicle *veh, int n)
Definition: MSStopOut.cpp:71
Realises dumping the complete network state.
Definition: MSStopOut.h:57
StopInfo(SUMOTime t, int numPersons, int numContainers)
Definition: MSStopOut.h:92
MSStopOut(OutputDevice &dev)
constructor.
Definition: MSStopOut.cpp:53