|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Builds detectors for microsim 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef MSMessageEmitter_h 00020 #define MSMessageEmitter_h 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 #ifdef _MESSAGES 00033 00034 #include <string> 00035 00036 00037 // =========================================================================== 00038 // class declarations 00039 // =========================================================================== 00040 class OutputDevice; 00041 class MSLane; 00042 00043 00044 // =========================================================================== 00045 // class definitions 00046 // =========================================================================== 00054 class MSMessageEmitter { 00055 public: 00056 MSMessageEmitter(std::string& file, const std::string& base, std::string& whatemit, 00057 bool reverse = false, bool tableOut = true, bool xy = false, SUMOReal step = 1); 00058 00059 virtual ~MSMessageEmitter(); 00060 00061 void writeLaneChangeEvent(const std::string& id, SUMOReal& timeStep, MSLane* oldlane, SUMOReal myPos, 00062 SUMOReal mySpeed, MSLane* newlane, SUMOReal x, SUMOReal y); 00063 00064 void writeBreakEvent(const std::string& id, SUMOReal& timeStep, MSLane* lane, SUMOReal myPos, 00065 SUMOReal speed, SUMOReal x, SUMOReal y); 00066 00067 void writeHeartBeatEvent(const std::string& id, SUMOReal& timeStep, MSLane* lane, SUMOReal myPos, 00068 SUMOReal speed, SUMOReal x, SUMOReal y); 00069 00070 bool getWriteLCEvent(); 00071 00072 bool getWriteBEvent(); 00073 00074 bool getWriteHBEvent(); 00075 00076 bool getEventsEnabled(const std::string& enabled); 00077 00078 private: 00079 // methods 00080 std::string trimmed(const std::string& str, const char* sepSet = " \t\n\r"); 00081 00082 void setWriteEvents(std::string& events); 00083 00084 void setFile(const std::string& file); 00085 00086 void initXML(); 00087 // variables 00088 OutputDevice& myDev; 00089 00090 bool writeLCEvent; 00091 bool writeBEvent; 00092 bool writeHBEvent; 00093 bool reverseOrder; 00094 bool tableOutput; 00095 bool xyCoords; 00096 SUMOReal myStep; 00097 }; 00098 #endif //_MESSAGES 00099 00100 #endif