SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSMessageEmitter.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Builds detectors for microsim
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2013 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 #ifndef MSMessageEmitter_h
22 #define MSMessageEmitter_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #ifdef _MESSAGES
35 
36 #include <string>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class OutputDevice;
43 class MSLane;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
56 class MSMessageEmitter {
57 public:
58  MSMessageEmitter(std::string& file, const std::string& base, std::string& whatemit,
59  bool reverse = false, bool tableOut = true, bool xy = false, SUMOReal step = 1);
60 
61  virtual ~MSMessageEmitter();
62 
63  void writeLaneChangeEvent(const std::string& id, SUMOReal& timeStep, MSLane* oldlane, SUMOReal myPos,
64  SUMOReal mySpeed, MSLane* newlane, SUMOReal x, SUMOReal y);
65 
66  void writeBreakEvent(const std::string& id, SUMOReal& timeStep, MSLane* lane, SUMOReal myPos,
67  SUMOReal speed, SUMOReal x, SUMOReal y);
68 
69  void writeHeartBeatEvent(const std::string& id, SUMOReal& timeStep, MSLane* lane, SUMOReal myPos,
70  SUMOReal speed, SUMOReal x, SUMOReal y);
71 
72  bool getWriteLCEvent();
73 
74  bool getWriteBEvent();
75 
76  bool getWriteHBEvent();
77 
78  bool getEventsEnabled(const std::string& enabled);
79 
80 private:
81  // methods
82  std::string trimmed(const std::string& str, const char* sepSet = " \t\n\r");
83 
84  void setWriteEvents(std::string& events);
85 
86  void initXML();
87  // variables
88  OutputDevice& myDev;
89 
90  bool writeLCEvent;
91  bool writeBEvent;
92  bool writeHBEvent;
93  bool reverseOrder;
94  bool tableOutput;
95  bool xyCoords;
96  SUMOReal myStep;
97 };
98 #endif //_MESSAGES
99 
100 #endif