replacing all boost unordereds

This commit is contained in:
Dennis Luxen 2014-05-09 18:40:07 +02:00
parent 00e27e4b5c
commit 5e26e4c22d
9 changed files with 43 additions and 44 deletions

View File

@ -1,23 +1,21 @@
#ifndef __BFS_COMPONENT_EXPLORER_H__ #ifndef __BFS_COMPONENT_EXPLORER_H__
#define __BFS_COMPONENT_EXPLORER_H__ #define __BFS_COMPONENT_EXPLORER_H__
#include <queue>
#include <boost/unordered_set.hpp>
#include "../typedefs.h" #include "../typedefs.h"
#include "../DataStructures/DynamicGraph.h" #include "../DataStructures/DynamicGraph.h"
#include "../DataStructures/RestrictionMap.h" #include "../DataStructures/RestrictionMap.h"
/** #include <queue>
* Explores the components of the given graph while respecting turn restrictions #include <unordered_set>
* and barriers.
*/ // Explores the components of the given graph while respecting turn restrictions
// and barriers.
template <typename GraphT> class BFSComponentExplorer template <typename GraphT> class BFSComponentExplorer
{ {
public: public:
BFSComponentExplorer(const GraphT &dynamicGraph, BFSComponentExplorer(const GraphT &dynamicGraph,
const RestrictionMap &restrictions, const RestrictionMap &restrictions,
const boost::unordered_set<NodeID> &barrier_nodes) const std::unordered_set<NodeID> &barrier_nodes)
: m_graph(dynamicGraph), m_restriction_map(restrictions), m_barrier_nodes(barrier_nodes) : m_graph(dynamicGraph), m_restriction_map(restrictions), m_barrier_nodes(barrier_nodes)
{ {
BOOST_ASSERT(m_graph.GetNumberOfNodes() > 0); BOOST_ASSERT(m_graph.GetNumberOfNodes() > 0);
@ -136,7 +134,7 @@ template <typename GraphT> class BFSComponentExplorer
const GraphT &m_graph; const GraphT &m_graph;
const RestrictionMap &m_restriction_map; const RestrictionMap &m_restriction_map;
const boost::unordered_set<NodeID> &m_barrier_nodes; const std::unordered_set<NodeID> &m_barrier_nodes;
}; };
#endif #endif

View File

@ -42,14 +42,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../DataStructures/RestrictionMap.h" #include "../DataStructures/RestrictionMap.h"
#include "GeometryCompressor.h" #include "GeometryCompressor.h"
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
#include <algorithm> #include <algorithm>
#include <iosfwd> #include <iosfwd>
#include <memory> #include <memory>
#include <queue> #include <queue>
#include <string> #include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector> #include <vector>
struct lua_State; struct lua_State;
@ -105,8 +104,8 @@ class EdgeBasedGraphFactory
DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list; DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
std::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph; std::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph;
boost::unordered_set<NodeID> m_barrier_nodes; std::unordered_set<NodeID> m_barrier_nodes;
boost::unordered_set<NodeID> m_traffic_lights; std::unordered_set<NodeID> m_traffic_lights;
std::unique_ptr<RestrictionMap> m_restriction_map; std::unique_ptr<RestrictionMap> m_restriction_map;

View File

@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../typedefs.h" #include "../typedefs.h"
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <vector> #include <vector>
@ -58,7 +58,7 @@ class GeometryCompressor
void IncreaseFreeList(); void IncreaseFreeList();
std::vector<std::vector<CompressedNode>> m_compressed_geometries; std::vector<std::vector<CompressedNode>> m_compressed_geometries;
std::vector<unsigned> m_free_list; std::vector<unsigned> m_free_list;
boost::unordered_map<EdgeID, unsigned> m_edge_id_to_list_index_map; std::unordered_map<EdgeID, unsigned> m_edge_id_to_list_index_map;
}; };
#endif // GEOMETRY_COMPRESSOR_H #endif // GEOMETRY_COMPRESSOR_H

View File

@ -28,28 +28,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef HASH_TABLE_H #ifndef HASH_TABLE_H
#define HASH_TABLE_H #define HASH_TABLE_H
#include <boost/functional/hash.hpp>
#include <boost/ref.hpp> #include <boost/ref.hpp>
#include <boost/unordered_map.hpp>
template<typename Key, typename Value, typename Hash = boost::hash<Key> > #include <unordered_map>
class HashTable : public boost::unordered_map<Key, Value> {
private:
typedef boost::unordered_map<Key, Value, Hash> super;
public:
static Value default_value;
HashTable() : super() { } template <typename Key, typename Value> class HashTable : public std::unordered_map<Key, Value>
{
private:
typedef std::unordered_map<Key, Value> super;
explicit HashTable(const unsigned size) : super(size) { } public:
constexpr static Value default_value();
inline void Add( Key const & key, Value const & value) { HashTable() : super() {}
super::emplace(std::make_pair(key, value));
}
inline const Value Find(Key const & key) const explicit HashTable(const unsigned size) : super(size) {}
inline void Add(Key const &key, Value const &value) { super::emplace(key, value); }
inline const Value Find(Key const &key) const
{ {
typename super::const_iterator iter = super::find(key); auto iter = super::find(key);
if (iter == super::end()) if (iter == super::end())
{ {
return boost::cref(default_value); return boost::cref(default_value);
@ -57,9 +56,9 @@ public:
return boost::cref(iter->second); return boost::cref(iter->second);
} }
inline const bool Holds( Key const & key) const inline const bool Holds(Key const &key) const
{ {
if(super::find(key) == super::end()) if (super::find(key) == super::end())
{ {
return false; return false;
} }
@ -67,7 +66,7 @@ public:
} }
}; };
template<typename Key, typename Value, typename Hash> // template<typename Key, typename Value, typename Hash>
Value HashTable<Key, Value, Hash>::default_value; // Value HashTable<Key, Value, Hash>::default_value;
#endif /* HASH_TABLE_H */ #endif /* HASH_TABLE_H */

View File

@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers, ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers,
boost::unordered_map<std::string, NodeID> &string_map) std::unordered_map<std::string, NodeID> &string_map)
: string_map(string_map), external_memory(extraction_containers) : string_map(string_map), external_memory(extraction_containers)
{ {
} }

View File

@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../typedefs.h" #include "../typedefs.h"
#include <boost/unordered_map.hpp> #include <unordered_map>
#include <string> #include <string>
struct ExternalMemoryNode; struct ExternalMemoryNode;
@ -41,14 +41,14 @@ struct InputRestrictionContainer;
class ExtractorCallbacks class ExtractorCallbacks
{ {
private: private:
boost::unordered_map<std::string, NodeID> &string_map; std::unordered_map<std::string, NodeID> &string_map;
ExtractionContainers &external_memory; ExtractionContainers &external_memory;
public: public:
ExtractorCallbacks() = delete; ExtractorCallbacks() = delete;
ExtractorCallbacks(const ExtractorCallbacks &) = delete; ExtractorCallbacks(const ExtractorCallbacks &) = delete;
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers, explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
boost::unordered_map<std::string, NodeID> &string_map); std::unordered_map<std::string, NodeID> &string_map);
// warning: caller needs to take care of synchronization! // warning: caller needs to take care of synchronization!
void ProcessNode(const ExternalMemoryNode &node); void ProcessNode(const ExternalMemoryNode &node);

View File

@ -29,10 +29,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SERVER_PATH_H #define SERVER_PATH_H
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/unordered_map.hpp>
#include <unordered_map>
#include <string> #include <string>
typedef boost::unordered_map<const std::string, boost::filesystem::path> ServerPaths; typedef std::unordered_map<std::string, boost::filesystem::path> ServerPaths;
#endif // SERVER_PATH_H #endif // SERVER_PATH_H

View File

@ -36,13 +36,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Plugins/BasePlugin.h" #include "../Plugins/BasePlugin.h"
#include "../Util/ProgramOptions.h" #include "../Util/ProgramOptions.h"
#include <unordered_map>
#include <string>
struct SharedBarriers; struct SharedBarriers;
template <class EdgeDataT> class BaseDataFacade; template <class EdgeDataT> class BaseDataFacade;
class OSRM_impl class OSRM_impl
{ {
private: private:
typedef boost::unordered_map<std::string, BasePlugin *> PluginMap; typedef std::unordered_map<std::string, BasePlugin *> PluginMap;
public: public:
OSRM_impl(const ServerPaths &paths, const bool use_shared_memory); OSRM_impl(const ServerPaths &paths, const bool use_shared_memory);

View File

@ -42,12 +42,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib> #include <cstdlib>
#include <boost/unordered_map.hpp>
#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <unordered_map>
ExtractorCallbacks *extractor_callbacks; ExtractorCallbacks *extractor_callbacks;
UUID uuid; UUID uuid;
@ -217,7 +217,7 @@ int main(int argc, char *argv[])
restriction_fileName.replace(pos, 8, ".osrm.restrictions"); restriction_fileName.replace(pos, 8, ".osrm.restrictions");
} }
boost::unordered_map<std::string, NodeID> string_map; std::unordered_map<std::string, NodeID> string_map;
ExtractionContainers extraction_containers; ExtractionContainers extraction_containers;
string_map[""] = 0; string_map[""] = 0;