Eclipse SUMO - Simulation of Urban MObility
MSTrigger.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-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 /****************************************************************************/
15 // An abstract device that changes the state of the micro simulation
16 /****************************************************************************/
17 // ===========================================================================
18 // included modules
19 // ===========================================================================
20 #include "MSTrigger.h"
21 
22 
23 // ===========================================================================
24 // static member definitions
25 // ===========================================================================
26 std::set<MSTrigger*> MSTrigger::myInstances;
27 
28 
29 // ===========================================================================
30 // method definitions
31 // ===========================================================================
32 MSTrigger::MSTrigger(const std::string& id) :
33  Named(id) {
34  myInstances.insert(this);
35 }
36 
37 
39  myInstances.erase(this);
40 }
41 
42 
44  while (!myInstances.empty()) {
45  delete *myInstances.begin();
46  }
47 }
MSTrigger::~MSTrigger
virtual ~MSTrigger()
Destructor.
Definition: MSTrigger.cpp:38
Named
Base class for objects which have an id.
Definition: Named.h:56
MSTrigger::myInstances
static std::set< MSTrigger * > myInstances
Definition: MSTrigger.h:61
MSTrigger::cleanup
static void cleanup()
properly deletes all trigger instances
Definition: MSTrigger.cpp:43
MSTrigger.h
MSTrigger::MSTrigger
MSTrigger(const std::string &id)
Constructor.
Definition: MSTrigger.cpp:32