Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53290 - in sandbox/SOC/2009/function_graph: . boost boost/function_graph libs libs/function_graph libs/function_graph/doc libs/function_graph/example libs/function_graph/src
From: mlopez7_at_[hidden]
Date: 2009-05-26 18:55:18


Author: lopezeant
Date: 2009-05-26 18:55:17 EDT (Tue, 26 May 2009)
New Revision: 53290
URL: http://svn.boost.org/trac/boost/changeset/53290

Log:
creating project structure
Added:
   sandbox/SOC/2009/function_graph/boost/
   sandbox/SOC/2009/function_graph/boost-build.jam (contents, props changed)
   sandbox/SOC/2009/function_graph/boost/function_graph/
   sandbox/SOC/2009/function_graph/boost/function_graph/function_graph_function.hpp (contents, props changed)
   sandbox/SOC/2009/function_graph/boost/function_graph/function_graph_functor.hpp (contents, props changed)
   sandbox/SOC/2009/function_graph/libs/
   sandbox/SOC/2009/function_graph/libs/function_graph/
   sandbox/SOC/2009/function_graph/libs/function_graph/doc/
   sandbox/SOC/2009/function_graph/libs/function_graph/example/
   sandbox/SOC/2009/function_graph/libs/function_graph/src/
   sandbox/SOC/2009/function_graph/project-root.jam (contents, props changed)

Added: sandbox/SOC/2009/function_graph/boost-build.jam
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/function_graph/boost-build.jam 2009-05-26 18:55:17 EDT (Tue, 26 May 2009)
@@ -0,0 +1 @@
+boost-build $(BOOST_ROOT)/tools/build/v2 ;

Added: sandbox/SOC/2009/function_graph/boost/function_graph/function_graph_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/function_graph/boost/function_graph/function_graph_function.hpp 2009-05-26 18:55:17 EDT (Tue, 26 May 2009)
@@ -0,0 +1,47 @@
+#ifndef FUNCTION_GRAPH_FUNCTION_HPP_
+#define FUNCTION_GRAPH_FUNCTION_HPP_
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+
+#include <boost/function.hpp>
+
+namespace boost { namespace graph {
+
+/**
+ * function_graph - function version
+ */
+template<typename container, typename edge_return>
+class function_graph {
+ typedef container container_type;
+ typedef typename container_type::value_type value_type;
+ typedef edge_return edge_return_type;
+ typedef boost::function<edge_return_type (value_type, value_type)>
+ function_type;
+public:
+ /** Constructor - blank */
+ function_graph()
+ : edge_(0), container_(0) { }
+
+ /** Constructor - take a function */
+ function_graph(function_type const& f)
+ : edge_(f), container_(0) { }
+
+ /** Constructor - take a function and a container */
+ function_graph(function_type const& f, container_type const& x)
+ : edge_(f), container_(&x) { }
+
+ /** edge - does the edge exist */
+ edge_return_type edge(value_type const& a, value_type const& b)
+ { return edge_(a, b); }
+
+private:
+ function_type edge_;
+ const container_type* container_;
+
+};
+
+} // end graph namespace
+} // end boost naespace
+
+#endif /*FUNCTION_GRAPH_FUNCTION_HPP_*/

Added: sandbox/SOC/2009/function_graph/boost/function_graph/function_graph_functor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/function_graph/boost/function_graph/function_graph_functor.hpp 2009-05-26 18:55:17 EDT (Tue, 26 May 2009)
@@ -0,0 +1,60 @@
+#ifndef FUNCTION_GRAPH_FUNCTOR_HPP_
+#define FUNCTION_GRAPH_FUNCTOR_HPP_
+
+#include <boost/function.hpp>
+
+namespace boost { namespace graph {
+
+/**
+ * beta of function_graph using functor
+ *
+ * function_graph is a data structure that creates an implicit graph based on a
+ * function or functor that is either user defined or from the stl or boost.
+ *
+ * @internal
+ * as of current, this data structure acts over a container. The type of the
+ * container is immaterial, so long as it uses T least an input iterator.
+ *
+ * @todo
+ * implement a pointer that will set itself to null if the object it points to
+ * is destroyed
+ * have type deduced from container
+ * implement domains and ranges (given a type and function, but no container)
+ * implement an edge iterator
+ * implement a function_graph that acts over two sets that may be different
+ * types
+ */
+
+ /**
+ * function_graph - functor version
+ */
+template<typename container, template <typename> class functor>
+class function_graph
+{
+ typedef typename container::value_type value_type;
+ // functor type is deduced from the container
+ // could use better method of deduction
+ typedef functor<value_type> functor_type;
+
+public:
+
+ /** Constructor - blank */
+ function_graph()
+ : container_(0) { }
+
+ /** Constructor - take the container */
+ function_graph(container const& x)
+ : container_(&x) { }
+
+ /** edge functor - allows it to act as edge(...) */
+public:
+ functor_type edge;
+
+private:
+ const container* container_;
+};
+
+} // graph namespace
+} // boost namespace
+
+#endif /*FUNCTION_GRAPH_FUNCTOR_HPP_*/

Added: sandbox/SOC/2009/function_graph/project-root.jam
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/function_graph/project-root.jam 2009-05-26 18:55:17 EDT (Tue, 26 May 2009)
@@ -0,0 +1,10 @@
+#==============================================================================
+# Copyright (c) 2009 Michael Lopez
+#
+# 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)
+#==============================================================================
+
+build-project libs/function_graph/doc ;
+build-project libs/function_graph/example ;


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