SUMO - Simulation of Urban MObility
NIVissimVehTypeClass.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 /****************************************************************************/
18 // -------------------
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <string>
32 #include <utils/common/RGBColor.h>
34 #include "NIVissimVehTypeClass.h"
35 
36 
38 
40  const std::string& name,
41  const RGBColor& color,
42  std::vector<int>& types)
43  : myID(id), myName(name), myColor(color), myTypes(types) {}
44 
46 
47 
48 bool
49 NIVissimVehTypeClass::dictionary(int id, const std::string& name,
50  const RGBColor& color,
51  std::vector<int>& types) {
52  NIVissimVehTypeClass* o = new NIVissimVehTypeClass(id, name, color, types);
53  if (!dictionary(id, o)) {
54  delete o;
55  return false;
56  }
57  return true;
58 }
59 
60 
61 
62 
63 bool
65  DictType::iterator i = myDict.find(name);
66  if (i == myDict.end()) {
67  myDict[name] = o;
68  return true;
69  }
70  return false;
71 }
72 
73 
76  DictType::iterator i = myDict.find(name);
77  if (i == myDict.end()) {
78  return 0;
79  }
80  return (*i).second;
81 }
82 
83 
84 void
86  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
87  delete(*i).second;
88  }
89  myDict.clear();
90 }
91 
92 
93 
94 /****************************************************************************/
95 
static bool dictionary(int id, const std::string &name, const RGBColor &color, std::vector< int > &types)
NIVissimVehTypeClass(int id, const std::string &name, const RGBColor &color, std::vector< int > &types)
std::map< int, NIVissimVehTypeClass * > DictType