Update of /cvsroot/boost/boost/boost/graph
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25310
Modified Files:
bc_clustering.hpp betweenness_centrality.hpp circle_layout.hpp
compressed_sparse_row_graph.hpp dominator_tree.hpp
erdos_renyi_generator.hpp floyd_warshall_shortest.hpp
fruchterman_reingold.hpp gursoy_atun_layout.hpp
kamada_kawai_spring_layout.hpp page_rank.hpp
plod_generator.hpp random_layout.hpp small_world_generator.hpp
two_bit_color_map.hpp
Log Message:
fixed almost all issues reported by the inspect tool in boost/graph/
Index: bc_clustering.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/bc_clustering.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bc_clustering.hpp 10 Mar 2005 19:49:23 -0000 1.3
+++ bc_clustering.hpp 25 Jul 2006 21:14:19 -0000 1.4
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: betweenness_centrality.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/betweenness_centrality.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- betweenness_centrality.hpp 12 Jul 2005 03:10:27 -0000 1.2
+++ betweenness_centrality.hpp 25 Jul 2006 21:14:19 -0000 1.3
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: circle_layout.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/circle_layout.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- circle_layout.hpp 14 Sep 2004 21:01:04 -0000 1.3
+++ circle_layout.hpp 25 Jul 2006 21:14:19 -0000 1.4
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: compressed_sparse_row_graph.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/compressed_sparse_row_graph.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- compressed_sparse_row_graph.hpp 27 Jun 2006 13:53:47 -0000 1.14
+++ compressed_sparse_row_graph.hpp 25 Jul 2006 21:14:19 -0000 1.15
@@ -1,7 +1,7 @@
// Copyright 2005-2006 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Jeremiah Willcock
Index: dominator_tree.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/dominator_tree.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dominator_tree.hpp 25 Jul 2006 14:19:27 -0000 1.6
+++ dominator_tree.hpp 25 Jul 2006 21:14:19 -0000 1.7
@@ -1,8 +1,8 @@
//=======================================================================
// Copyright (C) 2005 Jong Soo Park <jongsoo.park -at- gmail.com>
//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
// Dominator tree computation
@@ -217,8 +217,8 @@
* this function would be good for saving computations.
* @pre Unreachable nodes must be masked as
* graph_traits<Graph>::null_vertex in parentMap.
- * @pre Unreachable nodes must be maksed as
- * std::numeric_limits<VerticesSizeType>::max() in dfnumMap.
+ * @pre Unreachable nodes must be masked as
+ * (std::numeric_limits<VerticesSizeType>::max)() in dfnumMap.
*
* @param domTreePredMap [out] : immediate dominator map (parent map
* in dom. tree)
Index: erdos_renyi_generator.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/erdos_renyi_generator.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- erdos_renyi_generator.hpp 25 Jul 2006 14:19:27 -0000 1.8
+++ erdos_renyi_generator.hpp 25 Jul 2006 21:14:19 -0000 1.9
@@ -1,7 +1,7 @@
// Copyright 2004, 2005 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Jeremiah Willcock
Index: floyd_warshall_shortest.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/floyd_warshall_shortest.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- floyd_warshall_shortest.hpp 27 Feb 2006 15:15:13 -0000 1.8
+++ floyd_warshall_shortest.hpp 25 Jul 2006 21:14:19 -0000 1.9
@@ -1,7 +1,7 @@
// Copyright 2002 Rensselaer Polytechnic Institute
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Lauren Foutz
Index: fruchterman_reingold.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/fruchterman_reingold.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- fruchterman_reingold.hpp 6 Feb 2006 22:12:57 -0000 1.11
+++ fruchterman_reingold.hpp 25 Jul 2006 21:14:19 -0000 1.12
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: gursoy_atun_layout.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/gursoy_atun_layout.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gursoy_atun_layout.hpp 12 Jul 2005 03:10:27 -0000 1.4
+++ gursoy_atun_layout.hpp 25 Jul 2006 21:14:19 -0000 1.5
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Jeremiah Willcock
Index: kamada_kawai_spring_layout.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/kamada_kawai_spring_layout.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- kamada_kawai_spring_layout.hpp 9 May 2005 00:58:27 -0000 1.14
+++ kamada_kawai_spring_layout.hpp 25 Jul 2006 21:14:19 -0000 1.15
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: page_rank.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/page_rank.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- page_rank.hpp 12 Jul 2005 03:10:27 -0000 1.2
+++ page_rank.hpp 25 Jul 2006 21:14:19 -0000 1.3
@@ -1,8 +1,8 @@
// Copyright 2004-5 The Trustees of Indiana University.
// Copyright 2002 Brad King and Douglas Gregor
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: plod_generator.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/plod_generator.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- plod_generator.hpp 25 Jul 2006 14:19:27 -0000 1.4
+++ plod_generator.hpp 25 Jul 2006 21:14:19 -0000 1.5
@@ -1,161 +1,161 @@
-// Copyright 2004 The Trustees of Indiana University.
-
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// Authors: Douglas Gregor
-// Andrew Lumsdaine
-#ifndef BOOST_GRAPH_PLOD_GENERATOR_HPP
-#define BOOST_GRAPH_PLOD_GENERATOR_HPP
-
-#include <iterator>
-#include <utility>
-#include <boost/random/uniform_int.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/graph/graph_traits.hpp>
-#include <vector>
-#include <map>
-#include <cmath>
-
-namespace boost {
-
- template<typename RandomGenerator, typename Graph>
- class plod_iterator
- {
- typedef std::vector<std::pair<std::size_t, std::size_t> > out_degrees_t;
- typedef typename graph_traits<Graph>::directed_category directed_category;
-
- public:
- typedef std::input_iterator_tag iterator_category;
- typedef std::pair<std::size_t, std::size_t> value_type;
- typedef const value_type& reference;
- typedef const value_type* pointer;
- typedef void difference_type;
-
- plod_iterator()
- : gen(0), out_degrees(), degrees_left(0), allow_self_loops(false) { }
-
- plod_iterator(RandomGenerator& gen, std::size_t n,
- double alpha, double beta, bool allow_self_loops = false)
- : gen(&gen), n(n), out_degrees(new out_degrees_t),
- degrees_left(0), allow_self_loops(allow_self_loops)
- {
- using std::pow;
-
- uniform_int<std::size_t> x(0, n-1);
- for (std::size_t i = 0; i != n; ++i) {
- std::size_t xv = x(gen);
- std::size_t degree = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha)));
- if (degree != 0) {
- out_degrees->push_back(std::make_pair(i, degree));
- }
- degrees_left += degree;
- }
-
- next(directed_category());
- }
-
- reference operator*() const { return current; }
- pointer operator->() const { return ¤t; }
-
- plod_iterator& operator++()
- {
- next(directed_category());
- return *this;
- }
-
- plod_iterator operator++(int)
- {
- plod_iterator temp(*this);
- ++(*this);
- return temp;
- }
-
- bool operator==(const plod_iterator& other) const
- {
- return degrees_left == other.degrees_left;
- }
-
- bool operator!=(const plod_iterator& other) const
- { return !(*this == other); }
-
- private:
- void next(directed_tag)
- {
- uniform_int<std::size_t> x(0, out_degrees->size()-1);
- std::size_t source;
- do {
- source = x(*gen);
- } while ((*out_degrees)[source].second == 0);
- current.first = (*out_degrees)[source].first;
- do {
- current.second = x(*gen);
- } while (current.first == current.second && !allow_self_loops);
- --degrees_left;
- if (--(*out_degrees)[source].second == 0) {
- (*out_degrees)[source] = out_degrees->back();
- out_degrees->pop_back();
- }
- }
-
- void next(undirected_tag)
- {
- std::size_t source, target;
- while (true) {
- /* We may get to the point where we can't actually find any
- new edges, so we just add some random edge and set the
- degrees left = 0 to signal termination. */
- if (out_degrees->size() < 2) {
- uniform_int<std::size_t> x(0, n);
- current.first = x(*gen);
- do {
- current.second = x(*gen);
- } while (current.first == current.second && !allow_self_loops);
- degrees_left = 0;
- out_degrees->clear();
- return;
- }
-
- uniform_int<std::size_t> x(0, out_degrees->size()-1);
-
- // Select source vertex
- source = x(*gen);
- if ((*out_degrees)[source].second == 0) {
- (*out_degrees)[source] = out_degrees->back();
- out_degrees->pop_back();
- continue;
- }
-
- // Select target vertex
- target = x(*gen);
- if ((*out_degrees)[target].second == 0) {
- (*out_degrees)[target] = out_degrees->back();
- out_degrees->pop_back();
- continue;
- } else if (source != target
- || (allow_self_loops && (*out_degrees)[source].second > 2))
{
- break;
- }
- }
-
- // Update degree counts
- --(*out_degrees)[source].second;
- --degrees_left;
- --(*out_degrees)[target].second;
- --degrees_left;
- current.first = (*out_degrees)[source].first;
- current.second = (*out_degrees)[target].first;
- }
-
- RandomGenerator* gen;
- std::size_t n;
- shared_ptr<out_degrees_t> out_degrees;
- std::size_t degrees_left;
- bool allow_self_loops;
- value_type current;
- };
-
-} // end namespace boost
-
-#endif // BOOST_GRAPH_PLOD_GENERATOR_HPP
+// Copyright 2004 The Trustees of Indiana University.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Authors: Douglas Gregor
+// Andrew Lumsdaine
+#ifndef BOOST_GRAPH_PLOD_GENERATOR_HPP
+#define BOOST_GRAPH_PLOD_GENERATOR_HPP
+
+#include <iterator>
+#include <utility>
+#include <boost/random/uniform_int.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <vector>
+#include <map>
+#include <cmath>
+
+namespace boost {
+
+ template<typename RandomGenerator, typename Graph>
+ class plod_iterator
+ {
+ typedef std::vector<std::pair<std::size_t, std::size_t> > out_degrees_t;
+ typedef typename graph_traits<Graph>::directed_category directed_category;
+
+ public:
+ typedef std::input_iterator_tag iterator_category;
+ typedef std::pair<std::size_t, std::size_t> value_type;
+ typedef const value_type& reference;
+ typedef const value_type* pointer;
+ typedef void difference_type;
+
+ plod_iterator()
+ : gen(0), out_degrees(), degrees_left(0), allow_self_loops(false) { }
+
+ plod_iterator(RandomGenerator& gen, std::size_t n,
+ double alpha, double beta, bool allow_self_loops = false)
+ : gen(&gen), n(n), out_degrees(new out_degrees_t),
+ degrees_left(0), allow_self_loops(allow_self_loops)
+ {
+ using std::pow;
+
+ uniform_int<std::size_t> x(0, n-1);
+ for (std::size_t i = 0; i != n; ++i) {
+ std::size_t xv = x(gen);
+ std::size_t degree = (xv == 0? 0 : std::size_t(beta * pow(xv, -alpha)));
+ if (degree != 0) {
+ out_degrees->push_back(std::make_pair(i, degree));
+ }
+ degrees_left += degree;
+ }
+
+ next(directed_category());
+ }
+
+ reference operator*() const { return current; }
+ pointer operator->() const { return ¤t; }
+
+ plod_iterator& operator++()
+ {
+ next(directed_category());
+ return *this;
+ }
+
+ plod_iterator operator++(int)
+ {
+ plod_iterator temp(*this);
+ ++(*this);
+ return temp;
+ }
+
+ bool operator==(const plod_iterator& other) const
+ {
+ return degrees_left == other.degrees_left;
+ }
+
+ bool operator!=(const plod_iterator& other) const
+ { return !(*this == other); }
+
+ private:
+ void next(directed_tag)
+ {
+ uniform_int<std::size_t> x(0, out_degrees->size()-1);
+ std::size_t source;
+ do {
+ source = x(*gen);
+ } while ((*out_degrees)[source].second == 0);
+ current.first = (*out_degrees)[source].first;
+ do {
+ current.second = x(*gen);
+ } while (current.first == current.second && !allow_self_loops);
+ --degrees_left;
+ if (--(*out_degrees)[source].second == 0) {
+ (*out_degrees)[source] = out_degrees->back();
+ out_degrees->pop_back();
+ }
+ }
+
+ void next(undirected_tag)
+ {
+ std::size_t source, target;
+ while (true) {
+ /* We may get to the point where we can't actually find any
+ new edges, so we just add some random edge and set the
+ degrees left = 0 to signal termination. */
+ if (out_degrees->size() < 2) {
+ uniform_int<std::size_t> x(0, n);
+ current.first = x(*gen);
+ do {
+ current.second = x(*gen);
+ } while (current.first == current.second && !allow_self_loops);
+ degrees_left = 0;
+ out_degrees->clear();
+ return;
+ }
+
+ uniform_int<std::size_t> x(0, out_degrees->size()-1);
+
+ // Select source vertex
+ source = x(*gen);
+ if ((*out_degrees)[source].second == 0) {
+ (*out_degrees)[source] = out_degrees->back();
+ out_degrees->pop_back();
+ continue;
+ }
+
+ // Select target vertex
+ target = x(*gen);
+ if ((*out_degrees)[target].second == 0) {
+ (*out_degrees)[target] = out_degrees->back();
+ out_degrees->pop_back();
+ continue;
+ } else if (source != target
+ || (allow_self_loops && (*out_degrees)[source].second > 2))
{
+ break;
+ }
+ }
+
+ // Update degree counts
+ --(*out_degrees)[source].second;
+ --degrees_left;
+ --(*out_degrees)[target].second;
+ --degrees_left;
+ current.first = (*out_degrees)[source].first;
+ current.second = (*out_degrees)[target].first;
+ }
+
+ RandomGenerator* gen;
+ std::size_t n;
+ shared_ptr<out_degrees_t> out_degrees;
+ std::size_t degrees_left;
+ bool allow_self_loops;
+ value_type current;
+ };
+
+} // end namespace boost
+
+#endif // BOOST_GRAPH_PLOD_GENERATOR_HPP
Index: random_layout.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/random_layout.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- random_layout.hpp 27 Oct 2004 14:38:11 -0000 1.2
+++ random_layout.hpp 25 Jul 2006 21:14:19 -0000 1.3
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: small_world_generator.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/small_world_generator.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- small_world_generator.hpp 12 Jul 2005 03:10:28 -0000 1.2
+++ small_world_generator.hpp 25 Jul 2006 21:14:19 -0000 1.3
@@ -1,7 +1,7 @@
// Copyright 2004 The Trustees of Indiana University.
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Douglas Gregor
Index: two_bit_color_map.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/graph/two_bit_color_map.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- two_bit_color_map.hpp 9 Mar 2006 19:55:13 -0000 1.1
+++ two_bit_color_map.hpp 25 Jul 2006 21:14:19 -0000 1.2
@@ -1,90 +1,90 @@
-// Copyright (C) 2005-2006 The Trustees of Indiana University.
-
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// Authors: Jeremiah Willcock
-// Douglas Gregor
-// Andrew Lumsdaine
-
-// Two bit per color property map
-
-#ifndef BOOST_TWO_BIT_COLOR_MAP_HPP
-#define BOOST_TWO_BIT_COLOR_MAP_HPP
-
-#include <boost/property_map.hpp>
-#include <boost/shared_array.hpp>
-
-namespace boost {
-
-enum two_bit_color_type {
- two_bit_white = 0,
- two_bit_gray = 1,
- two_bit_green = 2,
- two_bit_black = 3
-};
-
-template <>
-struct color_traits<two_bit_color_type>
-{
- static two_bit_color_type white() { return two_bit_white; }
- static two_bit_color_type gray() { return two_bit_gray; }
- static two_bit_color_type green() { return two_bit_green; }
- static two_bit_color_type black() { return two_bit_black; }
-};
-
-
-template<typename IndexMap = identity_property_map>
-struct two_bit_color_map
-{
- std::size_t n;
- IndexMap index;
- shared_array<unsigned char> data;
-
- typedef typename property_traits<IndexMap>::key_type key_type;
- typedef two_bit_color_type value_type;
- typedef void reference;
- typedef read_write_property_map_tag category;
-
- explicit two_bit_color_map(std::size_t n, const IndexMap& index = IndexMap())
- : n(n), index(index), data(new unsigned char[(n + 3) / 4])
- {
- }
-};
-
-template<typename IndexMap>
-inline two_bit_color_type
-get(const two_bit_color_map<IndexMap>& pm,
- typename two_bit_color_map<IndexMap>::key_type key)
-{
- typename property_traits<IndexMap>::value_type i = get(pm.index, key);
- assert (i < pm.n);
- return two_bit_color_type((pm.data.get()[i / 4] >> ((i % 4) * 2)) & 3);
-}
-
-template<typename IndexMap>
-inline void
-put(const two_bit_color_map<IndexMap>& pm,
- typename two_bit_color_map<IndexMap>::key_type key,
- two_bit_color_type value)
-{
- typename property_traits<IndexMap>::value_type i = get(pm.index, key);
- assert (i < pm.n);
- assert (value >= 0 && value < 4);
- std::size_t byte_num = i / 4;
- std::size_t bit_position = ((i % 4) * 2);
- pm.data.get()[byte_num] = (pm.data.get()[byte_num] & ~(3 << bit_position))
- | (value << bit_position);
-}
-
-template<typename IndexMap>
-inline two_bit_color_map<IndexMap>
-make_two_bit_color_map(std::size_t n, const IndexMap& index_map)
-{
- return two_bit_color_map<IndexMap>(n, index_map);
-}
-
-} // end namespace boost
-
-#endif // BOOST_TWO_BIT_COLOR_MAP_HPP
+// Copyright (C) 2005-2006 The Trustees of Indiana University.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Authors: Jeremiah Willcock
+// Douglas Gregor
+// Andrew Lumsdaine
+
+// Two bit per color property map
+
+#ifndef BOOST_TWO_BIT_COLOR_MAP_HPP
+#define BOOST_TWO_BIT_COLOR_MAP_HPP
+
+#include <boost/property_map.hpp>
+#include <boost/shared_array.hpp>
+
+namespace boost {
+
+enum two_bit_color_type {
+ two_bit_white = 0,
+ two_bit_gray = 1,
+ two_bit_green = 2,
+ two_bit_black = 3
+};
+
+template <>
+struct color_traits<two_bit_color_type>
+{
+ static two_bit_color_type white() { return two_bit_white; }
+ static two_bit_color_type gray() { return two_bit_gray; }
+ static two_bit_color_type green() { return two_bit_green; }
+ static two_bit_color_type black() { return two_bit_black; }
+};
+
+
+template<typename IndexMap = identity_property_map>
+struct two_bit_color_map
+{
+ std::size_t n;
+ IndexMap index;
+ shared_array<unsigned char> data;
+
+ typedef typename property_traits<IndexMap>::key_type key_type;
+ typedef two_bit_color_type value_type;
+ typedef void reference;
+ typedef read_write_property_map_tag category;
+
+ explicit two_bit_color_map(std::size_t n, const IndexMap& index = IndexMap())
+ : n(n), index(index), data(new unsigned char[(n + 3) / 4])
+ {
+ }
+};
+
+template<typename IndexMap>
+inline two_bit_color_type
+get(const two_bit_color_map<IndexMap>& pm,
+ typename two_bit_color_map<IndexMap>::key_type key)
+{
+ typename property_traits<IndexMap>::value_type i = get(pm.index, key);
+ assert (i < pm.n);
+ return two_bit_color_type((pm.data.get()[i / 4] >> ((i % 4) * 2)) & 3);
+}
+
+template<typename IndexMap>
+inline void
+put(const two_bit_color_map<IndexMap>& pm,
+ typename two_bit_color_map<IndexMap>::key_type key,
+ two_bit_color_type value)
+{
+ typename property_traits<IndexMap>::value_type i = get(pm.index, key);
+ assert (i < pm.n);
+ assert (value >= 0 && value < 4);
+ std::size_t byte_num = i / 4;
+ std::size_t bit_position = ((i % 4) * 2);
+ pm.data.get()[byte_num] = (pm.data.get()[byte_num] & ~(3 << bit_position))
+ | (value << bit_position);
+}
+
+template<typename IndexMap>
+inline two_bit_color_map<IndexMap>
+make_two_bit_color_map(std::size_t n, const IndexMap& index_map)
+{
+ return two_bit_color_map<IndexMap>(n, index_map);
+}
+
+} // end namespace boost
+
+#endif // BOOST_TWO_BIT_COLOR_MAP_HPP
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs