1
// Generic Geometry Library
3
// Copyright Bruno Lalande 2008, 2009
4
// Copyright Barend Gehrels 1995-2009, Geodan Holding B.V. Amsterdam, the Netherlands.
5
// Use, modification and distribution is subject to the Boost Software License,
6
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7
// http://www.boost.org/LICENSE_1_0.txt)
9
#ifndef GGL_GEOMETRIES_ADAPTED_C_ARRAY_HPP
10
#define GGL_GEOMETRIES_ADAPTED_C_ARRAY_HPP
14
#include <boost/type_traits/is_arithmetic.hpp>
16
#include <ggl/core/access.hpp>
17
#include <ggl/core/cs.hpp>
18
#include <ggl/core/coordinate_dimension.hpp>
19
#include <ggl/core/coordinate_type.hpp>
20
#include <ggl/core/tags.hpp>
25
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
29
#ifndef DOXYGEN_NO_DETAIL
33
// Create class and specialization to indicate the tag
34
// for normal cases and the case that the type of the c-array is arithmetic
38
typedef geometry_not_recognized_tag type;
42
struct c_array_tag<true>
44
typedef point_tag type;
48
#endif // DOXYGEN_NO_DETAIL
50
// Assign the point-tag, preventing arrays of points getting a point-tag
51
template <typename T, std::size_t N>
52
struct tag<T[N]> : detail::c_array_tag<boost::is_arithmetic<T>::value> {};
54
template <typename T, std::size_t N>
55
struct coordinate_type<T[N]>
60
template <typename T, std::size_t N>
61
struct dimension<T[N]>: boost::mpl::int_<N> {};
63
template <typename T, std::size_t N>
66
template <std::size_t I>
67
static inline T get(const T p[N])
72
template <std::size_t I>
73
static inline void set(T p[N], const T& value)
79
// The library user has
80
// 1) either to specify the coordinate system
81
// 2) or include <ggl/geometries/adapted/c_array_@.hpp> where @=cartesian,geographic,...
84
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
88
#endif // GGL_GEOMETRIES_ADAPTED_C_ARRAY_HPP