diff -r 8fea0e60f855 -r a323456bf7c8 lemon/dfs.h --- a/lemon/dfs.h Wed Oct 05 13:44:29 2005 +0000 +++ b/lemon/dfs.h Wed Oct 05 16:45:37 2005 +0000 @@ -57,23 +57,6 @@ { return new PredMap(G); } -// ///\brief The type of the map that stores the last but one -// ///nodes of the %DFS paths. -// /// -// ///The type of the map that stores the last but one -// ///nodes of the %DFS paths. -// ///It must meet the \ref concept::WriteMap "WriteMap" concept. -// /// -// typedef NullMap PredNodeMap; -// ///Instantiates a PredNodeMap. - -// ///This function instantiates a \ref PredNodeMap. -// ///\param G is the graph, to which -// ///we would like to define the \ref PredNodeMap -// static PredNodeMap *createPredNodeMap(const GR &G) -// { -// return new PredNodeMap(); -// } ///The type of the map that indicates which nodes are processed. @@ -179,9 +162,6 @@ ///\brief The type of the map that stores the last ///edges of the %DFS paths. typedef typename TR::PredMap PredMap; -// ///\brief The type of the map that stores the last but one -// ///nodes of the %DFS paths. -// typedef typename TR::PredNodeMap PredNodeMap; ///The type of the map indicating which nodes are reached. typedef typename TR::ReachedMap ReachedMap; ///The type of the map indicating which nodes are processed. @@ -195,10 +175,6 @@ PredMap *_pred; ///Indicates if \ref _pred is locally allocated (\c true) or not. bool local_pred; -// ///Pointer to the map of predecessors nodes. -// PredNodeMap *_predNode; -// ///Indicates if \ref _predNode is locally allocated (\c true) or not. -// bool local_predNode; ///Pointer to the map of distances. DistMap *_dist; ///Indicates if \ref _dist is locally allocated (\c true) or not. @@ -214,8 +190,6 @@ std::vector _stack; int _stack_head; -// ///The source node of the last execution. -// Node source; ///Creates the maps if necessary. @@ -227,10 +201,6 @@ local_pred = true; _pred = Traits::createPredMap(*G); } -// if(!_predNode) { -// local_predNode = true; -// _predNode = Traits::createPredNodeMap(*G); -// } if(!_dist) { local_dist = true; _dist = Traits::createDistMap(*G); @@ -246,7 +216,9 @@ } public : - + + typedef Dfs Create; + ///\name Named template parameters ///@{ @@ -264,25 +236,10 @@ ///\ref named-templ-param "Named parameter" for setting PredMap type /// template - class DefPredMap : public Dfs< Graph, - DefPredMapTraits > { }; + struct DefPredMap : public Dfs > { + typedef Dfs > Create; + }; -// template -// struct DefPredNodeMapTraits : public Traits { -// typedef T PredNodeMap; -// static PredNodeMap *createPredNodeMap(const Graph &G) -// { -// throw UninitializedParameter(); -// } -// }; -// ///\ref named-templ-param "Named parameter" for setting PredNodeMap type - -// ///\ref named-templ-param "Named parameter" for setting PredNodeMap type -// /// -// template -// class DefPredNodeMap : public Dfs< Graph, -// LengthMap, -// DefPredNodeMapTraits > { }; template struct DefDistMapTraits : public Traits { @@ -297,8 +254,9 @@ ///\ref named-templ-param "Named parameter" for setting DistMap type /// template - class DefDistMap : public Dfs< Graph, - DefDistMapTraits > { }; + struct DefDistMap { + typedef Dfs > Create; + }; template struct DefReachedMapTraits : public Traits { @@ -313,16 +271,10 @@ ///\ref named-templ-param "Named parameter" for setting ReachedMap type /// template - class DefReachedMap : public Dfs< Graph, - DefReachedMapTraits > { }; - - struct DefGraphReachedMapTraits : public Traits { - typedef typename Graph::template NodeMap ReachedMap; - static ReachedMap *createReachedMap(const Graph &G) - { - return new ReachedMap(G); - } + struct DefReachedMap { + typedef Dfs< Graph, DefReachedMapTraits > Create; }; + template struct DefProcessedMapTraits : public Traits { typedef T ProcessedMap; @@ -337,7 +289,7 @@ /// template struct DefProcessedMap : public Dfs< Graph, DefProcessedMapTraits > { - typedef Dfs< Graph, DefProcessedMapTraits > Dfs; + typedef Dfs< Graph, DefProcessedMapTraits > Create; }; struct DefGraphProcessedMapTraits : public Traits { @@ -355,8 +307,9 @@ ///If you don't set it explicitely, it will be automatically allocated. template class DefProcessedMapToBeDefaultMap : - public Dfs< Graph, - DefGraphProcessedMapTraits> { }; + public Dfs< Graph, DefGraphProcessedMapTraits> { + typedef Dfs< Graph, DefGraphProcessedMapTraits> Create; + }; ///@}