SUMO - Simulation of Urban MObility
NIVissimVehTypeClass.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // -------------------
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <utils/common/RGBColor.h>
35 #include "NIVissimVehTypeClass.h"
36 
37 
39 
41  const std::string& name,
42  const RGBColor& color,
43  std::vector<int>& types)
44  : myID(id), myName(name), myColor(color), myTypes(types) {}
45 
47 
48 
49 bool
50 NIVissimVehTypeClass::dictionary(int id, const std::string& name,
51  const RGBColor& color,
52  std::vector<int>& types) {
53  NIVissimVehTypeClass* o = new NIVissimVehTypeClass(id, name, color, types);
54  if (!dictionary(id, o)) {
55  delete o;
56  return false;
57  }
58  return true;
59 }
60 
61 
62 
63 
64 bool
66  DictType::iterator i = myDict.find(name);
67  if (i == myDict.end()) {
68  myDict[name] = o;
69  return true;
70  }
71  return false;
72 }
73 
74 
77  DictType::iterator i = myDict.find(name);
78  if (i == myDict.end()) {
79  return 0;
80  }
81  return (*i).second;
82 }
83 
84 
85 void
87  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
88  delete(*i).second;
89  }
90  myDict.clear();
91 }
92 
93 
94 
95 /****************************************************************************/
96 
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