$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: huseyinakcan_at_[hidden]
Date: 2007-07-11 17:29:26
Author: huseyinakcan
Date: 2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
New Revision: 7408
URL: http://svn.boost.org/trac/boost/changeset/7408
Log:
selector classes for hds, facet, and vertex. Plus configuration class for
hds and a stored_halfedge implementation based on these configurations.
Added:
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_ds.hpp
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_gen.hpp
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/hds_selectors.hpp
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp
Text files modified: 
   sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds.hpp |     2 +-                                      
   1 files changed, 1 insertions(+), 1 deletions(-)
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds.hpp	(original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds.hpp	2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
@@ -7,7 +7,7 @@
 //  
 //@SEE_ALSO: {hds_concepts.hpp}
 //
-//@DESCRIPTION: This file provide a single class template, 'halfedge_ds', which
+//@DESCRIPTION: This file provides a single class template, 'halfedge_ds', which
 // accepts many template parameters that can be used to govern its
 // implementation.  Most of these parameters can be chosen as selectors (see
 // 'hds_selectors' component).
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/facet_selectors.hpp	2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
@@ -0,0 +1,32 @@
+//facet_selectors.hpp   -*- C++ -*-
+//
+//@PURPOSE: Provide selector classes for 'FacetS'.
+//
+//@CLASSES:
+//  'facetS':  defines configuration options for facet access
+//  
+//@SEE_ALSO: {hds_concepts.hpp, halfedge_ds.hpp}
+//
+//@DESCRIPTION: This file provides the 'facetS' selector class for
+//configurations related to facet properties. 
+
+#ifndef BOOST_HDSTL_FACET_SELECTORS_HPP
+#define BOOST_HDSTL_FACET_SELECTORS_HPP 1
+
+namespace boost;
+namespace hdstl;
+
+template<typename Selector>
+struct facetS {
+    typedef false_type is_rand_access;
+};
+
+template<>
+struct facets<vecS> {
+    typedef true_type is_rand_access;
+};
+
+} // namespace hdstl
+} // namespace boost
+
+#endif
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_ds.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_ds.hpp	2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
@@ -0,0 +1,133 @@
+//halfedge_ds.hpp   -*- C++ -*-
+//
+//@PURPOSE: Provide a concrete bu parameterizable implementation of HDS.
+//
+//@CLASSES:
+//  'halfedge_ds_gen':  defines configuration options in a central place
+//  'container_gen':  class for selecting the storage type of 'halfedge_ds'
+//  'opposite_helper':  class for configuring opposite access methods
+//  'halfedge_ds':  swiss-army knife of HDS implementations
+//  
+//@SEE_ALSO: {hds_concepts.hpp, halfedge_ds.hpp}
+//
+//@DESCRIPTION: This file provides a single class template, 'halfedge_ds', which
+// accepts many template parameters that can be used to govern its
+// implementation.  Most of these parameters can be chosen as selectors (see
+// 'hds_selectors' component).
+//
+///Definition
+//-----------
+// - 'halfedge_ds_gen' this class defines the 'config' subtype and keeps
+//   the configuration parameters of the 'HDS' in a central place. The 
+//   configurations are obtained based on selectors 'HalfedgeS', 'VertexS', 
+//   and 'FacetS'. 
+// - 'opposite_helper' this class configures the opposite access method, based
+//   on the storage type. Do not use and opposite method and manually calculates
+//   the opposite if the storage is 'stl::vector' type, otherwise uses the 
+//   defined 'opposite' member.
+// - 'halfedge_ds' concerete implementation of the 'HDS'.  
+
+#ifndef BOOST_HDSTL_HALFEDGE_DS_HPP
+#define BOOST_HDSTL_HALFEDGE_DS_HPP 1
+
+#include <boost/pending/ct_if.hpp>
+
+namespace boost {
+namespace hdstl {
+template <typename HalfedgeS, typename VertexS, typename FacetS>
+struct halfedge_ds_gen {
+    struct config {
+        typedef  boost::ct_if_t<mpl::equal<HalfedgeS::container_type, vecS>,
+                           false_type, true_type> halfedge_has_opposite_member;
+        typedef HalfedgeS::is_forward is_forward;
+        typedef HalfedgeS::is_backward is_backward;
+        typedef HalfedgeS::is_bidir is_bidir;
+        typedef HalfedgeS::tag traversal_tag;
+            // halfedge config
+
+        typedef boost::ct_if_t<mpl::equal<VertexS,noVertexS>, 
+                             false_type, true_type> halfedge_supports_vertices;
+        typedef VertexS::is_source is_source;
+        typedef VertexS::is_target is_target;
+        typedef VertexS::has_vertex_links has_vertex_links;
+            // vertex config
+        
+        typedef boost::ct_if_t<mpl::equal<FacetS,noFacetS>, 
+                               false_type, true_type> halfedge_supports_facets;
+            // facet config
+
+        
+    };
+};
+
+
+template <typename Selector, typename ValueType>
+struct container_gen { };
+
+template <typename ValueType>
+struct container_gen<listS, ValueType> {
+    typedef std::list<ValueType> type;
+    typedef false_type is_rand_access;
+};
+
+template <typename ValueType>
+struct container_gen<vecS, ValueType> {
+    typedef std::vector<ValueType> type;
+    typedef true_type is_rand_access;
+};
+
+} // namespace detail
+
+
+template<typename Selector, typename HalfedgeDescriptor>
+struct opposite_helper {
+    inline static
+    HalfedgeDescriptor&
+    opposite(HalfedgeDescriptor& h)
+    {
+        // halfedges come in pairs, point to each other as
+        // opposite. If halfedges stored in a list, use the
+        // opposite pointer.
+        return h->opposite_;
+    }
+};
+
+template<typename HalfedgeDescriptor>
+struct opposite_helper<vecS, HalfedgeDescriptor> {
+    inline static
+    HalfedgeSescriptor&
+    opposite(HalfedgeDescriptor& h)
+    {
+        // halfedges come in pairs, point to each other as
+        // opposite. If halfedges stored in a vector:
+        if (h%2==0)
+            return h+1;
+        else
+            return h-1;
+    }
+
+
+template <typename HalfedgeS = halfedgeS<vecS, forwardS<next_in_facet_tag> >,
+          typename VertexS = vertexS<vecS, vertexLinkS, sourceS>,
+          typename FacetS = facetS<vecS> >
+class halfedge_ds
+{
+    typedef void* halfedge_ptr; 
+
+    typedef typename  container_gen<HalfedgeS, halfedge_ptr
+                                                   >::is_random is_rand_access;
+
+    typedef typename boost::ct_if_t<is_rand_access,
+                          std::size_t, halfedge_ptr>::type halfedge_descriptor;
+
+    typedef typename  container_gen<HalfedgeS, halfedge_ptr>::type 
+                                                                  HalfedgeList;
+
+    typedef typename HalfedgeList::iterator halfedge_iterator;
+
+};
+
+} // namespace hdstl
+} // namespace boost
+
+#endif
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_gen.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/halfedge_gen.hpp	2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
@@ -0,0 +1,139 @@
+//halfedge_gen.hpp   -*- C++ -*-
+//
+//@PURPOSE: Provide a concrete implementation of 'stored_halfedge' based on various configurations of 'halfedge_ds'.
+//
+//@CLASSES:
+//  'stored_halfedge':  implementation of halfedge
+//  'opposite_helper':  class for configuring opposite access methods
+//  'vertex_helper':    class for configuring vertex access methods
+//  'facet_helper':     class for configuring facet access methods
+//  'traversal_helper': class for configuring traversal methods
+//  
+//@SEE_ALSO: {hds_concepts.hpp, halfedge_ds.hpp}
+//
+//@DESCRIPTION: This file provide a single class template, 'stored_halfedge',
+//and the helper classes, which accepts many template parameters that can be
+//used to govern its implementation.  These parameters can be chosen using the
+//'Config' class members (see 'halfedge_ds' component).
+//
+///Definition
+///----------
+//  - 'stored_halfedge'  This class inherits from four helper classes, 
+//    'opposite_helper', 'vertex_helper', 'facet_helper', 'traversal_helper'.
+//    Based on the configurations of these classes, members are added or omited
+//    from 'stored_halfedge' for optimization purposes.
+//  - 'vertex_helper' If vertices are supported in the 'halfedge_ds', this class
+//    defines 'source' or 'target' members, based on the configuration
+//    options. If vertices are not supported, this class does not define a 
+//    vertex access member.
+//  - 'facet_helper' If facets are supported in the 'halfedge_ds', this class
+//    defines facet members, based on the configuration
+//    options. If facets are not supported, this class does not define a 
+//    facet access member.
+//  - 'traversal_helper' Based on the traversal configuration, this class
+//    defines 'm_next', 'm_prev' or both traversal access members.
+
+
+#ifndef BOOST_HDSTL_HALFEDGE_GEN_HPP
+#define BOOST_HDSTL_HALFEDGE_GEN_HPP 1
+
+#include <boost/hdstl/halfedge_ds/halfedge_ds.hpp>
+
+namespace boost {
+namespace hdstl {
+
+template<typename has_opposite_member, typename HalfedgeDescriptor>
+struct opposite_helper 
+{
+};
+
+template<typename HalfedgeDescriptor>
+struct opposite_helper<true_type, HalfedgeDescriptor> 
+{
+    HalfedgeDescriptor m_opposite;
+};
+
+template<typename is_source, typename VertexDescriptor>
+struct source_helper 
+{
+};
+
+struct source_helper<true_type, VertexDescriptor> 
+{
+    VertexDescriptor m_source;
+};
+
+template<typename is_target, typename VertexDescriptor>
+struct target_helper 
+{
+};
+
+struct target_helper<true_type, VertexDescriptor> 
+{
+    VertexDescriptor m_target;
+};
+
+template<typename supports_vertices, typename is_source, typename is_target,
+                                                     typename VertexDescriptor>
+struct vertex_helper 
+{
+};
+
+template<typename is_source, typename is_target, typename VertexDescriptor>
+struct vertex_helper<true_type, is_source, is_target, VertexDescriptor> 
+: public source_helper<is_source>,
+: public target_helper<is_target> {
+};
+
+template<typename supports_facets, typename FacetDescriptor>
+struct facet_helper 
+{
+};
+
+template<typename FacetDescriptor>
+struct facet_helper<true_type, FacetDescriptor>
+{
+    FacetDescriptor m_facet;
+};
+
+template<typename is_forward, typename is_backward, typename isbidir, 
+                                                   typename HalfedgeDescriptor>
+struct traversal_helper 
+{
+};
+
+template<typename is_backward, typename isbidir, typename HalfedgeDescriptor>
+struct traversal_helper<true_type, false_type, false_type, HalfedgeDescriptor> 
+{
+    HalfedgeDescriptor m_next;
+};
+
+template<typename is_forward, typename isbidir, typename HalfedgeDescriptor>
+struct traversal_helper<false_type, true_type, false_type, HalfedgeDescriptor> 
+{
+    HalfedgeDescriptor m_prev;
+};
+
+template<typename is_forward, typename is_backward, typename HalfedgeDescriptor>
+struct traversal_helper<false_type, false_type, true_type, HalfedgeDescriptor>
+: traversal_helper<true_type,false_type,false_type,HalfedgeDescriptor>,
+: traversal_helper<false_type,true_type,false_type,HalfedgeDescriptor>
+{
+};
+
+template<typename HalfedgeDescriptor, typename VertexDescriptor, 
+                                     typename FacetDescriptor, typename Config>
+struct stored_halfedge 
+: public opposite_helper<Config::halfedge_has_opposite_member, 
+                                                           HalfedgeDescriptor>,
+: public vertex_helper<Config::is_source, Config::is_target, VertexDescriptor>,
+: public facet_helper<Config::halfedge_supports_facets, FacetDescriptor>,
+: public traversal_helper<Config::is_forward, Config::is_backward, 
+                                          Config::is_bidir, HalfedgeDescriptor>
+{
+};
+
+} // namespace hdstl
+} // namespace boost
+
+#endif
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/hds_selectors.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/hds_selectors.hpp	2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
@@ -0,0 +1,63 @@
+//hds_selectors.hpp   -*- C++ -*-
+//
+//@PURPOSE: Provide selector classes for 'HalfedgeS'.
+//
+//@CLASSES:
+//  'forwardS':  defines configuration options for forward access
+//  'backwardS':  defines configuration options for backward access
+//  'bidirS':  defines configuration options for bidirectional access
+//  'halfedgeS':  inherits the options from one of 'forwardS', 'backwardS', or
+//   'bidirS', and defined the container type.
+//  
+//@SEE_ALSO: {hds_concepts.hpp, halfedge_ds.hpp}
+//
+//@DESCRIPTION: This file provides the halfedgeS selector class for
+//configurations related to halfedge properties. Uses the 'forwardS',
+//'backwardS' and 'bidirS' selector classes to inherit the configuration
+//options based on the traversal type.
+
+#ifndef BOOST_HDSTL_HDS_SELECTORS_HPP
+#define BOOST_HDSTL_HDS_SELECTORS_HPP 1
+
+namespace boost;
+namespace hdstl;
+
+template <typename ForwardCategory>
+struct forwardS {
+    typedef forward_traversal_tag tag;
+    typedef ForwardCategory next_tag;
+    typedef true_type is_forward;
+    typedef false_type is_backward;
+    typedef false_type is_bidir;
+};
+
+template <typename BackwardCategory>
+struct backwardS {
+    typedef backward_traversal_tag tag;
+    typedef BackwardCategory prev_tag;
+    typedef false_type is_forward;
+    typedef true_type is_backward;
+    typedef false_type is_bidir;
+};
+
+template <typename ForwardCategory, typename BackwardCategory>
+struct bidirS {
+    typedef bidirectional_traversal_tag tag;
+    typedef ForwardCategory next_tag;
+    typedef BackwardCategory prev_tag;
+    typedef false_type is_forward;
+    typedef false_type is_backward;
+    typedef true_type is_bidir;
+};
+
+template <typename Selector, 
+          typename TraversalS = forwardS<next_in_facet_tag> >
+struct halfedgeS 
+: public TraversalS {
+    typedef Selector container_type;
+};
+
+} // namespace hdstl
+} // namespace boost
+
+#endif
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/halfedge_ds/vertex_selectors.hpp	2007-07-11 17:29:25 EDT (Wed, 11 Jul 2007)
@@ -0,0 +1,76 @@
+//vertex_selectors.hpp   -*- C++ -*-
+//
+//@PURPOSE: Provide selector classes for 'VertexS'.
+//
+//@CLASSES:
+//  'vertexS':  defines configuration options for vertex access
+//  'noVertexS' defines that vertices are not supported by the 'HDS'
+//  'vertexLinkS' reverse links from vertices to a halfedge is defined
+//  'noVertexLinkS' reverse links from vertices to halfedges not defined
+//  'sourceS'  default vertex access method for halfedges is set to source
+//  'targetS'  default vertex access method for halfedges is set to target
+//  'base_vertex' base class to select the method of access between source and
+//   target
+//  
+//@SEE_ALSO: {hds_concepts.hpp, halfedge_ds.hpp}
+//
+//@DESCRIPTION: This file provides the vertexS selector class for
+//configurations related to vertex properties. Uses the 'noVertexS',
+//'vertexLinkS', 'noVertexLinkS', 'sourceS', 'targetS', and 'base_vertex'
+//selector classes to configure options based on the vertex access type.
+
+#ifndef BOOST_HDSTL_VERTEX_SELECTORS_HPP
+#define BOOST_HDSTL_VERTEX_SELECTORS_HPP 1
+
+namespace boost;
+namespace hdstl;
+
+struct noVertexS { };
+
+struct vertexLinkS { };
+
+struct noVertexLinkS { };
+
+struct sourceS { };
+
+struct targetS { };
+
+template <typename VertexType>
+struct base_vertexS {};
+
+template<>
+struct base_vertexS<sourceS>{
+    typedef true_type type;
+    typedef true_type is_source;
+    typedef false_type is_target;
+}
+
+template<>
+struct base_vertexS<targetS>{
+    typedef false_type type;
+    typedef false_type is_source;
+    typedef true_type is_target;
+}
+
+template <typename Selector, VertexLinkType, VertexType>
+struct vertexS 
+: base_vertexS<VertexType> 
+{ 
+};
+
+template<typename Selector, VertexType>
+struct vertexS<Selector, vertexLinkS, VertexType> 
+: base_vertexS<VertexType> {
+    typedef true_type has_vertex_links;
+};
+
+template<typename Selector, VertexType>
+struct vertexS<Selector, noVertexLinkS, VertexType> 
+: base_vertexS<VertexType> {
+    typedef false_type has_vertex_links;
+};
+
+} // namespace hdstl
+} // namespace boost
+
+#endif