replace boost::shared_ptr

This commit is contained in:
Dennis Luxen 2014-05-09 16:47:42 +02:00
parent 455dc26a5d
commit 84ffedd95d
4 changed files with 18 additions and 21 deletions

View File

@ -45,13 +45,14 @@ 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/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <algorithm>
#include <array>
#include <chrono>
#include <limits>
#include <memory>
#include <queue>
#include <string>
#include <vector>
@ -265,7 +266,7 @@ class StaticRTree
typename ShM<TreeNode, UseSharedMemory>::vector m_search_tree;
uint64_t m_element_count;
const std::string m_leaf_node_filename;
boost::shared_ptr<CoordinateListT> m_coordinate_list;
std::shared_ptr<CoordinateListT> m_coordinate_list;
public:
StaticRTree() = delete;
@ -422,7 +423,7 @@ class StaticRTree
// Read-only operation for queries
explicit StaticRTree(const boost::filesystem::path &node_file,
const boost::filesystem::path &leaf_file,
const boost::shared_ptr<CoordinateListT> coordinate_list)
const std::shared_ptr<CoordinateListT> coordinate_list)
: m_leaf_node_filename(leaf_file.string())
{
// open tree node file and load into RAM.
@ -465,7 +466,7 @@ class StaticRTree
explicit StaticRTree(TreeNode *tree_node_ptr,
const uint32_t number_of_nodes,
const boost::filesystem::path &leaf_file,
boost::shared_ptr<CoordinateListT> coordinate_list)
std::shared_ptr<CoordinateListT> coordinate_list)
: m_search_tree(tree_node_ptr, number_of_nodes), m_leaf_node_filename(leaf_file.string()),
m_coordinate_list(coordinate_list)
{

View File

@ -45,9 +45,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <osrm/Coordinate.h>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<EdgeDataT>
{
@ -64,7 +61,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
QueryGraph *m_query_graph;
std::string m_timestamp;
boost::shared_ptr<ShM<FixedPointCoordinate, false>::vector> m_coordinate_list;
std::shared_ptr<ShM<FixedPointCoordinate, false>::vector> m_coordinate_list;
ShM<NodeID, false>::vector m_via_node_list;
ShM<unsigned, false>::vector m_name_ID_list;
ShM<TurnInstruction, false>::vector m_turn_instruction_list;
@ -74,7 +71,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
ShM<unsigned, false>::vector m_geometry_indices;
ShM<unsigned, false>::vector m_geometry_list;
boost::shared_ptr<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false>>
std::shared_ptr<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false>>
m_static_rtree;
void LoadTimestamp(const boost::filesystem::path &timestamp_path)
@ -129,7 +126,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
unsigned number_of_coordinates = 0;
nodes_input_stream.read((char *)&number_of_coordinates, sizeof(unsigned));
m_coordinate_list =
boost::make_shared<std::vector<FixedPointCoordinate>>(number_of_coordinates);
std::make_shared<std::vector<FixedPointCoordinate>>(number_of_coordinates);
for (unsigned i = 0; i < number_of_coordinates; ++i)
{
nodes_input_stream.read((char *)&current_node, sizeof(NodeInfo));
@ -193,7 +190,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
{
BOOST_ASSERT_MSG(!m_coordinate_list->empty(), "coordinates must be loaded before r-tree");
m_static_rtree = boost::make_shared<StaticRTree<RTreeLeaf>>(
m_static_rtree = std::make_shared<StaticRTree<RTreeLeaf>>(
ram_index_path, file_index_path, m_coordinate_list);
}

View File

@ -39,10 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../../Util/ProgramOptions.h"
#include "../../Util/SimpleLogger.h"
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>
#include <algorithm>
#include <memory>
template <class EdgeDataT> class SharedDataFacade : public BaseDataFacade<EdgeDataT>
{
@ -68,12 +66,12 @@ template <class EdgeDataT> class SharedDataFacade : public BaseDataFacade<EdgeDa
unsigned m_check_sum;
unsigned m_number_of_nodes;
boost::shared_ptr<QueryGraph> m_query_graph;
boost::shared_ptr<SharedMemory> m_layout_memory;
boost::shared_ptr<SharedMemory> m_large_memory;
std::shared_ptr<QueryGraph> m_query_graph;
std::shared_ptr<SharedMemory> m_layout_memory;
std::shared_ptr<SharedMemory> m_large_memory;
std::string m_timestamp;
boost::shared_ptr<ShM<FixedPointCoordinate, true>::vector> m_coordinate_list;
std::shared_ptr<ShM<FixedPointCoordinate, true>::vector> m_coordinate_list;
ShM<NodeID, true>::vector m_via_node_list;
ShM<unsigned, true>::vector m_name_ID_list;
ShM<TurnInstruction, true>::vector m_turn_instruction_list;
@ -83,7 +81,7 @@ template <class EdgeDataT> class SharedDataFacade : public BaseDataFacade<EdgeDa
ShM<unsigned, true>::vector m_geometry_indices;
ShM<unsigned, true>::vector m_geometry_list;
boost::shared_ptr<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>
std::shared_ptr<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>
m_static_rtree;
void LoadTimestamp()
@ -99,7 +97,7 @@ template <class EdgeDataT> class SharedDataFacade : public BaseDataFacade<EdgeDa
BOOST_ASSERT_MSG(!m_coordinate_list->empty(), "coordinates must be loaded before r-tree");
RTreeNode *tree_ptr = (RTreeNode *)(shared_memory + data_layout->GetRSearchTreeOffset());
m_static_rtree = boost::make_shared<
m_static_rtree = std::make_shared<
StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>(
tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list);
}
@ -125,7 +123,7 @@ template <class EdgeDataT> class SharedDataFacade : public BaseDataFacade<EdgeDa
FixedPointCoordinate *coordinate_list_ptr =
(FixedPointCoordinate *)(shared_memory + data_layout->GetCoordinateListOffset());
m_coordinate_list = boost::make_shared<ShM<FixedPointCoordinate, true>::vector>(
m_coordinate_list = std::make_shared<ShM<FixedPointCoordinate, true>::vector>(
coordinate_list_ptr, data_layout->coordinate_list_size);
TurnInstruction *turn_instruction_list_ptr =

View File

@ -50,6 +50,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <luabind/luabind.hpp>
#include <chrono>
#include <memory>
#include <string>
#include <vector>