Eclipse SUMO - Simulation of Urban MObility
MsgHandlerSynchronized.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2003-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Retrieves messages about the process and gives them further to output
18 /****************************************************************************/
19 #ifndef MsgHandlerSynchronized_h
20 #define MsgHandlerSynchronized_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #ifdef HAVE_FOX
29 #include <fx.h>
30 #endif
31 #include <string>
32 #include <vector>
33 #include <iostream>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class OutputDevice;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
50 public:
51  static MsgHandler* create(MsgType type) {
52  return new MsgHandlerSynchronized(type);
53  }
54 
56  void inform(std::string msg, bool addType = true);
57 
65  void beginProcessMsg(std::string msg, bool addType = true);
66 
68  void endProcessMsg(std::string msg);
69 
71  void clear();
72 
74  void addRetriever(OutputDevice* retriever);
75 
77  void removeRetriever(OutputDevice* retriever);
78 
79 private:
82 
85 
87  static FXMutex myLock;
88 
89 private:
92 
95 };
96 
97 #endif
98 
99 /****************************************************************************/
MsgHandler::MsgType
MsgType
Definition: MsgHandler.h:51
MsgHandlerSynchronized
Definition: MsgHandlerSynchronized.h:49
MsgHandlerSynchronized::endProcessMsg
void endProcessMsg(std::string msg)
Ends a process information.
Definition: MsgHandlerSynchronized.cpp:61
MsgHandlerSynchronized::~MsgHandlerSynchronized
~MsgHandlerSynchronized()
destructor
Definition: MsgHandlerSynchronized.cpp:101
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MsgHandler.h
MsgHandlerSynchronized::MsgHandlerSynchronized
MsgHandlerSynchronized(MsgType type)
standard constructor
Definition: MsgHandlerSynchronized.cpp:96
MsgHandlerSynchronized::clear
void clear()
Clears information whether an error occurred previously.
Definition: MsgHandlerSynchronized.cpp:70
MsgHandlerSynchronized::addRetriever
void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
Definition: MsgHandlerSynchronized.cpp:79
MsgHandlerSynchronized::create
static MsgHandler * create(MsgType type)
Definition: MsgHandlerSynchronized.h:51
MsgHandler
Definition: MsgHandler.h:44
MsgHandlerSynchronized::inform
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandlerSynchronized.cpp:43
MsgHandlerSynchronized::removeRetriever
void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
Definition: MsgHandlerSynchronized.cpp:88
MsgHandlerSynchronized::operator=
MsgHandlerSynchronized & operator=(const MsgHandlerSynchronized &s)=delete
invalid assignment operator
config.h
MsgHandlerSynchronized::myLock
static FXMutex myLock
The lock for synchronizing all outputs using handlers of this class.
Definition: MsgHandlerSynchronized.h:87
MsgHandlerSynchronized::beginProcessMsg
void beginProcessMsg(std::string msg, bool addType=true)
Begins a process information.
Definition: MsgHandlerSynchronized.cpp:52