3 // Copyright (c) 2018-2019, Oracle and/or its affiliates.
4 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_GEOMETRY_SRS_SHARED_GRIDS_BOOST_HPP
11 #define BOOST_GEOMETRY_SRS_SHARED_GRIDS_BOOST_HPP
14 #include <boost/geometry/srs/projections/grids.hpp>
17 #include <boost/thread.hpp>
20 namespace boost { namespace geometry
26 class shared_grids_boost
29 std::size_t size() const
31 boost::shared_lock<boost::shared_mutex> lock(mutex);
32 return gridinfo.size();
37 boost::shared_lock<boost::shared_mutex> lock(mutex);
38 return gridinfo.empty();
41 typedef projections::detail::shared_grids_tag tag;
45 read_locked(shared_grids_boost & g)
46 : gridinfo(g.gridinfo)
51 projections::detail::pj_gridinfo & gridinfo;
54 boost::shared_lock<boost::shared_mutex> lock;
59 write_locked(shared_grids_boost & g)
60 : gridinfo(g.gridinfo)
64 projections::detail::pj_gridinfo & gridinfo;
67 boost::unique_lock<boost::shared_mutex> lock;
71 projections::detail::pj_gridinfo gridinfo;
72 mutable boost::shared_mutex mutex;
79 }} // namespace boost::geometry
82 #endif // BOOST_GEOMETRY_SRS_SHARED_GRIDS_BOOST_HPP