SUMO - Simulation of Urban MObility
NIVissimVehicleType.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // -------------------
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 
31 #include "NIVissimVehicleType.h"
32 
34 
36  const std::string& category, const RGBColor& color)
37  : myName(name), myCategory(category),
38  myColor(color) {}
39 
40 
42 
43 
44 
45 bool
46 NIVissimVehicleType::dictionary(int id, const std::string& name, const std::string& category,
47  const RGBColor& color) {
48  NIVissimVehicleType* o = new NIVissimVehicleType(name, category, color);
49  if (!dictionary(id, o)) {
50  delete o;
51  return false;
52  }
53  return true;
54 }
55 
56 
57 bool
59  DictType::iterator i = myDict.find(id);
60  if (i == myDict.end()) {
61  myDict[id] = o;
62  return true;
63  }
64  return false;
65 }
66 
67 
70  DictType::iterator i = myDict.find(id);
71  if (i == myDict.end()) {
72  return 0;
73  }
74  return (*i).second;
75 }
76 
77 void
79  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
80  delete(*i).second;
81  }
82  myDict.clear();
83 }
84 
85 
86 
87 /****************************************************************************/
88 
NIVissimVehicleType(const std::string &name, const std::string &category, const RGBColor &color)
static bool dictionary(int id, const std::string &name, const std::string &category, const RGBColor &color)
static DictType myDict
std::map< int, NIVissimVehicleType * > DictType