Massive addition of enable/disable_ifs

This commit is contained in:
Maxime Gimeno 2020-04-17 16:05:43 +02:00
parent 00ffbe2caf
commit ba86b13ac9
9 changed files with 59 additions and 16 deletions

View File

@ -116,7 +116,13 @@ bool read_OFF(const std::string& fname, FaceGraph& g, const CGAL_BGL_NP_CLASS& n
}
template <typename FaceGraph>
bool read_OFF(std::istream& is, FaceGraph& g) { return read_OFF(is, g, parameters::all_default()); }
bool read_OFF(std::istream& is, FaceGraph& g,
typename boost::disable_if<
typename boost::has_range_const_iterator<FaceGraph>::type
>::type* =0)
{
return read_OFF(is, g, parameters::all_default());
}
template <typename FaceGraph>
bool read_OFF(const char* fname, FaceGraph& g) { return read_OFF(fname, g, parameters::all_default()); }
template <typename FaceGraph>
@ -178,7 +184,13 @@ bool write_OFF(const std::string& fname, const FaceGraph& g, const CGAL_BGL_NP_C
}
template <typename FaceGraph>
bool write_OFF(std::ostream& os, const FaceGraph& g) { return write_OFF(os, g, parameters::all_default()); }
bool write_OFF(std::ostream& os, const FaceGraph& g
,typename boost::disable_if<
typename boost::has_range_const_iterator<FaceGraph>::type
>::type* =0)
{
return write_OFF(os, g, parameters::all_default());
}
template <typename FaceGraph>
bool write_OFF(const char* fname, const FaceGraph& g) { return write_OFF(fname, g, parameters::all_default()); }
template <typename FaceGraph>

View File

@ -810,7 +810,7 @@ write_LAS(
}
bool okay
= write_LAS
= write_LAS_with_properties
(stream, point_set,
make_las_point_writer (point_set.point_map()),
std::make_pair (intensity, LAS_property::Intensity()),
@ -929,7 +929,7 @@ std::istream& operator>>(std::istream& is,
CGAL::read_PLY (is, ps);
#ifdef CGAL_LINKED_WITH_LASLIB
else if (line.find("LASF") == 0)
CGAL::read_las_point_set (is, ps);
CGAL::read_las_points(is, ps);
#endif // LAS
else
CGAL::read_XYZ (is, ps);
@ -1048,7 +1048,7 @@ write_las_point_set(
std::ostream& stream, ///< output stream.
CGAL::Point_set_3<Point, Vector>& point_set) ///< point set
{
return write_LAS(stram, point_set);
return write_LAS(stream, point_set);
}
#endif
/*!

View File

@ -25,6 +25,7 @@
#include <CGAL/boost/graph/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/is_iterator.h>
#include <boost/version.hpp>
#include <boost/cstdint.hpp>
@ -499,7 +500,10 @@ template <typename OutputIterator>
bool
read_LAS(
std::istream& stream, ///< input stream.
OutputIterator output)
OutputIterator output,
typename boost::enable_if<
typename CGAL::is_iterator<OutputIterator>
>::type* =0)
{
return read_LAS<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());

View File

@ -21,10 +21,13 @@
#include <CGAL/Origin.h>
#include <CGAL/point_set_processing_assertions.h>
#include <CGAL/Kernel_traits.h>
#include <CGAL/iterator.h>
#include <CGAL/boost/graph/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <boost/utility/enable_if.hpp>
#include <iostream>
#include <sstream>
#include <string>
@ -201,7 +204,10 @@ bool
read_OFF(
std::istream& stream, ///< input stream.
OutputIterator output,
const CGAL_BGL_NP_CLASS& np)
const CGAL_BGL_NP_CLASS& np,
typename boost::enable_if<
CGAL::is_iterator<OutputIterator>
>::type* =0)
{
return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, np);
@ -212,7 +218,10 @@ template <typename OutputIterator>
bool
read_OFF(
std::istream& stream, ///< input stream.
OutputIterator output)
OutputIterator output,
typename std::enable_if<
CGAL::is_iterator<OutputIterator>::value
>::type* =0)
{
return read_OFF<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());

View File

@ -204,7 +204,10 @@ template <typename OutputIterator>
bool
read_XYZ(
std::istream& stream, ///< input stream.
OutputIterator output)
OutputIterator output,
typename boost::enable_if<
CGAL::is_iterator<OutputIterator>
>::type* =0)
{
return read_XYZ<typename value_type_traits<OutputIterator>::type>
(stream, output, CGAL::parameters::all_default());

View File

@ -109,17 +109,21 @@ write_OFF(
}
/// \cond SKIP_IN_MANUAL
namespace internal{
BOOST_MPL_HAS_XXX_TRAIT_DEF(Point_set)
}
// variant with default NP
template <typename PointRange>
bool
write_OFF(
std::ostream& stream, ///< output stream.
const PointRange& points
#ifndef DOXYGEN_RUNNING
,typename boost::enable_if<
typename boost::has_range_const_iterator<PointRange>::type
>::type* =0,
typename std::enable_if<
!internal::has_Point_set<PointRange>::value
>::type* =0
#endif
)
{
return write_OFF

View File

@ -123,7 +123,7 @@ Polyhedron_demo_off_plugin::load_off(QFileInfo fileinfo) {
Scene_points_with_normal_item* item = new Scene_points_with_normal_item();
item->setName(fileinfo.completeBaseName());
if (scanner.size_of_vertices()==0) return item;
if(!item->read_OFF(in))
if(!item->read_off_point_set(in))
{
delete item;
return 0;

View File

@ -627,7 +627,7 @@ bool Scene_points_with_normal_item::write_ply_point_set(std::ostream& stream, bo
if (binary)
CGAL::set_binary_mode (stream);
CGAL::write_ply_point_set (stream, *(d->m_points), d->m_comments);
CGAL::write_PLY (stream, *(d->m_points), d->m_comments);
return true;
}
@ -680,7 +680,7 @@ bool Scene_points_with_normal_item::write_xyz_point_set(std::ostream& stream) co
d->m_points->reset_indices();
return stream &&
CGAL::write_xyz_point_set (stream, *(d->m_points));
CGAL::write_XYZ (stream, *(d->m_points));
}
QString

View File

@ -17,6 +17,7 @@
#include <CGAL/boost/graph/Named_function_parameters.h>
#include <CGAL/property_map.h>
#include <CGAL/iterator.h>
#include <boost/utility/enable_if.hpp>
@ -237,7 +238,13 @@ bool
read_PLY(std::istream& is,
PointRange& points,
PolygonRange& polygons,
bool /* verbose */ = false)
bool /* verbose */ = false
#ifndef DOXYGEN_RUNNING
,typename std::enable_if<
boost::has_value_type<PointRange>::value
>::type* =0
#endif
)
{
typedef typename PointRange::value_type Point_3;
if(!is.good())
@ -337,6 +344,7 @@ bool read_PLY(std::istream& is,
std::back_inserter(dummy_pf));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
/// Write
@ -360,6 +368,9 @@ bool write_PLY(std::ostream& out,
#ifndef DOXYGEN_RUNNING
,typename boost::enable_if<
typename boost::has_range_const_iterator<PointRange>::type
>::type* =0,
typename std::enable_if<
boost::has_value_type<PointRange>::value
>::type* =0
#endif
)