From 5e26e4c22d98f90a4465bf76808d03ad23ef3f86 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Fri, 9 May 2014 18:40:07 +0200 Subject: [PATCH] replacing all boost unordereds --- Algorithms/BFSComponentExplorer.h | 16 ++++++------- Contractor/EdgeBasedGraphFactory.h | 9 ++++---- Contractor/GeometryCompressor.h | 4 ++-- DataStructures/HashTable.h | 37 +++++++++++++++--------------- Extractor/ExtractorCallbacks.cpp | 2 +- Extractor/ExtractorCallbacks.h | 6 ++--- Include/osrm/ServerPaths.h | 4 ++-- Library/OSRM_impl.h | 5 +++- extractor.cpp | 4 ++-- 9 files changed, 43 insertions(+), 44 deletions(-) diff --git a/Algorithms/BFSComponentExplorer.h b/Algorithms/BFSComponentExplorer.h index f813388ee..e52a7afcd 100644 --- a/Algorithms/BFSComponentExplorer.h +++ b/Algorithms/BFSComponentExplorer.h @@ -1,23 +1,21 @@ #ifndef __BFS_COMPONENT_EXPLORER_H__ #define __BFS_COMPONENT_EXPLORER_H__ -#include -#include - #include "../typedefs.h" #include "../DataStructures/DynamicGraph.h" #include "../DataStructures/RestrictionMap.h" -/** - * Explores the components of the given graph while respecting turn restrictions - * and barriers. - */ +#include +#include + +// Explores the components of the given graph while respecting turn restrictions +// and barriers. template class BFSComponentExplorer { public: BFSComponentExplorer(const GraphT &dynamicGraph, const RestrictionMap &restrictions, - const boost::unordered_set &barrier_nodes) + const std::unordered_set &barrier_nodes) : m_graph(dynamicGraph), m_restriction_map(restrictions), m_barrier_nodes(barrier_nodes) { BOOST_ASSERT(m_graph.GetNumberOfNodes() > 0); @@ -136,7 +134,7 @@ template class BFSComponentExplorer const GraphT &m_graph; const RestrictionMap &m_restriction_map; - const boost::unordered_set &m_barrier_nodes; + const std::unordered_set &m_barrier_nodes; }; #endif diff --git a/Contractor/EdgeBasedGraphFactory.h b/Contractor/EdgeBasedGraphFactory.h index 5292fc2b3..07b19e754 100644 --- a/Contractor/EdgeBasedGraphFactory.h +++ b/Contractor/EdgeBasedGraphFactory.h @@ -42,14 +42,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../DataStructures/RestrictionMap.h" #include "GeometryCompressor.h" -#include -#include - #include #include #include #include #include +#include +#include #include struct lua_State; @@ -105,8 +104,8 @@ class EdgeBasedGraphFactory DeallocatingVector m_edge_based_edge_list; std::shared_ptr m_node_based_graph; - boost::unordered_set m_barrier_nodes; - boost::unordered_set m_traffic_lights; + std::unordered_set m_barrier_nodes; + std::unordered_set m_traffic_lights; std::unique_ptr m_restriction_map; diff --git a/Contractor/GeometryCompressor.h b/Contractor/GeometryCompressor.h index 5cd9dcbee..439904a38 100644 --- a/Contractor/GeometryCompressor.h +++ b/Contractor/GeometryCompressor.h @@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../typedefs.h" -#include +#include #include @@ -58,7 +58,7 @@ class GeometryCompressor void IncreaseFreeList(); std::vector> m_compressed_geometries; std::vector m_free_list; - boost::unordered_map m_edge_id_to_list_index_map; + std::unordered_map m_edge_id_to_list_index_map; }; #endif // GEOMETRY_COMPRESSOR_H diff --git a/DataStructures/HashTable.h b/DataStructures/HashTable.h index 111296ea7..766db3fcd 100644 --- a/DataStructures/HashTable.h +++ b/DataStructures/HashTable.h @@ -28,28 +28,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef HASH_TABLE_H #define HASH_TABLE_H -#include #include -#include -template > -class HashTable : public boost::unordered_map { -private: - typedef boost::unordered_map super; -public: - static Value default_value; +#include - HashTable() : super() { } +template class HashTable : public std::unordered_map +{ + private: + typedef std::unordered_map super; - explicit HashTable(const unsigned size) : super(size) { } + public: + constexpr static Value default_value(); - inline void Add( Key const & key, Value const & value) { - super::emplace(std::make_pair(key, value)); - } + HashTable() : super() {} - 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()) { return boost::cref(default_value); @@ -57,9 +56,9 @@ public: 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; } @@ -67,7 +66,7 @@ public: } }; -template -Value HashTable::default_value; +// template +// Value HashTable::default_value; #endif /* HASH_TABLE_H */ diff --git a/Extractor/ExtractorCallbacks.cpp b/Extractor/ExtractorCallbacks.cpp index 95219e15a..b5764a952 100644 --- a/Extractor/ExtractorCallbacks.cpp +++ b/Extractor/ExtractorCallbacks.cpp @@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers, - boost::unordered_map &string_map) + std::unordered_map &string_map) : string_map(string_map), external_memory(extraction_containers) { } diff --git a/Extractor/ExtractorCallbacks.h b/Extractor/ExtractorCallbacks.h index 5b08b9242..fcdb272da 100644 --- a/Extractor/ExtractorCallbacks.h +++ b/Extractor/ExtractorCallbacks.h @@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../typedefs.h" -#include +#include #include struct ExternalMemoryNode; @@ -41,14 +41,14 @@ struct InputRestrictionContainer; class ExtractorCallbacks { private: - boost::unordered_map &string_map; + std::unordered_map &string_map; ExtractionContainers &external_memory; public: ExtractorCallbacks() = delete; ExtractorCallbacks(const ExtractorCallbacks &) = delete; explicit ExtractorCallbacks(ExtractionContainers &extraction_containers, - boost::unordered_map &string_map); + std::unordered_map &string_map); // warning: caller needs to take care of synchronization! void ProcessNode(const ExternalMemoryNode &node); diff --git a/Include/osrm/ServerPaths.h b/Include/osrm/ServerPaths.h index b7d326e75..52b60c7c4 100644 --- a/Include/osrm/ServerPaths.h +++ b/Include/osrm/ServerPaths.h @@ -29,10 +29,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define SERVER_PATH_H #include -#include +#include #include -typedef boost::unordered_map ServerPaths; +typedef std::unordered_map ServerPaths; #endif // SERVER_PATH_H diff --git a/Library/OSRM_impl.h b/Library/OSRM_impl.h index 0a285db44..d201a61b0 100644 --- a/Library/OSRM_impl.h +++ b/Library/OSRM_impl.h @@ -36,13 +36,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../Plugins/BasePlugin.h" #include "../Util/ProgramOptions.h" +#include +#include + struct SharedBarriers; template class BaseDataFacade; class OSRM_impl { private: - typedef boost::unordered_map PluginMap; + typedef std::unordered_map PluginMap; public: OSRM_impl(const ServerPaths &paths, const bool use_shared_memory); diff --git a/extractor.cpp b/extractor.cpp index f97e23365..1d867a1e0 100644 --- a/extractor.cpp +++ b/extractor.cpp @@ -42,12 +42,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include #include #include #include #include +#include ExtractorCallbacks *extractor_callbacks; UUID uuid; @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) restriction_fileName.replace(pos, 8, ".osrm.restrictions"); } - boost::unordered_map string_map; + std::unordered_map string_map; ExtractionContainers extraction_containers; string_map[""] = 0;