SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimSource.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // -------------------
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10 // Copyright (C) 2001-2014 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 
32 #include <string>
33 #include <map>
34 #include "NIVissimSource.h"
35 
36 #ifdef CHECK_MEMORY_LEAKS
37 #include <foreign/nvwa/debug_new.h>
38 #endif // CHECK_MEMORY_LEAKS
39 
41 
42 NIVissimSource::NIVissimSource(const std::string& id, const std::string& name,
43  const std::string& edgeid, SUMOReal q,
44  bool exact, int vehicle_combination,
45  SUMOReal beg, SUMOReal end)
46  : myID(id), myName(name), myEdgeID(edgeid), myQ(q), myExact(exact),
47  myVehicleCombination(vehicle_combination),
48  myTimeBeg(beg), myTimeEnd(end) {}
49 
50 
52 
53 
54 bool
55 NIVissimSource::dictionary(const std::string& id, const std::string& name,
56  const std::string& edgeid, SUMOReal q, bool exact,
57  int vehicle_combination, SUMOReal beg, SUMOReal end) {
58  NIVissimSource* o = new NIVissimSource(id, name, edgeid, q, exact,
59  vehicle_combination, beg, end);
60  if (!dictionary(id, o)) {
61  delete o;
62  return false;
63  }
64  return true;
65 }
66 
67 
68 bool
69 NIVissimSource::dictionary(const std::string& id, NIVissimSource* o) {
70  DictType::iterator i = myDict.find(id);
71  if (i == myDict.end()) {
72  myDict[id] = o;
73  return true;
74  }
75  return false;
76 }
77 
78 
80 NIVissimSource::dictionary(const std::string& id) {
81  DictType::iterator i = myDict.find(id);
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