41 #ifndef SINGLEOCCUPANCY_H_
42 #define SINGLEOCCUPANCY_H_
44 #include <boost/unordered_map.hpp>
45 #include <boost/shared_ptr.hpp>
59 template<
typename T,
typename GPType>
63 typedef typename boost::unordered_map<Point<GPType> , boost::shared_ptr<T>,
HashGridPoint<GPType> > LocationMap;
64 typedef typename LocationMap::iterator LocationMapIter;
65 typedef typename LocationMap::const_iterator LocationMapConstIter;
67 LocationMap locations;
106 template<
typename T,
typename GPType>
108 LocationMapConstIter iter = locations.find(location);
109 if (iter == locations.end())
111 return iter->second.get();
114 template<
typename T,
typename GPType>
116 T* agent = get(location);
118 out.push_back(agent);
122 template<
typename T,
typename GPType>
124 LocationMapIter iter = locations.find(location);
126 if (iter != locations.end())
128 locations[location] = agent;
132 template<
typename T,
typename GPType>
134 locations.erase(location);