Merge pull request #217 from bo0ts/Surface_mesh-drop_fusion-pmoeller

Drop Boost.Fusion from Surface_mesh
This commit is contained in:
Laurent Rineau 2015-07-31 14:27:30 +02:00
commit 70c08ae2bf
6 changed files with 44 additions and 34 deletions

View File

@ -22,7 +22,7 @@
#define CGAL_PROPERTIES_SURFACE_MESH_H #define CGAL_PROPERTIES_SURFACE_MESH_H
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/Surface_mesh/Surface_mesh.h> #include <CGAL/Surface_mesh.h>
#include <CGAL/Kernel_traits.h> #include <CGAL/Kernel_traits.h>
#include <CGAL/squared_distance_3.h> #include <CGAL/squared_distance_3.h>

View File

@ -1,8 +1,8 @@
#include "test_Prefix.h" #include "test_Prefix.h"
#include <boost/range/distance.hpp>
#include <CGAL/boost/graph/Euler_operations.h> #include <CGAL/boost/graph/Euler_operations.h>
template <typename T> template <typename T>
void void
join_face_test() join_face_test()

View File

@ -7,8 +7,6 @@
#include <fstream> #include <fstream>
#include <CGAL/boost/graph/properties.h> #include <CGAL/boost/graph/properties.h>
#include <boost/assign.hpp>
#include <boost/mpl/list.hpp>
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>

View File

@ -19,8 +19,8 @@
#ifndef CGAL_TOP_LEVEL_SURFACE_MESH_H #ifndef CGAL_TOP_LEVEL_SURFACE_MESH_H
#define CGAL_TOP_LEVEL_SURFACE_MESH_H #define CGAL_TOP_LEVEL_SURFACE_MESH_H
#include "CGAL/Surface_mesh/Surface_mesh_fwd.h" #include <CGAL/Surface_mesh/Surface_mesh_fwd.h>
#include "CGAL/Surface_mesh/Surface_mesh.h" #include <CGAL/Surface_mesh/Surface_mesh.h>
#ifdef DOXYGEN_RUNNING #ifdef DOXYGEN_RUNNING
namespace CGAL { namespace CGAL {

View File

@ -32,10 +32,6 @@
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/array.hpp> #include <boost/array.hpp>
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/fusion/container/map.hpp>
#include <boost/fusion/include/map.hpp>
#include <boost/fusion/include/at_key.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/property_map/property_map.hpp> #include <boost/property_map/property_map.hpp>
@ -2249,16 +2245,40 @@ public:
private: //--------------------------------------------------- property handling private: //--------------------------------------------------- property handling
/// @cond BROKEN_DOC // Property_selector maps an index type to a property_container, the
typedef boost::fusion::map< // dummy is necessary to make it a partial specialization (full
boost::fusion::pair< typename Surface_mesh::Vertex_index, Property_container<Vertex_index> (Surface_mesh::*)>, // specializations are only allowed at namespace scope).
boost::fusion::pair< typename Surface_mesh::Halfedge_index, Property_container<Halfedge_index> (Surface_mesh::*)>, template<typename, bool = true>
boost::fusion::pair< typename Surface_mesh::Edge_index, Property_container<Edge_index> (Surface_mesh::*)>, struct Property_selector {};
boost::fusion::pair< typename Surface_mesh::Face_index, Property_container<Face_index> (Surface_mesh::*)> >
map_type;
map_type pmap_; template<bool dummy>
/// @endcond struct Property_selector<typename CGAL::Surface_mesh<P>::Vertex_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Vertex_index>&
operator()() { return m_->vprops_; }
};
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Halfedge_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Halfedge_index>&
operator()() { return m_->hprops_; }
};
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Edge_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Edge_index>&
operator()() { return m_->eprops_; }
};
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Face_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Face_index>&
operator()() { return m_->fprops_; }
};
public: public:
@ -2290,9 +2310,9 @@ private: //--------------------------------------------------- property handling
template<class I, class T> template<class I, class T>
std::pair<Property_map<I, T>, bool> std::pair<Property_map<I, T>, bool>
add_property_map(const std::string& name, const T t=T()) { add_property_map(const std::string& name, const T t=T()) {
return (this->*boost::fusion::at_key<I>(pmap_)).template add<T>(name, t); return Property_selector<I>(this)().template add<T>(name, t);
} }
@ -2303,7 +2323,7 @@ private: //--------------------------------------------------- property handling
template <class I, class T> template <class I, class T>
std::pair<Property_map<I, T>,bool> property_map(const std::string& name) const std::pair<Property_map<I, T>,bool> property_map(const std::string& name) const
{ {
return (this->*boost::fusion::at_key<I>(pmap_)).template get<T>(name); return Property_selector<I>(const_cast<Surface_mesh*>(this))().template get<T>(name);
} }
@ -2312,7 +2332,7 @@ private: //--------------------------------------------------- property handling
template<class I, class T> template<class I, class T>
void remove_property_map(Property_map<I, T>& p) void remove_property_map(Property_map<I, T>& p)
{ {
(this->*boost::fusion::at_key<I>(pmap_)).remove(p); (Property_selector<I>(this)()).remove(p);
} }
/// @cond CGAL_DOCUMENT_INTERNALS /// @cond CGAL_DOCUMENT_INTERNALS
@ -2325,16 +2345,16 @@ private: //--------------------------------------------------- property handling
template<class I> template<class I>
const std::type_info& property_type(const std::string& name) const std::type_info& property_type(const std::string& name)
{ {
return (this->*boost::fusion::at_key<I>(pmap_)).get_type(name); return Property_selector<I>(this)().get_type(name);
} }
/// @endcond /// @endcond
/// returns a vector with all strings that describe properties with the key type `I`. /// returns a vector with all strings that describe properties with the key type `I`.
/// @tparam I The key type of the properties. /// @tparam I The key type of the properties.
template<class I> template<class I>
std::vector<std::string> properties() const std::vector<std::string> properties() const
{ {
return (this->*boost::fusion::at_key<I>(pmap_)).properties(); return Property_selector<I>(this)().properties();
} }
/// returns the property for the string "v:point". /// returns the property for the string "v:point".
@ -2526,10 +2546,6 @@ private: //------------------------------------------------------- private data
template <typename P> template <typename P>
Surface_mesh<P>:: Surface_mesh<P>::
Surface_mesh() Surface_mesh()
: pmap_(boost::fusion::make_pair< typename Surface_mesh::Vertex_index >(&Surface_mesh::vprops_)
, boost::fusion::make_pair< typename Surface_mesh::Halfedge_index >(&Surface_mesh::hprops_)
, boost::fusion::make_pair< typename Surface_mesh::Edge_index >(&Surface_mesh::eprops_)
, boost::fusion::make_pair< typename Surface_mesh::Face_index >(&Surface_mesh::fprops_))
{ {
// allocate standard properties // allocate standard properties
// same list is used in operator=() and assign() // same list is used in operator=() and assign()
@ -2555,8 +2571,6 @@ operator=(const Surface_mesh<P>& rhs)
{ {
if (this != &rhs) if (this != &rhs)
{ {
pmap_ = rhs.pmap_;
// deep copy of property containers // deep copy of property containers
vprops_ = rhs.vprops_; vprops_ = rhs.vprops_;
hprops_ = rhs.hprops_; hprops_ = rhs.hprops_;

View File

@ -18,8 +18,6 @@
#ifndef CGAL_SURFACE_MESH_FWD_H #ifndef CGAL_SURFACE_MESH_FWD_H
#define CGAL_SURFACE_MESH_FWD_H #define CGAL_SURFACE_MESH_FWD_H
#include <string>
/// \file Surface_mesh_fwd.h /// \file Surface_mesh_fwd.h
/// Forward declarations of the Surface_mesh package. /// Forward declarations of the Surface_mesh package.