Skip to content

Commit

Permalink
[extensions] Drop Boost.SharedPtr dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
awulkiew committed Apr 24, 2023
1 parent 13de371 commit 3414e0b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 29 deletions.
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
Expand All @@ -14,10 +15,11 @@
#define BOOST_GEOMETRY_EXT_GIS_IO_SHAPELIB_SHP_CREATE_OBJECT_HPP


#include <memory>

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>
#include <boost/scoped_array.hpp>

#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
Expand Down Expand Up @@ -83,8 +85,8 @@ struct shape_create_range
{
int const n = boost::size(range);

boost::scoped_array<double> x(new double[n]);
boost::scoped_array<double> y(new double[n]);
std::unique_ptr<double[]> x(new double[n]);
std::unique_ptr<double[]> y(new double[n]);

range_to_part(range, x.get(), y.get());

Expand Down Expand Up @@ -126,9 +128,9 @@ struct shape_create_polygon
int const n = geometry::num_points(polygon);
int const ring_count = 1 + geometry::num_interior_rings(polygon);

boost::scoped_array<double> x(new double[n]);
boost::scoped_array<double> y(new double[n]);
boost::scoped_array<int> parts(new int[ring_count]);
std::unique_ptr<double[]> x(new double[n]);
std::unique_ptr<double[]> y(new double[n]);
std::unique_ptr<int[]> parts(new int[ring_count]);

int ring = 0;
int offset = 0;
Expand Down
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
Expand All @@ -14,12 +15,12 @@
#define BOOST_GEOMETRY_EXT_GIS_IO_SHAPELIB_SHP_CREATE_OBJECT_MULTI_HPP


#include <memory>

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>

#include <boost/scoped_array.hpp>

#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/multi/algorithms/num_interior_rings.hpp>
Expand All @@ -43,8 +44,8 @@ struct shape_create_multi_point
static inline SHPObject* apply(MultiPoint const& multi)
{
int const n = boost::size(multi);
boost::scoped_array<double> x(new double[n]);
boost::scoped_array<double> y(new double[n]);
std::unique_ptr<double[]> x(new double[n]);
std::unique_ptr<double[]> y(new double[n]);

range_to_part(multi, x.get(), y.get());

Expand All @@ -64,9 +65,9 @@ struct shape_create_multi_linestring
int const n = geometry::num_points(multi);
int const part_count = boost::size(multi);

boost::scoped_array<double> x(new double[n]);
boost::scoped_array<double> y(new double[n]);
boost::scoped_array<int> parts(new int[part_count]);
std::unique_ptr<double[]> x(new double[n]);
std::unique_ptr<double[]> y(new double[n]);
std::unique_ptr<int[]> parts(new int[part_count]);

int ring = 0;
int offset = 0;
Expand Down Expand Up @@ -94,9 +95,9 @@ struct shape_create_multi_polygon
int const n = geometry::num_points(multi);
int const ring_count = boost::size(multi) + geometry::num_interior_rings(multi);

boost::scoped_array<double> x(new double[n]);
boost::scoped_array<double> y(new double[n]);
boost::scoped_array<int> parts(new int[ring_count]);
std::unique_ptr<double[]> x(new double[n]);
std::unique_ptr<double[]> y(new double[n]);
std::unique_ptr<int[]> parts(new int[ring_count]);

int ring = 0;
int offset = 0;
Expand Down
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)

// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.

// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020 Oracle and/or its affiliates.
Expand All @@ -14,13 +15,11 @@
#define BOOST_GEOMETRY_EXT_GIS_IO_SHAPELIB_SHP_READ_OBJECT_HPP


#include <boost/scoped_array.hpp>

#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/static_assert.hpp>
#include <boost/geometry/algorithms/num_points.hpp>


// Should be somewhere in your include path
Expand Down
7 changes: 4 additions & 3 deletions include/boost/geometry/extensions/index/rtree/rtree.hpp
Expand Up @@ -3,6 +3,7 @@
// Boost.SpatialIndex - rtree implementation
//
// Copyright 2008 Federico J. Fernandez.
// Copyright 2023 Adam Wulkiewicz.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -12,13 +13,13 @@

#include <cstddef>
#include <iostream> // TODO: Remove if print() is removed
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>

#include <boost/concept_check.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/shared_ptr.hpp>

#include <boost/geometry/algorithms/area.hpp>

Expand All @@ -33,8 +34,8 @@ class rtree
{
public:

typedef boost::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef boost::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;
typedef std::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;

/**
* \brief Creates a rtree with 'maximum' elements per node and 'minimum'.
Expand Down
6 changes: 3 additions & 3 deletions include/boost/geometry/extensions/index/rtree/rtree_leaf.hpp
Expand Up @@ -3,6 +3,7 @@
// Boost.SpatialIndex - rtree leaf implementation
//
// Copyright 2008 Federico J. Fernandez.
// Copyright 2023 Adam Wulkiewicz.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -12,12 +13,11 @@

#include <deque>
#include <iostream> // TODO: Remove if print() is removed
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>

#include <boost/shared_ptr.hpp>

#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/expand.hpp>
Expand All @@ -33,7 +33,7 @@ class rtree_leaf : public rtree_node<Box, Value>
public:

/// container type for the leaves
typedef boost::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::vector<std::pair<Box, Value> > leaf_map;

/**
Expand Down
8 changes: 4 additions & 4 deletions include/boost/geometry/extensions/index/rtree/rtree_node.hpp
Expand Up @@ -3,6 +3,7 @@
// Boost.SpatialIndex - rtree node implementation
//
// Copyright 2008 Federico J. Fernandez.
// Copyright 2023 Adam Wulkiewicz.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -12,12 +13,11 @@

#include <deque>
#include <iostream> // TODO: Remove if print() is removed
#include <memory>
#include <stdexcept>
#include <utility>
#include <vector>

#include <boost/shared_ptr.hpp>

#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/equals.hpp>
Expand All @@ -37,8 +37,8 @@ class rtree_node
{
public:

typedef boost::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef boost::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;
typedef std::shared_ptr<rtree_node<Box, Value> > node_pointer;
typedef std::shared_ptr<rtree_leaf<Box, Value> > leaf_pointer;

/// type for the node map
typedef std::vector<std::pair<Box, node_pointer > > node_map;
Expand Down

0 comments on commit 3414e0b

Please sign in to comment.