241 ///\ref PredMap type. |
241 ///\ref PredMap type. |
242 /// |
242 /// |
243 ///\ref named-templ-param "Named parameter" for setting |
243 ///\ref named-templ-param "Named parameter" for setting |
244 ///\ref PredMap type. |
244 ///\ref PredMap type. |
245 template <class T> |
245 template <class T> |
246 struct DefPredMap : public Dfs<Digraph, DefPredMapTraits<T> > { |
246 struct SetPredMap : public Dfs<Digraph, SetPredMapTraits<T> > { |
247 typedef Dfs<Digraph, DefPredMapTraits<T> > Create; |
247 typedef Dfs<Digraph, SetPredMapTraits<T> > Create; |
248 }; |
248 }; |
249 |
249 |
250 template <class T> |
250 template <class T> |
251 struct DefDistMapTraits : public Traits { |
251 struct SetDistMapTraits : public Traits { |
252 typedef T DistMap; |
252 typedef T DistMap; |
253 static DistMap *createDistMap(const Digraph &) |
253 static DistMap *createDistMap(const Digraph &) |
254 { |
254 { |
255 throw UninitializedParameter(); |
255 throw UninitializedParameter(); |
256 } |
256 } |
259 ///\ref DistMap type. |
259 ///\ref DistMap type. |
260 /// |
260 /// |
261 ///\ref named-templ-param "Named parameter" for setting |
261 ///\ref named-templ-param "Named parameter" for setting |
262 ///\ref DistMap type. |
262 ///\ref DistMap type. |
263 template <class T> |
263 template <class T> |
264 struct DefDistMap : public Dfs< Digraph, DefDistMapTraits<T> > { |
264 struct SetDistMap : public Dfs< Digraph, SetDistMapTraits<T> > { |
265 typedef Dfs<Digraph, DefDistMapTraits<T> > Create; |
265 typedef Dfs<Digraph, SetDistMapTraits<T> > Create; |
266 }; |
266 }; |
267 |
267 |
268 template <class T> |
268 template <class T> |
269 struct DefReachedMapTraits : public Traits { |
269 struct SetReachedMapTraits : public Traits { |
270 typedef T ReachedMap; |
270 typedef T ReachedMap; |
271 static ReachedMap *createReachedMap(const Digraph &) |
271 static ReachedMap *createReachedMap(const Digraph &) |
272 { |
272 { |
273 throw UninitializedParameter(); |
273 throw UninitializedParameter(); |
274 } |
274 } |
277 ///\ref ReachedMap type. |
277 ///\ref ReachedMap type. |
278 /// |
278 /// |
279 ///\ref named-templ-param "Named parameter" for setting |
279 ///\ref named-templ-param "Named parameter" for setting |
280 ///\ref ReachedMap type. |
280 ///\ref ReachedMap type. |
281 template <class T> |
281 template <class T> |
282 struct DefReachedMap : public Dfs< Digraph, DefReachedMapTraits<T> > { |
282 struct SetReachedMap : public Dfs< Digraph, SetReachedMapTraits<T> > { |
283 typedef Dfs< Digraph, DefReachedMapTraits<T> > Create; |
283 typedef Dfs< Digraph, SetReachedMapTraits<T> > Create; |
284 }; |
284 }; |
285 |
285 |
286 template <class T> |
286 template <class T> |
287 struct DefProcessedMapTraits : public Traits { |
287 struct SetProcessedMapTraits : public Traits { |
288 typedef T ProcessedMap; |
288 typedef T ProcessedMap; |
289 static ProcessedMap *createProcessedMap(const Digraph &) |
289 static ProcessedMap *createProcessedMap(const Digraph &) |
290 { |
290 { |
291 throw UninitializedParameter(); |
291 throw UninitializedParameter(); |
292 } |
292 } |
295 ///\ref ProcessedMap type. |
295 ///\ref ProcessedMap type. |
296 /// |
296 /// |
297 ///\ref named-templ-param "Named parameter" for setting |
297 ///\ref named-templ-param "Named parameter" for setting |
298 ///\ref ProcessedMap type. |
298 ///\ref ProcessedMap type. |
299 template <class T> |
299 template <class T> |
300 struct DefProcessedMap : public Dfs< Digraph, DefProcessedMapTraits<T> > { |
300 struct SetProcessedMap : public Dfs< Digraph, SetProcessedMapTraits<T> > { |
301 typedef Dfs< Digraph, DefProcessedMapTraits<T> > Create; |
301 typedef Dfs< Digraph, SetProcessedMapTraits<T> > Create; |
302 }; |
302 }; |
303 |
303 |
304 struct DefDigraphProcessedMapTraits : public Traits { |
304 struct SetStandardProcessedMapTraits : public Traits { |
305 typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
305 typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
306 static ProcessedMap *createProcessedMap(const Digraph &g) |
306 static ProcessedMap *createProcessedMap(const Digraph &g) |
307 { |
307 { |
308 return new ProcessedMap(g); |
308 return new ProcessedMap(g); |
309 } |
309 } |
312 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
312 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
313 /// |
313 /// |
314 ///\ref named-templ-param "Named parameter" for setting |
314 ///\ref named-templ-param "Named parameter" for setting |
315 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
315 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
316 ///If you don't set it explicitly, it will be automatically allocated. |
316 ///If you don't set it explicitly, it will be automatically allocated. |
317 template <class T> |
317 struct SetStandardProcessedMap : |
318 struct DefProcessedMapToBeDefaultMap : |
318 public Dfs< Digraph, SetStandardProcessedMapTraits > { |
319 public Dfs< Digraph, DefDigraphProcessedMapTraits> { |
319 typedef Dfs< Digraph, SetStandardProcessedMapTraits > Create; |
320 typedef Dfs< Digraph, DefDigraphProcessedMapTraits> Create; |
|
321 }; |
320 }; |
322 |
321 |
323 ///@} |
322 ///@} |
324 |
323 |
325 public: |
324 public: |
998 Base::_source=s; |
997 Base::_source=s; |
999 return *this; |
998 return *this; |
1000 } |
999 } |
1001 |
1000 |
1002 template<class T> |
1001 template<class T> |
1003 struct DefPredMapBase : public Base { |
1002 struct SetPredMapBase : public Base { |
1004 typedef T PredMap; |
1003 typedef T PredMap; |
1005 static PredMap *createPredMap(const Digraph &) { return 0; }; |
1004 static PredMap *createPredMap(const Digraph &) { return 0; }; |
1006 DefPredMapBase(const TR &b) : TR(b) {} |
1005 SetPredMapBase(const TR &b) : TR(b) {} |
1007 }; |
1006 }; |
1008 ///\brief \ref named-templ-param "Named parameter" |
1007 ///\brief \ref named-templ-param "Named parameter" |
1009 ///for setting \ref PredMap object. |
1008 ///for setting \ref PredMap object. |
1010 /// |
1009 /// |
1011 ///\ref named-templ-param "Named parameter" |
1010 ///\ref named-templ-param "Named parameter" |
1012 ///for setting \ref PredMap object. |
1011 ///for setting \ref PredMap object. |
1013 template<class T> |
1012 template<class T> |
1014 DfsWizard<DefPredMapBase<T> > predMap(const T &t) |
1013 DfsWizard<SetPredMapBase<T> > predMap(const T &t) |
1015 { |
1014 { |
1016 Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1015 Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1017 return DfsWizard<DefPredMapBase<T> >(*this); |
1016 return DfsWizard<SetPredMapBase<T> >(*this); |
1018 } |
1017 } |
1019 |
1018 |
1020 template<class T> |
1019 template<class T> |
1021 struct DefReachedMapBase : public Base { |
1020 struct SetReachedMapBase : public Base { |
1022 typedef T ReachedMap; |
1021 typedef T ReachedMap; |
1023 static ReachedMap *createReachedMap(const Digraph &) { return 0; }; |
1022 static ReachedMap *createReachedMap(const Digraph &) { return 0; }; |
1024 DefReachedMapBase(const TR &b) : TR(b) {} |
1023 SetReachedMapBase(const TR &b) : TR(b) {} |
1025 }; |
1024 }; |
1026 ///\brief \ref named-templ-param "Named parameter" |
1025 ///\brief \ref named-templ-param "Named parameter" |
1027 ///for setting \ref ReachedMap object. |
1026 ///for setting \ref ReachedMap object. |
1028 /// |
1027 /// |
1029 /// \ref named-templ-param "Named parameter" |
1028 /// \ref named-templ-param "Named parameter" |
1030 ///for setting \ref ReachedMap object. |
1029 ///for setting \ref ReachedMap object. |
1031 template<class T> |
1030 template<class T> |
1032 DfsWizard<DefReachedMapBase<T> > reachedMap(const T &t) |
1031 DfsWizard<SetReachedMapBase<T> > reachedMap(const T &t) |
1033 { |
1032 { |
1034 Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1033 Base::_reached=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1035 return DfsWizard<DefReachedMapBase<T> >(*this); |
1034 return DfsWizard<SetReachedMapBase<T> >(*this); |
1036 } |
1035 } |
1037 |
1036 |
1038 template<class T> |
1037 template<class T> |
1039 struct DefProcessedMapBase : public Base { |
1038 struct SetProcessedMapBase : public Base { |
1040 typedef T ProcessedMap; |
1039 typedef T ProcessedMap; |
1041 static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1040 static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1042 DefProcessedMapBase(const TR &b) : TR(b) {} |
1041 SetProcessedMapBase(const TR &b) : TR(b) {} |
1043 }; |
1042 }; |
1044 ///\brief \ref named-templ-param "Named parameter" |
1043 ///\brief \ref named-templ-param "Named parameter" |
1045 ///for setting \ref ProcessedMap object. |
1044 ///for setting \ref ProcessedMap object. |
1046 /// |
1045 /// |
1047 /// \ref named-templ-param "Named parameter" |
1046 /// \ref named-templ-param "Named parameter" |
1048 ///for setting \ref ProcessedMap object. |
1047 ///for setting \ref ProcessedMap object. |
1049 template<class T> |
1048 template<class T> |
1050 DfsWizard<DefProcessedMapBase<T> > processedMap(const T &t) |
1049 DfsWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
1051 { |
1050 { |
1052 Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1051 Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1053 return DfsWizard<DefProcessedMapBase<T> >(*this); |
1052 return DfsWizard<SetProcessedMapBase<T> >(*this); |
1054 } |
1053 } |
1055 |
1054 |
1056 template<class T> |
1055 template<class T> |
1057 struct DefDistMapBase : public Base { |
1056 struct SetDistMapBase : public Base { |
1058 typedef T DistMap; |
1057 typedef T DistMap; |
1059 static DistMap *createDistMap(const Digraph &) { return 0; }; |
1058 static DistMap *createDistMap(const Digraph &) { return 0; }; |
1060 DefDistMapBase(const TR &b) : TR(b) {} |
1059 SetDistMapBase(const TR &b) : TR(b) {} |
1061 }; |
1060 }; |
1062 ///\brief \ref named-templ-param "Named parameter" |
1061 ///\brief \ref named-templ-param "Named parameter" |
1063 ///for setting \ref DistMap object. |
1062 ///for setting \ref DistMap object. |
1064 /// |
1063 /// |
1065 ///\ref named-templ-param "Named parameter" |
1064 ///\ref named-templ-param "Named parameter" |
1066 ///for setting \ref DistMap object. |
1065 ///for setting \ref DistMap object. |
1067 template<class T> |
1066 template<class T> |
1068 DfsWizard<DefDistMapBase<T> > distMap(const T &t) |
1067 DfsWizard<SetDistMapBase<T> > distMap(const T &t) |
1069 { |
1068 { |
1070 Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1069 Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1071 return DfsWizard<DefDistMapBase<T> >(*this); |
1070 return DfsWizard<SetDistMapBase<T> >(*this); |
1072 } |
1071 } |
1073 |
1072 |
1074 }; |
1073 }; |
1075 |
1074 |
1076 ///Function type interface for Dfs algorithm. |
1075 ///Function type interface for Dfs algorithm. |
1294 |
1293 |
1295 /// \name Named template parameters |
1294 /// \name Named template parameters |
1296 |
1295 |
1297 ///@{ |
1296 ///@{ |
1298 template <class T> |
1297 template <class T> |
1299 struct DefReachedMapTraits : public Traits { |
1298 struct SetReachedMapTraits : public Traits { |
1300 typedef T ReachedMap; |
1299 typedef T ReachedMap; |
1301 static ReachedMap *createReachedMap(const Digraph &digraph) { |
1300 static ReachedMap *createReachedMap(const Digraph &digraph) { |
1302 throw UninitializedParameter(); |
1301 throw UninitializedParameter(); |
1303 } |
1302 } |
1304 }; |
1303 }; |
1305 /// \brief \ref named-templ-param "Named parameter" for setting |
1304 /// \brief \ref named-templ-param "Named parameter" for setting |
1306 /// ReachedMap type. |
1305 /// ReachedMap type. |
1307 /// |
1306 /// |
1308 /// \ref named-templ-param "Named parameter" for setting ReachedMap type. |
1307 /// \ref named-templ-param "Named parameter" for setting ReachedMap type. |
1309 template <class T> |
1308 template <class T> |
1310 struct DefReachedMap : public DfsVisit< Digraph, Visitor, |
1309 struct SetReachedMap : public DfsVisit< Digraph, Visitor, |
1311 DefReachedMapTraits<T> > { |
1310 SetReachedMapTraits<T> > { |
1312 typedef DfsVisit< Digraph, Visitor, DefReachedMapTraits<T> > Create; |
1311 typedef DfsVisit< Digraph, Visitor, SetReachedMapTraits<T> > Create; |
1313 }; |
1312 }; |
1314 ///@} |
1313 ///@} |
1315 |
1314 |
1316 public: |
1315 public: |
1317 |
1316 |