3 // Copyright (c) 2018, 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_PROJECTIONS_PAR_DATA_HPP
11 #define BOOST_GEOMETRY_SRS_PROJECTIONS_PAR_DATA_HPP
16 #include <boost/geometry/core/assert.hpp>
17 #include <boost/geometry/core/config.hpp>
19 namespace boost { namespace geometry { namespace srs
22 #ifndef DOXYGEN_NO_DETAIL
27 : std::vector<std::string>
29 typedef std::vector<std::string> base_t;
34 template <typename It>
35 nadgrids(It first, It last)
39 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
40 nadgrids(std::initializer_list<std::string> l)
45 nadgrids(std::string const& g0)
51 nadgrids(std::string const& g0, std::string const& g1)
57 nadgrids(std::string const& g0, std::string const& g1, std::string const& g2)
61 d[0] = g0; d[1] = g1; d[2] = g2;
63 nadgrids(std::string const& g0, std::string const& g1, std::string const& g2, std::string const& g3)
67 d[0] = g0; d[1] = g1; d[2] = g2; d[3] = g3;
69 nadgrids(std::string const& g0, std::string const& g1, std::string const& g2, std::string const& g3, std::string const& g4)
73 d[0] = g0; d[1] = g1; d[2] = g2; d[3] = g3; d[4] = g4;
77 template <typename T = double>
80 static const std::size_t static_capacity = 7;
82 typedef std::size_t size_type;
85 typedef const T* const_iterator;
87 typedef const T& const_reference;
91 #ifdef BOOST_GEOMETRY_CXX11_ARRAY_UNIFIED_INITIALIZATION
92 , m_data{0, 0, 0, 0, 0, 0, 0}
96 std::fill(m_data, m_data + 7, T(0));
100 template <typename It>
101 towgs84(It first, It last)
106 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
107 towgs84(std::initializer_list<T> l)
109 assign(l.begin(), l.end());
113 towgs84(T const& v0, T const& v1, T const& v2)
121 towgs84(T const& v0, T const& v1, T const& v2, T const& v3, T const& v4, T const& v5, T const& v6)
133 void push_back(T const& v)
135 BOOST_GEOMETRY_ASSERT(m_size < static_capacity);
140 template <typename It>
141 void assign(It first, It last)
143 for (m_size = 0 ; first != last && m_size < 7 ; ++first, ++m_size)
144 m_data[m_size] = *first;
147 #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST
148 void assign(std::initializer_list<T> l)
150 assign(l.begin(), l.end());
154 const_reference operator[](size_type i) const
156 BOOST_GEOMETRY_ASSERT(i < m_size);
160 reference operator[](size_type i)
162 BOOST_GEOMETRY_ASSERT(i < m_size);
166 size_type size() const
181 iterator begin() { return m_data; }
182 iterator end() { return m_data + m_size; }
183 const_iterator begin() const { return m_data; }
184 const_iterator end() const { return m_data + m_size; }
191 } // namespace detail
192 #endif // DOXYGEN_NO_DETAIL
194 }}} // namespace boost::geometry::srs
197 #endif // BOOST_GEOMETRY_SRS_PROJECTIONS_SPAR_HPP