SUMO - Simulation of Urban MObility
GUIEvent_Message.h
Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Event send when a message (message, warning, error) has to besubmitted
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This file is part of SUMO.
00014 //   SUMO is free software: you can redistribute it and/or modify
00015 //   it under the terms of the GNU General Public License as published by
00016 //   the Free Software Foundation, either version 3 of the License, or
00017 //   (at your option) any later version.
00018 //
00019 /****************************************************************************/
00020 #ifndef GUIEvent_Message_h
00021 #define GUIEvent_Message_h
00022 
00023 
00024 // ===========================================================================
00025 // included modules
00026 // ===========================================================================
00027 #ifdef _MSC_VER
00028 #include <windows_config.h>
00029 #else
00030 #include <config.h>
00031 #endif
00032 
00033 #include "GUIEvent.h"
00034 #include <string>
00035 #include <utils/common/MsgHandler.h>
00036 
00037 
00038 // ===========================================================================
00039 // class definitions
00040 // ===========================================================================
00046 class GUIEvent_Message : public GUIEvent {
00047 public:
00049     GUIEvent_Message(MsgHandler::MsgType type, const std::string& msg)
00050         : GUIEvent(EVENT_MESSAGE_OCCURED), myMsg(msg) {
00051         switch (type) {
00052             case MsgHandler::MT_MESSAGE:
00053                 myType = EVENT_MESSAGE_OCCURED;
00054                 break;
00055             case MsgHandler::MT_WARNING:
00056                 myType = EVENT_WARNING_OCCURED;
00057                 break;
00058             case MsgHandler::MT_ERROR:
00059                 myType = EVENT_ERROR_OCCURED;
00060                 break;
00061             default:
00062                 throw 1;
00063         }
00064     }
00065 
00067     ~GUIEvent_Message() { }
00068 
00070     const std::string& getMsg() const {
00071         return myMsg;
00072     }
00073 
00074 protected:
00075 
00077     std::string myMsg;
00078 
00079 };
00080 
00081 
00082 #endif
00083 
00084 /****************************************************************************/
00085 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines