SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimVehTypeClass.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // -------------------
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
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 #ifdef CHECK_MEMORY_LEAKS
37 #include <foreign/nvwa/debug_new.h>
38 #endif // CHECK_MEMORY_LEAKS
39 
40 
42 
44  const std::string& name,
45  const RGBColor& color,
46  std::vector<int>& types)
47  : myID(id), myName(name), myColor(color), myTypes(types) {}
48 
50 
51 
52 bool
53 NIVissimVehTypeClass::dictionary(int id, const std::string& name,
54  const RGBColor& color,
55  std::vector<int>& types) {
56  NIVissimVehTypeClass* o = new NIVissimVehTypeClass(id, name, color, types);
57  if (!dictionary(id, o)) {
58  delete o;
59  return false;
60  }
61  return true;
62 }
63 
64 
65 
66 
67 bool
69  DictType::iterator i = myDict.find(name);
70  if (i == myDict.end()) {
71  myDict[name] = o;
72  return true;
73  }
74  return false;
75 }
76 
77 
80  DictType::iterator i = myDict.find(name);
81  if (i == myDict.end()) {
82  return 0;
83  }
84  return (*i).second;
85 }
86 
87 
88 void
90  for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) {
91  delete(*i).second;
92  }
93  myDict.clear();
94 }
95 
96 
97 
98 /****************************************************************************/
99