|
Boost-Commit : |
From: huseyinakcan_at_[hidden]
Date: 2007-06-28 12:06:55
Author: huseyinakcan
Date: 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
New Revision: 7297
URL: http://svn.boost.org/trac/boost/changeset/7297
Log:
{forward, backward, bidirectional} concept test classes
Added:
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.t.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.t.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.cpp
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.t.cpp
Text files modified:
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_archetypes/hds_concept_archetype.hpp | 4 ++--
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp | 26 ++++++++++++++------------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp | 23 +++++++++++++----------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp | 2 +-
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp | 4 ++--
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp | 20 ++++++++++++--------
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp | 10 +++++-----
sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp | 1 +
8 files changed, 50 insertions(+), 40 deletions(-)
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_archetypes/hds_concept_archetype.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_archetypes/hds_concept_archetype.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_archetypes/hds_concept_archetype.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -53,8 +53,8 @@
class HDSConcept_archetype {
// This archetype class for the 'HDSConcept' class can be used wherever a
- // template parameter of a class or of a function template is required to be a
- // model of the 'HDS' concept, in order to ensure that no further
+ // template parameter of a class or of a function template is required to
+ // be a model of the 'HDS' concept, in order to ensure that no further
// requirements are placed on the template parameter than are stated in the
// 'HDS' concept.
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -0,0 +1,4 @@
+// backward_hds_concept.cpp -*- C++ -*-
+
+#include <boost/hdstl/hds_concepts/backward_hds_concept.hpp>
+
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -15,7 +15,7 @@
// argument is a model of the HDS concept described on the page
// [backwardhds].
//
-//@CONCEPT: [backwardhdsconcept] Backward HDS concept
+//@CONCEPT: [backwardhds] Backward HDS concept
//
///Definition
///----------
@@ -121,18 +121,21 @@
// h = prev_at_source(h, hds);
// h = prev_at_target(h, hds);
// }
-// BackwardHDS hds;
-// halfedge_descriptor h;
-// halfedge_descriptor g;
+// HDS hds;
+// halfedge_descriptor h,g;
// };
//..
#ifndef BOOST_HDSTL_CONCEPTS_BACKWARD_HDS_CONCEPT_HPP
#define BOOST_HDSTL_CONCEPTS_BACKWARD_HDS_CONCEPT_HPP 1
+#include <boost/concept_check.hpp>
+#include <boost/hdstl/hds_traits.hpp>
+#include <boost/hdstl/hds_concepts/hds_concept.hpp>
+
namespace boost {
-namespace hdstl{
-namespace concepts{
+namespace hdstl {
+namespace concepts {
template <class HDS>
struct BackwardHDSConcept {
@@ -148,12 +151,12 @@
// inside a class definition body, should trigger a compile-time error
// if the type HDS does not model the 'BackwardHDSConcept'.
- // OPAQUE TYPES
+ // TYPES
typedef typename hds_traits<HDS>::halfedge_descriptor halfedge_descriptor;
typedef typename hds_traits<HDS>::traversal_category traversal_category;
typedef typename hds_traits<HDS>::backward_category backward_category;
- // OPAQUE MANIPULATORS
+ // MANIPULATORS
void constraints()
// Check that the 'HDS' template parameter satisfies all the
// constraints of 'BackwardHDSConcept' on page
@@ -175,7 +178,7 @@
const_constraints(hds);
}
- // OPAQUE ACCESSORS
+ // ACCESSORS
void const_constraints(HDS const& hds)
// Check that the non-modifiable 'HDS' template parameters
// satisfies all the constraints of 'BackwardHDSConcept'.
@@ -187,9 +190,8 @@
private:
// DATA
- BackwardHDS hds; // a halfedge data structure object
- halfedge_descriptor h; // a halfedge descriptor
- halfedge_descriptor g; // another halfedge descriptor
+ HDS hds; // a halfedge data structure object
+ halfedge_descriptor h,g; // halfedge descriptors
};
} // close namespace concepts
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/backward_hds_concept.t.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -0,0 +1,124 @@
+//backward_hds_concept.t.cpp -*- C++ -*-
+//
+//@OVERVIEW: The component under test is a concept-checking class. We
+// proceed with the standard test plan for such a class.
+//
+//@TEST_PLAN: Create a (loose) archetype of the concept, and verify
+// (using the Boost.ConceptCheck library macros) that it satisfies all
+// the concept requirements of the concept. Note that the purpose of
+// this test driver is to verify the validity of the concept checking
+// class, not of the archetype. This is why it suffices to take the
+// 'halfedge_descriptor' as an 'int', although a real archetype would make
+// this into a custom-made class with the tailored minimal requirements.
+
+#include <boost/hdstl/hds_concepts/backward_hds_concept.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/concept_check.hpp>
+
+namespace hdstl1 {
+
+ struct TT : public boost::hdstl::backward_traversal_tag {};
+
+ template<typename BackwardCategory>
+ struct backward_hds_archetype {
+ // This 'struct', intentionally defined in a namespace different from
+ // 'hdstl', the 'hds_traits' specialization defined in the namespace
+ // 'hdstl', and the supporting functions 'opposite', 'prev_in_facet',
+ // 'prev_at_source', and 'prev_at_target' defined in the same
+ // namespace as this 'struct' to take advantage of ADL
+ // (argument-dependent lookup) provide an archetype for the 'BackwardHDS'
+ // concept.
+
+ typedef int halfedge_descriptor;
+ typedef TT traversal_category;
+ typedef BackwardCategory backward_category;
+ };
+
+ template<typename BackwardCategory>
+ typename backward_hds_archetype<BackwardCategory>::halfedge_descriptor
+ opposite(typename backward_hds_archetype<BackwardCategory>
+ ::halfedge_descriptor h,
+ const backward_hds_archetype<BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename BackwardCategory>
+ typename backward_hds_archetype<BackwardCategory>::halfedge_descriptor
+ prev_in_facet(typename backward_hds_archetype<BackwardCategory>
+ ::halfedge_descriptor h,
+ const backward_hds_archetype<BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename BackwardCategory>
+ typename backward_hds_archetype<BackwardCategory>::halfedge_descriptor
+ prev_at_source(typename backward_hds_archetype<BackwardCategory>
+ ::halfedge_descriptor h,
+ const backward_hds_archetype<BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename BackwardCategory>
+ typename backward_hds_archetype<BackwardCategory>::halfedge_descriptor
+ prev_at_target(typename backward_hds_archetype<BackwardCategory>
+ ::halfedge_descriptor h,
+ const backward_hds_archetype<BackwardCategory>&)
+ {
+ return h;
+ }
+
+} // namespace hdstl
+
+namespace boost {
+namespace hdstl {
+
+ template <typename BackwardCategory>
+ struct hds_traits<hdstl1::backward_hds_archetype<BackwardCategory> >
+ {
+ typedef typename hdstl1::backward_hds_archetype<BackwardCategory>
+ ::halfedge_descriptor
+ halfedge_descriptor;
+ typedef typename hdstl1::backward_hds_archetype<BackwardCategory>
+ ::traversal_category
+ traversal_category;
+ typedef typename hdstl1::backward_hds_archetype<BackwardCategory>
+ ::backward_category
+ backward_category;
+ enum { supports_vertices = false};
+ static const int supports_facets = true;
+ };
+
+} // namespace hdstl
+} // namespace boost
+
+// ===========================================================================
+// BOOST TEST APPARATUS
+// ===========================================================================
+
+template <class HDS>
+struct class_concept_requirements
+{
+ BOOST_CLASS_REQUIRE(HDS, boost::hdstl::concepts, BackwardHDSConcept);
+};
+
+template <class HDS>
+bool concept_requirements()
+{
+ boost::function_requires<boost::hdstl::concepts::BackwardHDSConcept<HDS> >();
+ class_concept_requirements<HDS>(); // force instantiation
+ return true;
+}
+
+int test_main(int, char **)
+{
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::backward_hds_archetype<boost::hdstl::prev_in_facet_tag> >() ));
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::backward_hds_archetype<boost::hdstl::prev_at_source_tag> >() ));
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::backward_hds_archetype<boost::hdstl::prev_at_target_tag> >() ));
+ return 0;
+}
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -0,0 +1,4 @@
+// bidirectional_hds_concept.cpp -*- C++ -*-
+
+#include <boost/hdstl/hds_concepts/bidirectional_hds_concept.hpp>
+
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -14,9 +14,9 @@
//..
// inside a class body, checks whether the type given as template
// argument is a model of the HDS concept described on the page
-// [bidirectionalhdsconcept].
+// [bidirectionalhds].
//
-//@CONCEPT: [bidirectionalhdsconcept] Bidirectional HDS concept
+//@CONCEPT: [bidirectionalhds] Bidirectional HDS concept
//
///Definition
///-----------
@@ -91,18 +91,21 @@
// }
// void const_constraints(HDS const& hds) {
// }
-// BidirectionalHDS hds;
+// HDS hds;
// };
//..
#ifndef BOOST_HDSTL_CONCEPTS_BIDIRECTIONAL_HDS_CONCEPT_HPP
#define BOOST_HDSTL_CONCEPTS_BIDIRECTIONAL_HDS_CONCEPT_HPP 1
-#include <boost/concepts.h>
+#include <boost/concept_check.hpp>
+#include <boost/hdstl/hds_traits.hpp>
+#include <boost/hdstl/hds_concepts/forward_hds_concept.hpp>
+#include <boost/hdstl/hds_concepts/backward_hds_concept.hpp>
namespace boost {
-namespace hdstl{
-namespace concepts{
+namespace hdstl {
+namespace concepts {
template <class HDS>
struct BidirectionalHDSConcept {
@@ -118,7 +121,7 @@
// inside a class definition body, should trigger a compile-time error
// if the type HDS does not model the 'BidirectionalHDSConcept'.
- // OPAQUE TYPES
+ // TYPES
typedef typename hds_traits<HDS>::halfedge_descriptor halfedge_descriptor;
typedef typename hds_traits<HDS>::traversal_category traversal_category;
typedef typename hds_traits<HDS>::forward_category forward_category;
@@ -128,7 +131,7 @@
// description of the 'BidirectionalHDS' concept on page
// [bidirectionalhdsconcept].
- // OPAQUE MANIPULATORS
+ //MANIPULATORS
void constraints()
// Check that the 'HDS' template parameter satisfies all the
// constraints of 'BidirectionalHDSConcept' on page
@@ -141,7 +144,7 @@
bidirectional_traversal_tag> >();
}
- // OPAQUE ACCESSORS
+ // ACCESSORS
void const_constraints(HDS const& hds)
// Check that the non-modifiable 'HDS' template parameters
// satisfies all the constraints of 'BidirectionalHDSConcept'.
@@ -150,7 +153,7 @@
private:
//DATA
- BidirectionalHDS hds; // a halfedge data structure object
+ HDS hds; // a halfedge data structure object
};
} // close namespace concepts
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/bidirectional_hds_concept.t.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -0,0 +1,174 @@
+//bidirectional_hds_concept.t.cpp -*- C++ -*-
+//
+//@OVERVIEW: The component under test is a concept-checking class. We
+// proceed with the standard test plan for such a class.
+//
+//@TEST_PLAN: Create a (loose) archetype of the concept, and verify
+// (using the Boost.ConceptCheck library macros) that it satisfies all
+// the concept requirements of the concept. Note that the purpose of
+// this test driver is to verify the validity of the concept checking
+// class, not of the archetype. This is why it suffices to take the
+// 'halfedge_descriptor' as an 'int', although a real archetype would make
+// this into a custom-made class with the tailored minimal requirements.
+
+#include <boost/hdstl/hds_concepts/bidirectional_hds_concept.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/concept_check.hpp>
+
+namespace hdstl1 {
+
+ struct TT : public boost::hdstl::bidirectional_traversal_tag {};
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ struct bidirectional_hds_archetype {
+ // This 'struct', intentionally defined in a namespace different from
+ // 'hdstl', the 'hds_traits' specialization defined in the namespace
+ // 'hdstl', and the supporting functions 'opposite', 'next_in_facet',
+ // 'next_at_source', and 'next_at_target' defined in the same
+ // namespace as this 'struct' to take advantage of ADL
+ // (argument-dependent lookup) provide an archetype for the 'ForwardHDS'
+ // concept.
+
+ typedef int halfedge_descriptor;
+ typedef TT traversal_category;
+ typedef ForwardCategory forward_category;
+ typedef BackwardCategory backward_category;
+ };
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ opposite(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ next_in_facet(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ next_at_source(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ next_at_target(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ prev_in_facet(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ prev_at_source(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory, typename BackwardCategory>
+ typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ prev_at_target(typename bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor h,
+ const bidirectional_hds_archetype<ForwardCategory, BackwardCategory>&)
+ {
+ return h;
+ }
+} // namespace hdstl
+
+namespace boost {
+namespace hdstl {
+
+ template <typename ForwardCategory, typename BackwardCategory>
+ struct hds_traits<hdstl1::bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory> >
+ {
+ typedef typename hdstl1::bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::halfedge_descriptor
+ halfedge_descriptor;
+
+ typedef typename hdstl1::bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::traversal_category
+ traversal_category;
+
+ typedef typename hdstl1::bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::forward_category
+ forward_category;
+
+ typedef typename hdstl1::bidirectional_hds_archetype<
+ ForwardCategory, BackwardCategory>::backward_category
+ backward_category;
+
+ enum { supports_vertices = false};
+ static const int supports_facets = true;
+ };
+
+} // namespace hdstl
+} // namespace boost
+
+// ===========================================================================
+// BOOST TEST APPARATUS
+// ===========================================================================
+
+template <class HDS>
+struct class_concept_requirements
+{
+ BOOST_CLASS_REQUIRE(HDS, boost::hdstl::concepts, BidirectionalHDSConcept);
+};
+
+template <class HDS>
+bool concept_requirements()
+{
+ boost::function_requires<boost::hdstl::concepts::BidirectionalHDSConcept<HDS> >();
+ class_concept_requirements<HDS>(); // force instantiation
+ return true;
+}
+
+int test_main(int, char **)
+{
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::bidirectional_hds_archetype<
+ boost::hdstl::next_in_facet_tag,
+ boost::hdstl::prev_in_facet_tag> >() ));
+
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::bidirectional_hds_archetype<
+ boost::hdstl::next_at_source_tag,
+ boost::hdstl::prev_at_source_tag> >() ));
+
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::bidirectional_hds_archetype<
+ boost::hdstl::next_at_target_tag,
+ boost::hdstl::prev_at_target_tag> >() ));
+ return 0;
+}
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_hds_concept.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -30,7 +30,7 @@
///--------
// - 'HDS' A type that is a model of FacetHDSConcept
// - 'hds' A non-modifiable instance of HDS
-// - 'h' Halfedge descriptor, of type 'hds_traits<HDS>::halfedge_descriptor'
+// - 'h' Halfedge descriptor,of type 'hds_traits<HDS>::halfedge_descriptor'
// - 'f' Facet descriptor, of type 'hds_traits<HDS>::facet_descriptor'
//
///Associated types
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/facet_list_hds_concept.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -109,8 +109,8 @@
// f = *b;
// n = num_facets(hds);
// }
-// private:
-// FacetListHDS hds;
+// private:
+// HDS hds;
// facet_descriptor f;
// facet_iterator b;
// facet_iterator e;
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -0,0 +1,4 @@
+// forward_hds_concept.cpp -*- C++ -*-
+
+#include <boost/hdstl/hds_concepts/forward_hds_concept.hpp>
+
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -13,9 +13,9 @@
//..
// inside a class body, checks whether the type given as template
// argument is a model of the HDS concept described on the page
-// [forwardhdsconcept].
+// [forwardhds].
//
-//@CONCEPT: [forwardhdsconcept] Forward HDS concept
+//@CONCEPT: [forwardhds] Forward HDS concept
//
///Definition
///----------
@@ -124,7 +124,7 @@
// h = next_at_source(h, hds);
// h = next_at_target(h, hds);
// }
-// ForwardHDS hds;
+// HDS hds;
// halfedge_descriptor h;
// halfedge_descriptor g;
// };
@@ -133,9 +133,13 @@
#ifndef BOOST_HDSTL_CONCEPTS_FORWARD_HDS_CONCEPT_HPP
#define BOOST_HDSTL_CONCEPTS_FORWARD_HDS_CONCEPT_HPP 1
+#include <boost/concept_check.hpp>
+#include <boost/hdstl/hds_traits.hpp>
+#include <boost/hdstl/hds_concepts/hds_concept.hpp>
+
namespace boost {
-namespace hdstl{
-namespace concepts{
+namespace hdstl {
+namespace concepts {
template <class HDS>
struct ForwardHDSConcept {
@@ -151,7 +155,7 @@
// inside a class definition body, should trigger a compile-time error
// if the type HDS does not model the 'ForwardHDSConcept'.
- // OPAQUE TYPES
+ // TYPES
typedef typename hds_traits<HDS>::halfedge_descriptor halfedge_descriptor;
typedef typename hds_traits<HDS>::traversal_category traversal_category;
typedef typename hds_traits<HDS>::forward_category forward_category;
@@ -160,7 +164,7 @@
// description of the 'ForwardHDS' concept on page
// [forwardhdsconcept].
- // OPAQUE MANIPULATORS
+ // MANIPULATORS
void constraints()
// Check that the 'HDS' template parameter satisfies all the
// constraints of 'ForwardHDSConcept' on page
@@ -183,7 +187,7 @@
const_constraints(hds);
}
- // OPAQUE ACCESSORS
+ // ACCESSORS
void const_constraints(HDS const& hds)
// Check that the non-modifiable 'HDS' template parameters
// satisfies all the constraints of 'ForwardHDSConcept'.
Added: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.t.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/forward_hds_concept.t.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -0,0 +1,124 @@
+//forward_hds_concept.t.cpp -*- C++ -*-
+//
+//@OVERVIEW: The component under test is a concept-checking class. We
+// proceed with the standard test plan for such a class.
+//
+//@TEST_PLAN: Create a (loose) archetype of the concept, and verify
+// (using the Boost.ConceptCheck library macros) that it satisfies all
+// the concept requirements of the concept. Note that the purpose of
+// this test driver is to verify the validity of the concept checking
+// class, not of the archetype. This is why it suffices to take the
+// 'halfedge_descriptor' as an 'int', although a real archetype would make
+// this into a custom-made class with the tailored minimal requirements.
+
+#include <boost/hdstl/hds_concepts/forward_hds_concept.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/concept_check.hpp>
+
+namespace hdstl1 {
+
+ struct TT : public boost::hdstl::forward_traversal_tag {};
+
+ template<typename ForwardCategory>
+ struct forward_hds_archetype {
+ // This 'struct', intentionally defined in a namespace different from
+ // 'hdstl', the 'hds_traits' specialization defined in the namespace
+ // 'hdstl', and the supporting functions 'opposite', 'next_in_facet',
+ // 'next_at_source', and 'next_at_target' defined in the same
+ // namespace as this 'struct' to take advantage of ADL
+ // (argument-dependent lookup) provide an archetype for the 'ForwardHDS'
+ // concept.
+
+ typedef int halfedge_descriptor;
+ typedef TT traversal_category;
+ typedef ForwardCategory forward_category;
+ };
+
+ template<typename ForwardCategory>
+ typename forward_hds_archetype<ForwardCategory>::halfedge_descriptor
+ opposite(typename forward_hds_archetype<ForwardCategory>
+ ::halfedge_descriptor h,
+ const forward_hds_archetype<ForwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory>
+ typename forward_hds_archetype<ForwardCategory>::halfedge_descriptor
+ next_in_facet(typename forward_hds_archetype<ForwardCategory>
+ ::halfedge_descriptor h,
+ const forward_hds_archetype<ForwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory>
+ typename forward_hds_archetype<ForwardCategory>::halfedge_descriptor
+ next_at_source(typename forward_hds_archetype<ForwardCategory>
+ ::halfedge_descriptor h,
+ const forward_hds_archetype<ForwardCategory>&)
+ {
+ return h;
+ }
+
+ template<typename ForwardCategory>
+ typename forward_hds_archetype<ForwardCategory>::halfedge_descriptor
+ next_at_target(typename forward_hds_archetype<ForwardCategory>
+ ::halfedge_descriptor h,
+ const forward_hds_archetype<ForwardCategory>&)
+ {
+ return h;
+ }
+
+} // namespace hdstl
+
+namespace boost {
+namespace hdstl {
+
+ template <typename ForwardCategory>
+ struct hds_traits<hdstl1::forward_hds_archetype<ForwardCategory> >
+ {
+ typedef typename hdstl1::forward_hds_archetype<ForwardCategory>
+ ::halfedge_descriptor
+ halfedge_descriptor;
+ typedef typename hdstl1::forward_hds_archetype<ForwardCategory>
+ ::traversal_category
+ traversal_category;
+ typedef typename hdstl1::forward_hds_archetype<ForwardCategory>
+ ::forward_category
+ forward_category;
+ enum { supports_vertices = false};
+ static const int supports_facets = true;
+ };
+
+} // namespace hdstl
+} // namespace boost
+
+// ===========================================================================
+// BOOST TEST APPARATUS
+// ===========================================================================
+
+template <class HDS>
+struct class_concept_requirements
+{
+ BOOST_CLASS_REQUIRE(HDS, boost::hdstl::concepts, ForwardHDSConcept);
+};
+
+template <class HDS>
+bool concept_requirements()
+{
+ boost::function_requires<boost::hdstl::concepts::ForwardHDSConcept<HDS> >();
+ class_concept_requirements<HDS>(); // force instantiation
+ return true;
+}
+
+int test_main(int, char **)
+{
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::forward_hds_archetype<boost::hdstl::next_in_facet_tag> >() ));
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::forward_hds_archetype<boost::hdstl::next_at_source_tag> >() ));
+ BOOST_CHECK(( concept_requirements<
+ hdstl1::forward_hds_archetype<boost::hdstl::next_at_target_tag> >() ));
+ return 0;
+}
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_concepts/hds_concept.t.cpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -1,9 +1,5 @@
//hds_concept.t.cpp -*- C++ -*-
-
-#include <boost/hdstl/hds_concepts/hds_concept.hpp>
-#include <boost/test/minimal.hpp>
-#include <boost/concept_check.hpp>
-
+//
//@OVERVIEW: The component under test is a concept-checking class. We
// proceed with the standard test plan for such a class.
//
@@ -15,6 +11,10 @@
// 'halfedge_descriptor' as an 'int', although a real archetype would make
// this into a custom-made class with the tailored minimal requirements.
+#include <boost/hdstl/hds_concepts/hds_concept.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/concept_check.hpp>
+
namespace hdstl1 {
struct hds_archetype {
Modified: sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp
==============================================================================
--- sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp (original)
+++ sandbox/SOC/2007/geometry/libs/hdstl/dev/hds_traits.hpp 2007-06-28 12:06:53 EDT (Thu, 28 Jun 2007)
@@ -201,6 +201,7 @@
// that model the 'BackwardHds' concept, the type
// 'hds_traits<HDS>::traversal_category' is convertible to this
// 'backward_traversal_tag' type.
+ };
struct bidirectional_traversal_tag : public backward_traversal_tag, public forward_traversal_tag {
// A tag type for indicating a model of both 'ForwardHds' and
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk