# HG changeset patch
# User alpar
# Date 1110991221 0
# Node ID 20b26ee5812b076dbf25af31f75419626f2c039f
# Parent  ce885274b754c87a6246beb5f90eabe033b4a854
- Add compilation tests for the function type interface of BFS/DFS/Dijkstra
- Fix the bugs covered up by these tests
diff -r ce885274b754 -r 20b26ee5812b src/lemon/dfs.h
--- a/src/lemon/dfs.h	Wed Mar 16 13:25:19 2005 +0000
+++ b/src/lemon/dfs.h	Wed Mar 16 16:40:21 2005 +0000
@@ -431,6 +431,40 @@
       return *this;
     }
 
+    ///Sets the map indicating if a node is reached.
+
+    ///Sets the map indicating if a node is reached.
+    ///If you don't use this function before calling \ref run(),
+    ///it will allocate one. The destuctor deallocates this
+    ///automatically allocated map, of course.
+    ///\return  (*this) 
+    Dfs &reachedMap(ReachedMap &m) 
+    {
+      if(local_reached) {
+	delete _reached;
+	local_reached=false;
+      }
+      _reached = &m;
+      return *this;
+    }
+
+    ///Sets the map indicating if a node is processed.
+
+    ///Sets the map indicating if a node is processed.
+    ///If you don't use this function before calling \ref run(),
+    ///it will allocate one. The destuctor deallocates this
+    ///automatically allocated map, of course.
+    ///\return  (*this) 
+    Dfs &processedMap(ProcessedMap &m) 
+    {
+      if(local_processed) {
+	delete _processed;
+	local_processed=false;
+      }
+      _processed = &m;
+      return *this;
+    }
+
   public:
     ///\name Execution control
     ///The simplest way to execute the algorithm is to use
diff -r ce885274b754 -r 20b26ee5812b src/lemon/dijkstra.h
--- a/src/lemon/dijkstra.h	Wed Mar 16 13:25:19 2005 +0000
+++ b/src/lemon/dijkstra.h	Wed Mar 16 16:40:21 2005 +0000
@@ -807,6 +807,7 @@
   ///as well as the \ref Dijkstra class.
   /// The \ref DijkstraWizardBase is a class to be the default traits of the
   /// \ref DijkstraWizard class.
+  /// \todo More named parameters are required...
   template
   class DijkstraWizardBase : public DijkstraWizardDefaultTraits
   {
diff -r ce885274b754 -r 20b26ee5812b src/test/bfs_test.cc
--- a/src/test/bfs_test.cc	Wed Mar 16 13:25:19 2005 +0000
+++ b/src/test/bfs_test.cc	Wed Mar 16 16:40:21 2005 +0000
@@ -58,6 +58,28 @@
 
 }
 
+void check_Bfs_Function_Compile() 
+{
+  typedef int VType;
+  typedef concept::StaticGraph Graph;
+
+  typedef Graph::Edge Edge;
+  typedef Graph::Node Node;
+  typedef Graph::EdgeIt EdgeIt;
+  typedef Graph::NodeIt NodeIt;
+  typedef concept::ReadMap LengthMap;
+   
+  bfs(Graph(),Node()).run();
+  bfs(Graph()).source(Node()).run();
+  bfs(Graph())
+    .predMap(concept::WriteMap())
+    .distMap(concept::WriteMap())
+    .reachedMap(concept::ReadWriteMap())
+    .processedMap(concept::WriteMap())
+    .run(Node());
+  
+}
+
 int main()
 {
     
diff -r ce885274b754 -r 20b26ee5812b src/test/dfs_test.cc
--- a/src/test/dfs_test.cc	Wed Mar 16 13:25:19 2005 +0000
+++ b/src/test/dfs_test.cc	Wed Mar 16 16:40:21 2005 +0000
@@ -58,6 +58,29 @@
 
 }
 
+
+void check_Dfs_Function_Compile() 
+{
+  typedef int VType;
+  typedef concept::StaticGraph Graph;
+
+  typedef Graph::Edge Edge;
+  typedef Graph::Node Node;
+  typedef Graph::EdgeIt EdgeIt;
+  typedef Graph::NodeIt NodeIt;
+  typedef concept::ReadMap LengthMap;
+   
+  dfs(Graph(),Node()).run();
+  dfs(Graph()).source(Node()).run();
+  dfs(Graph())
+    .predMap(concept::WriteMap())
+    .distMap(concept::WriteMap())
+    .reachedMap(concept::ReadWriteMap())
+    .processedMap(concept::WriteMap())
+    .run(Node());
+  
+}
+
 int main()
 {
     
diff -r ce885274b754 -r 20b26ee5812b src/test/dijkstra_test.cc
--- a/src/test/dijkstra_test.cc	Wed Mar 16 13:25:19 2005 +0000
+++ b/src/test/dijkstra_test.cc	Wed Mar 16 16:40:21 2005 +0000
@@ -62,6 +62,27 @@
   
 }
 
+void check_Dijkstra_Function_Compile() 
+{
+  typedef int VType;
+  typedef concept::StaticGraph Graph;
+
+  typedef Graph::Edge Edge;
+  typedef Graph::Node Node;
+  typedef Graph::EdgeIt EdgeIt;
+  typedef Graph::NodeIt NodeIt;
+  typedef concept::ReadMap LengthMap;
+   
+  dijkstra(Graph(),LengthMap(),Node()).run();
+  dijkstra(Graph(),LengthMap()).source(Node()).run();
+  dijkstra(Graph(),LengthMap())
+    .predMap(concept::WriteMap())
+    .distMap(concept::WriteMap())
+    .run(Node());
+  
+}
+
+
 int main()
 {