Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54952 - in sandbox/SOC/2009/function_graph: boost/function_graph libs/test
From: mlopez7_at_[hidden]
Date: 2009-07-14 15:15:57


Author: lopezeant
Date: 2009-07-14 15:15:56 EDT (Tue, 14 Jul 2009)
New Revision: 54952
URL: http://svn.boost.org/trac/boost/changeset/54952

Log:
Added some trait checking to test3.cpp.
Text files modified:
   sandbox/SOC/2009/function_graph/boost/function_graph/function_graph.hpp | 18 ++++++++++++++----
   sandbox/SOC/2009/function_graph/libs/test/test3.cpp | 18 ++++++++++++++++++
   2 files changed, 32 insertions(+), 4 deletions(-)

Modified: sandbox/SOC/2009/function_graph/boost/function_graph/function_graph.hpp
==============================================================================
--- sandbox/SOC/2009/function_graph/boost/function_graph/function_graph.hpp (original)
+++ sandbox/SOC/2009/function_graph/boost/function_graph/function_graph.hpp 2009-07-14 15:15:56 EDT (Tue, 14 Jul 2009)
@@ -22,7 +22,7 @@
 #include <boost/range/iterator.hpp>
 #include <iterator>
 
-/** Error checking */
+/** @todo REMOVE Error checking */
 #include <iostream>
 
 namespace boost {
@@ -32,13 +32,24 @@
 template<typename Graph> struct function_graph_edge_iterator;
 template<typename Graph> struct function_graph_adjacency_iterator;
 
-/** @name Domain Tags
+/** function_graph tags
  * @description Traits that identify the function_graph as either having a
  * finite domain, a range, or having an infinite domain, no range.
  */
 
 struct finite_domain_tag { };
 struct infinite_domain_tag { };
+struct function_graph_traversal_tag
+ : public virtual incidence_graph_tag,
+ public virtual adjacency_graph_tag,
+ public virtual bidirectional_graph_tag,
+ public virtual vertex_list_graph_tag,
+ public virtual edge_list_graph_tag,
+ public virtual adjacency_matrix_tag
+{ };
+
+
+// @todo Is a meta-function has_finite_domain<G>::value useful?
 
 
 
@@ -161,7 +172,6 @@
 
 
 
-
 /** @name Function Graph
  * @description function_graph is a data structure that implements implicit
  * graphs and more.
@@ -202,7 +212,7 @@
     typedef std::size_t vertices_size_type;
     typedef directed_tag directed_category;
     typedef disallow_parallel_edge_tag edge_parallel_category;
- typedef adjacency_matrix_tag traversal_category;
+ typedef function_graph_traversal_tag traversal_category;
     typedef Range vertex_iterator_range;
     typedef typename range_iterator<vertex_iterator_range>::type
                          vertex_iterator;

Modified: sandbox/SOC/2009/function_graph/libs/test/test3.cpp
==============================================================================
--- sandbox/SOC/2009/function_graph/libs/test/test3.cpp (original)
+++ sandbox/SOC/2009/function_graph/libs/test/test3.cpp 2009-07-14 15:15:56 EDT (Tue, 14 Jul 2009)
@@ -12,6 +12,10 @@
 #include "function_graph.hpp"
 #include <boost/range.hpp>
 #include <cassert>
+#include <boost/assert.hpp>
+#include <boost/graph/graph_traits.hpp>
+
+#define META_ASSERT(x) BOOST_ASSERT(x::value)
 
 namespace test3 {
 // print an edge
@@ -61,6 +65,20 @@
 
     ////////
     // Concept checking
+ META_ASSERT(boost::is_directed_graph<boolean_graph>);
+ META_ASSERT(boost::is_directed_graph<weighted_graph>);
+ META_ASSERT(!boost::is_multigraph<boolean_graph>);
+ META_ASSERT(!boost::is_multigraph<weighted_graph>);
+ META_ASSERT(boost::is_incidence_graph<boolean_graph>);
+ META_ASSERT(boost::is_incidence_graph<weighted_graph>);
+ META_ASSERT(boost::is_bidirectional_graph<boolean_graph>);
+ META_ASSERT(boost::is_bidirectional_graph<weighted_graph>);
+ META_ASSERT(boost::is_vertex_list_graph<boolean_graph>);
+ META_ASSERT(boost::is_vertex_list_graph<weighted_graph>);
+ META_ASSERT(boost::is_edge_list_graph<boolean_graph>);
+ META_ASSERT(boost::is_edge_list_graph<weighted_graph>);
+ META_ASSERT(boost::is_directed_bidirectional_graph<boolean_graph>);
+ META_ASSERT(boost::is_directed_bidirectional_graph<weighted_graph>);
 
 
 


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