Switched to std::shared_ptr in Contractor/

This commit is contained in:
Patrick Niklaus
2014-05-08 23:22:49 +02:00
parent d13cd4d4b3
commit 5265f38c35
8 changed files with 17 additions and 25 deletions
+3 -5
View File
@@ -41,8 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/assert.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <algorithm>
#include <limits>
@@ -234,7 +232,7 @@ class Contractor
std::cout << "merged " << edges.size() - edge << " edges out of " << edges.size()
<< std::endl;
edges.resize(edge);
_graph = boost::make_shared<_DynamicGraph>(nodes, edges);
_graph = std::make_shared<_DynamicGraph>(nodes, edges);
edges.clear();
std::vector<_ContractorEdge>().swap(edges);
BOOST_ASSERT(0 == edges.capacity());
@@ -396,7 +394,7 @@ class Contractor
// create new graph
std::sort(newSetOfEdges.begin(), newSetOfEdges.end());
_graph = boost::make_shared<_DynamicGraph>(remainingNodes.size(), newSetOfEdges);
_graph = std::make_shared<_DynamicGraph>(remainingNodes.size(), newSetOfEdges);
newSetOfEdges.clear();
flushedContractor = true;
@@ -939,7 +937,7 @@ class Contractor
return a < b;
}
boost::shared_ptr<_DynamicGraph> _graph;
std::shared_ptr<_DynamicGraph> _graph;
std::vector<_DynamicGraph::InputEdge> contractedEdges;
unsigned edge_storage_slot;
uint64_t temp_edge_counter;
+1 -2
View File
@@ -31,14 +31,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
#include <fstream>
#include <iomanip>
#include <numeric>
EdgeBasedGraphFactory::EdgeBasedGraphFactory(
const boost::shared_ptr<NodeBasedDynamicGraph> &node_based_graph,
const std::shared_ptr<NodeBasedDynamicGraph> &node_based_graph,
std::unique_ptr<RestrictionMap> restriction_map,
std::vector<NodeID> &barrier_node_list,
std::vector<NodeID> &traffic_light_node_list,
+2 -3
View File
@@ -49,7 +49,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "GeometryCompressor.h"
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
@@ -63,7 +62,7 @@ class EdgeBasedGraphFactory : boost::noncopyable
public:
struct SpeedProfileProperties;
explicit EdgeBasedGraphFactory(const boost::shared_ptr<NodeBasedDynamicGraph> &node_based_graph,
explicit EdgeBasedGraphFactory(const std::shared_ptr<NodeBasedDynamicGraph> &node_based_graph,
std::unique_ptr<RestrictionMap> restricion_map,
std::vector<NodeID> &barrier_node_list,
std::vector<NodeID> &traffic_light_node_list,
@@ -107,7 +106,7 @@ class EdgeBasedGraphFactory : boost::noncopyable
std::vector<EdgeBasedNode> m_edge_based_node_list;
DeallocatingVector<EdgeBasedEdge> m_edge_based_edge_list;
boost::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph;
std::shared_ptr<NodeBasedDynamicGraph> m_node_based_graph;
boost::unordered_set<NodeID> m_barrier_nodes;
boost::unordered_set<NodeID> m_traffic_lights;
+3 -5
View File
@@ -36,8 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/assert.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <cstdint>
@@ -84,8 +82,8 @@ class TemporaryStorage
{
bool write_mode;
boost::filesystem::path temp_path;
boost::shared_ptr<boost::filesystem::fstream> temp_file;
boost::shared_ptr<boost::mutex> readWriteMutex;
std::shared_ptr<boost::filesystem::fstream> temp_file;
std::shared_ptr<boost::mutex> readWriteMutex;
std::vector<char> buffer;
StreamData()
@@ -93,7 +91,7 @@ class TemporaryStorage
TemporaryFilePattern.begin(), TemporaryFilePattern.end()))),
temp_file(new boost::filesystem::fstream(
temp_path, std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary)),
readWriteMutex(boost::make_shared<boost::mutex>())
readWriteMutex(std::make_shared<boost::mutex>())
{
if (temp_file->fail())
{