// Copyright (c) 2015 GeometryFactory // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Mael Rouxel-Labbé #ifndef CGAL_STREAM_SUPPORT_HELPERS_H #define CGAL_STREAM_SUPPORT_HELPERS_H #include #include #include #include #include #include #include #include namespace CGAL { namespace IO { namespace internal { // Ideally this should be a std::is_constructible(double, double, double) but boost::is_constructible // is not safe to use without CXX11 template void fill_point(const double x, const double y, const double z, const double w, CGAL::Point_3& pt) { pt = CGAL::Point_3(x, y, z, w); } template void fill_point(const double x, const double y, const double z, const double w, Point_3& pt) { // just in case something weirder than arrays or CGAL points are used as points... CGAL::internal::resize(pt, 3); pt[0] = x/w; pt[1] = y/w; pt[2] = z/w; } // Functions like 'write_OFF' can take : // - write_OFF(stream, point_set) // - write_OFF(stream, pointrange) // - write_OFF(stream, polygon_mesh) // so a way to distinguish is needed BOOST_MPL_HAS_XXX_TRAIT_DEF(Point_set) template struct is_Point_set_3 : has_Point_set { }; // Point_set_3 also functions as range, so it needs to be excluded template struct is_Range : public boost::mpl::and_< boost::has_range_const_iterator, boost::mpl::not_ > > { }; // For polygon meshes template struct is_Point_set_or_Range_or_Iterator : public boost::mpl::or_, is_Range, is_iterator > { }; } // end namespace internal } // end namespace IO } // namespace CGAL #endif // CGAL_STREAM_SUPPORT_HELPERS_H