SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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-2016 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 #ifdef CHECK_MEMORY_LEAKS
38 #include <foreign/nvwa/debug_new.h>
39 #endif // CHECK_MEMORY_LEAKS
40 
41 
43 
45  const std::string& name,
46  const RGBColor& color,
47  std::vector<int>& types)
48  : myID(id), myName(name), myColor(color), myTypes(types) {}
49 
51 
52 
53 bool
54 NIVissimVehTypeClass::dictionary(int id, const std::string& name,
55  const RGBColor& color,
56  std::vector<int>& types) {
57  NIVissimVehTypeClass* o = new NIVissimVehTypeClass(id, name, color, types);
58  if (!dictionary(id, o)) {
59  delete o;
60  return false;
61  }
62  return true;
63 }
64 
65 
66 
67 
68 bool
70  DictType::iterator i = myDict.find(name);
71  if (i == myDict.end()) {
72  myDict[name] = o;
73  return true;
74  }
75  return false;
76 }
77 
78 
81  DictType::iterator i = myDict.find(name);
82  if (i == myDict.end()) {
83  return 0;
84  }
85  return (*i).second;
86 }
87 
88 
89 void
91  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
92  delete(*i).second;
93  }
94  myDict.clear();
95 }
96 
97 
98 
99 /****************************************************************************/
100 
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