SUMO - Simulation of Urban MObility
MSMessageEmitter.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Builds detectors for microsim
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
00021 #ifndef MSMessageEmitter_h
00022 #define MSMessageEmitter_h
00023 
00024 
00025 // ===========================================================================
00026 // included modules
00027 // ===========================================================================
00028 #ifdef _MSC_VER
00029 #include <windows_config.h>
00030 #else
00031 #include <config.h>
00032 #endif
00033 
00034 #ifdef _MESSAGES
00035 
00036 #include <string>
00037 
00038 
00039 // ===========================================================================
00040 // class declarations
00041 // ===========================================================================
00042 class OutputDevice;
00043 class MSLane;
00044 
00045 
00046 // ===========================================================================
00047 // class definitions
00048 // ===========================================================================
00056 class MSMessageEmitter {
00057 public:
00058     MSMessageEmitter(std::string& file, const std::string& base, std::string& whatemit,
00059                      bool reverse = false, bool tableOut = true, bool xy = false, SUMOReal step = 1);
00060 
00061     virtual ~MSMessageEmitter();
00062 
00063     void writeLaneChangeEvent(const std::string& id, SUMOReal& timeStep, MSLane* oldlane, SUMOReal myPos,
00064                               SUMOReal mySpeed, MSLane* newlane, SUMOReal x, SUMOReal y);
00065 
00066     void writeBreakEvent(const std::string& id, SUMOReal& timeStep, MSLane* lane, SUMOReal myPos,
00067                          SUMOReal speed, SUMOReal x, SUMOReal y);
00068 
00069     void writeHeartBeatEvent(const std::string& id, SUMOReal& timeStep, MSLane* lane, SUMOReal myPos,
00070                              SUMOReal speed, SUMOReal x, SUMOReal y);
00071 
00072     bool getWriteLCEvent();
00073 
00074     bool getWriteBEvent();
00075 
00076     bool getWriteHBEvent();
00077 
00078     bool getEventsEnabled(const std::string& enabled);
00079 
00080 private:
00081     // methods
00082     std::string trimmed(const std::string& str, const char* sepSet = " \t\n\r");
00083 
00084     void setWriteEvents(std::string& events);
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
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines