|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49167 - in sandbox/SOC/2008/graphs/trunk/boost: . descriptors graphs
From: asutton_at_[hidden]
Date: 2008-10-07 11:34:40
Author: asutton
Date: 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
New Revision: 49167
URL: http://svn.boost.org/trac/boost/changeset/49167
Log:
Started moving files into the boost and boost::graphs namespace. This
means that the adjlist will be broken for the next week or so while I
do this piecemeal.
Text files modified:
sandbox/SOC/2008/graphs/trunk/boost/blob.hpp | 14 +++-
sandbox/SOC/2008/graphs/trunk/boost/containers.hpp | 28 ++++++---
sandbox/SOC/2008/graphs/trunk/boost/descriptors.hpp | 7 +
sandbox/SOC/2008/graphs/trunk/boost/descriptors/index_descriptor.hpp | 8 ++
sandbox/SOC/2008/graphs/trunk/boost/descriptors/node_descriptor.hpp | 8 ++
sandbox/SOC/2008/graphs/trunk/boost/graphs/colors.hpp | 17 ++---
sandbox/SOC/2008/graphs/trunk/boost/graphs/directional_edge.hpp | 11 ++-
sandbox/SOC/2008/graphs/trunk/boost/graphs/policy.hpp | 4
sandbox/SOC/2008/graphs/trunk/boost/graphs/properties.hpp | 9 ++-
sandbox/SOC/2008/graphs/trunk/boost/graphs/traits.hpp | 8 ++
sandbox/SOC/2008/graphs/trunk/boost/none.hpp | 14 ++++-
sandbox/SOC/2008/graphs/trunk/boost/optional_value.hpp | 3 +
sandbox/SOC/2008/graphs/trunk/boost/unordered_pair.hpp | 108 +++++++++++++++++----------------------
13 files changed, 135 insertions(+), 104 deletions(-)
Modified: sandbox/SOC/2008/graphs/trunk/boost/blob.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/blob.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/blob.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,16 +1,18 @@
-#ifndef BLOB_HPP
-#define BLOB_HPP
+#ifndef BOOST_BLOB_HPP
+#define BOOST_BLOB_HPP
#include <cstring>
#include <boost/functional/hash.hpp>
+namespace boost {
+
namespace detail
{
- // Not for the faint of heart. This helps get around type punning issues
- // by using a union to hide the explicit recast of an array of bytes to
- // a real object.
+ // Not for the faint of heart. This helps get around type punning issues by
+ // using a union to hide the explicit recast of an array of bytes to a real
+ // object.
template <typename T>
union union_caster
{
@@ -134,4 +136,6 @@
return seed;
}
+} /* namespace boost */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/containers.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/containers.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/containers.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -4,27 +4,34 @@
// 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)
-#ifndef CONTAINERS_HPP
-#define CONTAINERS_HPP
+#ifndef BOOST_CONTAINERS_HPP
+#define BOOST_CONTAINERS_HPP
#include <boost/type_traits.hpp>
// Forward declarations of stdandard types. Jeremy's right! There does need
// to be an <stlfwd> header since there's no guarantee that these are the
// correct signatures for these types.
-namespace std
-{
+namespace std {
+
template <typename, typename> class vector;
- template <typename, typename> class list;
- template <typename, typename, typename> class set;
- template <typename, typename, typename> class multiset;
- template <typename, typename, typename, typename> class map;
- template <typename, typename, typename, typename> class multimap;
-}
+template <typename, typename> class list;
+template <typename, typename, typename> class set;
+template <typename, typename, typename> class multiset;
+template <typename, typename, typename, typename> class map;
+template <typename, typename, typename, typename> class multimap;
+
+} /* namespace std */
// TODO: This probably all goes away with concepts. Seeing as how concepts
// aren't in C++ just yet, we'll still do things this way.
+// TODO: Why is this duplicated? Did I actually change anything from the
+// original besides the formatting? I think I added some generic insert and
+// remove functions. Am I using those anywhere?
+
+namespace boost {
+
// Container Category Tags
// These define the basic concepts of STL containers. Note the use of
// virtual inheritance because there are lots of inheritance diamonds.
@@ -255,5 +262,6 @@
erase(Container& c, typename Container::iterator i)
{ c.erase(i); }
+} /* namespace boost */
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/descriptors.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/descriptors.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/descriptors.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,6 +1,6 @@
-#ifndef DESCRIPTORS_HPP
-#define DESCRIPTORS_HPP
+#ifndef BOOST_DESCRIPTORS_HPP
+#define BOOST_DESCRIPTORS_HPP
// Pull the container traits.
#include "containers.hpp"
@@ -67,6 +67,8 @@
// insertions and removals. These data structures are generally constructed over
// a known set of objects and are generally immutable afterwards.
+namespace boost {
+
// Kind of concepts
struct stable_mutators_tag { };
struct unstable_insert_tag { };
@@ -217,5 +219,6 @@
// TODO: Unordered Map
// TODO: Unordered Multimap
+} /* namespace boost */
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/descriptors/index_descriptor.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/descriptors/index_descriptor.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/descriptors/index_descriptor.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,10 +1,12 @@
-#ifndef INDEX_DESCRIPTOR_HPP
-#define INDEX_DESCRIPTOR_HPP
+#ifndef BOOST_DESCRIPTORS_INDEX_DESCRIPTOR_HPP
+#define BOOST_DESCRIOTORS_INDEX_DESCRIPTOR_HPP
#include <boost/next_prior.hpp>
#include <boost/functional/hash.hpp>
+namespace boost {
+
/**
* The index_descriptor simply maintains the descriptor as an index into the
* given offset.
@@ -85,4 +87,6 @@
std::ostream& operator<<(std::ostream& os, index_descriptor<Index, Kind> const& x)
{ return os << x.value; }
+} /* namespace boost */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/descriptors/node_descriptor.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/descriptors/node_descriptor.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/descriptors/node_descriptor.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,9 +1,11 @@
-#ifndef NODE_DESCRIPTOR_HPP
-#define NODE_DESCRIPTOR_HPP
+#ifndef BOOST_DESCRIPTORS_NODE_DESCRIPTOR_HPP
+#define BOOST_DESCRIPTORS_NODE_DESCRIPTOR_HPP
#include <boost/functional/hash.hpp>
+namespace boost {
+
/**
* The node descriptor contains an iterator into the target container. The
* container iterator is just a pattern for the actual iterator and has no
@@ -85,4 +87,6 @@
std::ostream& operator<<(std::ostream& os, node_descriptor<Blob, Kind> const& d)
{ return os << hash_value(d); }
+} /* namespace boost */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/colors.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/colors.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/colors.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,6 +1,8 @@
-#ifndef COLORS_HPP
-#define COLORS_HPP
+#ifndef BOOST_GRAPHS_COLORS_HPP
+#define BOOST_GRAPHS_COLORS_HPP
+
+namespace boost { namespace graphs {
// This seems a bit extensive for a simple enumeration of colors. However, it
// is certainly possible that somebody wants to use their own enumeration type
@@ -10,18 +12,13 @@
/** Default color types for this library. */
enum color {
- white_color,
- gray_color,
- black_color,
- red_color,
- green_color,
- blue_color
+ white_color, gray_color, black_color,
+ red_color, green_color, blue_color
};
/**
* A traits class for colors. Specialize this if, for some reason, you ever
* plan to specialize the notion of colors - which may be possible.
- *
* @todo This should be conceptized. See below.
*/
template <typename Color>
@@ -46,6 +43,6 @@
{ return blue_color; }
};
-
+} } /* namespace boost::graphs */
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/directional_edge.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/directional_edge.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/directional_edge.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,6 +1,8 @@
-#ifndef DIRECTIONAL_EDGE_HPP
-#define DIRECTIONAL_EDGE_HPP
+#ifndef BOOST_GRAPHS_DIRECTIONAL_EDGE_HPP
+#define BOOST_GRAPHS_DIRECTIONAL_EDGE_HPP
+
+namespace boost { namespace graphs {
// This basically wraps a concept called DirectionalEdge. A DirectionalEdge
// is one that has directionality being imposed on it. Specializations of
@@ -8,7 +10,8 @@
namespace detail
{
- // By default, we assume that the edge is directed.
+ // The default generic implementation assumes that the edge is directed.
+ // This would work nicely with inheriting constructors.
template <typename Edge>
struct directional_edge_adapter : Edge
{
@@ -60,4 +63,6 @@
{ }
};
+} } /* namespace boost::graphs */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/policy.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/policy.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/policy.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,5 +1,5 @@
-#ifndef POLICY_HPP
-#define POLICY_HPP
+#ifndef BOOST_GRAPHS_POLICY_HPP
+#define BOOST_GRAPHS_POLICY_HPP
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/properties.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/properties.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/properties.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,6 +1,6 @@
-#ifndef PROPERTIES_HPP
-#define PROPERTIES_HPP
+#ifndef BOOST_GRAPHS_PROPERTIES_HPP
+#define BOOST_GRAPHS_PROPERTIES_HPP
#include <boost/shared_ptr.hpp>
@@ -15,6 +15,8 @@
#include "properties/simple_property_map.hpp"
#include "properties/bundled_property_map.hpp"
+namespace boost { namespace graphs {
+
namespace detail
{
// Define the mapping strategy based on the type of descriptor. By default,
@@ -253,7 +255,6 @@
{ }
};
-
namespace detail
{
// Optionally initialize the container, but not if the map is already
@@ -287,4 +288,6 @@
void initialize(Graph const g, optional_edge_label<Graph, Label>& map, Label const& x)
{ detail::optional_init(g, map, x); }
+} } /* namespace boost::graphs */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/traits.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/traits.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/traits.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,6 +1,6 @@
-#ifndef TRAITS_HPP
-#define TRAITS_HPP
+#ifndef BOOST_GRAPHS_TRAITS_HPP
+#define BOOST_GRAPHS_TRAITS_HPP
#include <boost/utility.hpp>
#include <boost/mpl/if.hpp>
@@ -8,6 +8,8 @@
#include "undirected_graph.hpp"
#include "directed_graph.hpp"
+namespace boost { namespace graphs {
+
namespace detail
{
template <typename Store>
@@ -86,4 +88,6 @@
{ return has_parallel_edges<Graph>::value; }
//@}
+} } /* namespace boost::graphs */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/none.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/none.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/none.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,10 +1,16 @@
-#ifndef NONE_HPP
-#define NONE_HPP
+#ifndef BOOST_NONE_HPP
+#define BOOST_NONE_HPP
#include <boost/utility.hpp>
-/** The canonical none type. */
+namespace boost {
+
+/**
+ * The canonical none type.
+ * @todo This conflicts mightily with the standard boost none, and none_t. We
+ * should not even be using this.
+ */
struct none { };
/** Like none, but not. */
@@ -23,5 +29,7 @@
template <>
struct is_not_none<none> { BOOST_STATIC_CONSTANT(bool, value = !is_none<none>::value); };
+} /* namespace boost */
+
#endif
Modified: sandbox/SOC/2008/graphs/trunk/boost/optional_value.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/optional_value.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/optional_value.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -87,6 +87,9 @@
return _val;
}
+ inline void reset()
+ { _val = absent(); }
+
inline optional_value& swap(optional_value&& x)
{
using namespace std;
Modified: sandbox/SOC/2008/graphs/trunk/boost/unordered_pair.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/unordered_pair.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/unordered_pair.hpp 2008-10-07 11:34:39 EDT (Tue, 07 Oct 2008)
@@ -1,11 +1,13 @@
-#ifndef UNORDERED_PAIR_HPP
-#define UNORDERED_PAIR_HPP
+#ifndef BOOST_UNORDERED_PAIR_HPP
+#define BOOT_UNORDERED_PAIR_HPP
#include <functional>
#include <boost/functional/hash.hpp>
+namespace boost {
+
/**
* The unordered pair template provides a homogenously typed 2-element
* whose values are unordered. By unordered, we simply mean that two pairs
@@ -24,15 +26,48 @@
typedef T value_type;
typedef Compare compare;
- unordered_pair();
- unordered_pair(unordered_pair const& x);
- unordered_pair(Compare const& comp);
- unordered_pair(T const& f, T const& s);
- unordered_pair(T const& f, T const& s, Compare const& comp);
-
- T const& first() const;
- T const& second() const;
- Compare comp() const;
+ /** @name Constructors */
+ //@{
+ inline unordered_pair(Compare const& comp = Compare())
+ : _pair(), _comp()
+ { }
+
+ inline unordered_pair(unordered_pair const& x)
+ : _pair(x._pair), _comp(x._comp)
+ { }
+
+ inline unordered_pair(unordered_pair&& x)
+ : _pair(std::move(x._pair)), _comp(std::move(x._comp))
+ { }
+
+ inline unordered_pair(T const& f, T const& s, Compare const& comp = Compare())
+ : _pair(f, s), _comp()
+ { order(); }
+ //@}
+
+ /** @name Operators */
+ //@{
+ inline unordered_pair& operator=(unordered_pair const& x)
+ { return swap(unordered_pair(x)); }
+
+ inline unordered_pair& operator=(unordered_pair&& x)
+ { return swap(x); }
+ //@}
+
+ /** @name Accessors */
+ //@{
+ inline T const& first() const
+ { return _pair.first; }
+
+ inline T const& second() const
+ { return _pair.second; }
+
+ inline Compare comp() const
+ { return _comp; }
+ //@}
+
+ inline unordered_pair& swap(unordered_pair&& x)
+ { _pair.swap(x._pair); return *this; }
private:
void order();
@@ -43,55 +78,6 @@
};
template <typename T, typename C>
-unordered_pair<T,C>::unordered_pair()
- : _pair()
- , _comp()
-{ }
-
-template <typename T, typename C>
-unordered_pair<T,C>::unordered_pair(unordered_pair const& x)
- : _pair(x._pair)
- , _comp(x._comp)
-{ }
-
-template <typename T, typename C>
-unordered_pair<T,C>::unordered_pair(C const& comp)
- : _pair()
- , _comp(comp)
-{ }
-
-template <typename T, typename C>
-unordered_pair<T,C>::unordered_pair(T const& f, T const& s)
- : _pair(f, s)
- , _comp()
-{ order(); }
-
-
-template <typename T, typename C>
-unordered_pair<T,C>::unordered_pair(T const& f, T const& s, C const& comp)
- : _pair(f, s)
- , _comp(comp)
-{ order(); }
-
-template <typename T, typename C>
-T const&
-unordered_pair<T,C>::first() const
-{ return _pair.first; }
-
-template <typename T, typename C>
-T const&
-unordered_pair<T,C>::second() const
-{ return _pair.second; }
-
-/**
- * Return a copy of the comparator used by the unordered pair.
- */
-template <typename T, typename C>
-C
-unordered_pair<T,C>::comp() const
-{ return _comp; }
-
-template <typename T, typename C>
void
unordered_pair<T,C>::order()
{
@@ -166,4 +152,6 @@
b = p.second();
}
+} /* namespace boost */
+
#endif
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