342 ///\ref PredMap type. |
342 ///\ref PredMap type. |
343 /// |
343 /// |
344 ///\ref named-templ-param "Named parameter" for setting |
344 ///\ref named-templ-param "Named parameter" for setting |
345 ///\ref PredMap type. |
345 ///\ref PredMap type. |
346 template <class T> |
346 template <class T> |
347 struct DefPredMap |
347 struct SetPredMap |
348 : public Dijkstra< Digraph, LengthMap, DefPredMapTraits<T> > { |
348 : public Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > { |
349 typedef Dijkstra< Digraph, LengthMap, DefPredMapTraits<T> > Create; |
349 typedef Dijkstra< Digraph, LengthMap, SetPredMapTraits<T> > Create; |
350 }; |
350 }; |
351 |
351 |
352 template <class T> |
352 template <class T> |
353 struct DefDistMapTraits : public Traits { |
353 struct SetDistMapTraits : public Traits { |
354 typedef T DistMap; |
354 typedef T DistMap; |
355 static DistMap *createDistMap(const Digraph &) |
355 static DistMap *createDistMap(const Digraph &) |
356 { |
356 { |
357 throw UninitializedParameter(); |
357 throw UninitializedParameter(); |
358 } |
358 } |
361 ///\ref DistMap type. |
361 ///\ref DistMap type. |
362 /// |
362 /// |
363 ///\ref named-templ-param "Named parameter" for setting |
363 ///\ref named-templ-param "Named parameter" for setting |
364 ///\ref DistMap type. |
364 ///\ref DistMap type. |
365 template <class T> |
365 template <class T> |
366 struct DefDistMap |
366 struct SetDistMap |
367 : public Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > { |
367 : public Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > { |
368 typedef Dijkstra< Digraph, LengthMap, DefDistMapTraits<T> > Create; |
368 typedef Dijkstra< Digraph, LengthMap, SetDistMapTraits<T> > Create; |
369 }; |
369 }; |
370 |
370 |
371 template <class T> |
371 template <class T> |
372 struct DefProcessedMapTraits : public Traits { |
372 struct SetProcessedMapTraits : public Traits { |
373 typedef T ProcessedMap; |
373 typedef T ProcessedMap; |
374 static ProcessedMap *createProcessedMap(const Digraph &) |
374 static ProcessedMap *createProcessedMap(const Digraph &) |
375 { |
375 { |
376 throw UninitializedParameter(); |
376 throw UninitializedParameter(); |
377 } |
377 } |
380 ///\ref ProcessedMap type. |
380 ///\ref ProcessedMap type. |
381 /// |
381 /// |
382 ///\ref named-templ-param "Named parameter" for setting |
382 ///\ref named-templ-param "Named parameter" for setting |
383 ///\ref ProcessedMap type. |
383 ///\ref ProcessedMap type. |
384 template <class T> |
384 template <class T> |
385 struct DefProcessedMap |
385 struct SetProcessedMap |
386 : public Dijkstra< Digraph, LengthMap, DefProcessedMapTraits<T> > { |
386 : public Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > { |
387 typedef Dijkstra< Digraph, LengthMap, DefProcessedMapTraits<T> > Create; |
387 typedef Dijkstra< Digraph, LengthMap, SetProcessedMapTraits<T> > Create; |
388 }; |
388 }; |
389 |
389 |
390 struct DefDigraphProcessedMapTraits : public Traits { |
390 struct SetStandardProcessedMapTraits : public Traits { |
391 typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
391 typedef typename Digraph::template NodeMap<bool> ProcessedMap; |
392 static ProcessedMap *createProcessedMap(const Digraph &g) |
392 static ProcessedMap *createProcessedMap(const Digraph &g) |
393 { |
393 { |
394 return new ProcessedMap(g); |
394 return new ProcessedMap(g); |
395 } |
395 } |
398 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
398 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
399 /// |
399 /// |
400 ///\ref named-templ-param "Named parameter" for setting |
400 ///\ref named-templ-param "Named parameter" for setting |
401 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
401 ///\ref ProcessedMap type to be <tt>Digraph::NodeMap<bool></tt>. |
402 ///If you don't set it explicitly, it will be automatically allocated. |
402 ///If you don't set it explicitly, it will be automatically allocated. |
403 template <class T> |
403 struct SetStandardProcessedMap |
404 struct DefProcessedMapToBeDefaultMap |
404 : public Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits > { |
405 : public Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> { |
405 typedef Dijkstra< Digraph, LengthMap, SetStandardProcessedMapTraits > |
406 typedef Dijkstra< Digraph, LengthMap, DefDigraphProcessedMapTraits> |
|
407 Create; |
406 Create; |
408 }; |
407 }; |
409 |
408 |
410 template <class H, class CR> |
409 template <class H, class CR> |
411 struct DefHeapTraits : public Traits { |
410 struct SetHeapTraits : public Traits { |
412 typedef CR HeapCrossRef; |
411 typedef CR HeapCrossRef; |
413 typedef H Heap; |
412 typedef H Heap; |
414 static HeapCrossRef *createHeapCrossRef(const Digraph &) { |
413 static HeapCrossRef *createHeapCrossRef(const Digraph &) { |
415 throw UninitializedParameter(); |
414 throw UninitializedParameter(); |
416 } |
415 } |
423 ///heap and cross reference type |
422 ///heap and cross reference type |
424 /// |
423 /// |
425 ///\ref named-templ-param "Named parameter" for setting heap and cross |
424 ///\ref named-templ-param "Named parameter" for setting heap and cross |
426 ///reference type. |
425 ///reference type. |
427 template <class H, class CR = typename Digraph::template NodeMap<int> > |
426 template <class H, class CR = typename Digraph::template NodeMap<int> > |
428 struct DefHeap |
427 struct SetHeap |
429 : public Dijkstra< Digraph, LengthMap, DefHeapTraits<H, CR> > { |
428 : public Dijkstra< Digraph, LengthMap, SetHeapTraits<H, CR> > { |
430 typedef Dijkstra< Digraph, LengthMap, DefHeapTraits<H, CR> > Create; |
429 typedef Dijkstra< Digraph, LengthMap, SetHeapTraits<H, CR> > Create; |
431 }; |
430 }; |
432 |
431 |
433 template <class H, class CR> |
432 template <class H, class CR> |
434 struct DefStandardHeapTraits : public Traits { |
433 struct SetStandardHeapTraits : public Traits { |
435 typedef CR HeapCrossRef; |
434 typedef CR HeapCrossRef; |
436 typedef H Heap; |
435 typedef H Heap; |
437 static HeapCrossRef *createHeapCrossRef(const Digraph &G) { |
436 static HeapCrossRef *createHeapCrossRef(const Digraph &G) { |
438 return new HeapCrossRef(G); |
437 return new HeapCrossRef(G); |
439 } |
438 } |
448 ///\ref named-templ-param "Named parameter" for setting heap and cross |
447 ///\ref named-templ-param "Named parameter" for setting heap and cross |
449 ///reference type. It can allocate the heap and the cross reference |
448 ///reference type. It can allocate the heap and the cross reference |
450 ///object if the cross reference's constructor waits for the digraph as |
449 ///object if the cross reference's constructor waits for the digraph as |
451 ///parameter and the heap's constructor waits for the cross reference. |
450 ///parameter and the heap's constructor waits for the cross reference. |
452 template <class H, class CR = typename Digraph::template NodeMap<int> > |
451 template <class H, class CR = typename Digraph::template NodeMap<int> > |
453 struct DefStandardHeap |
452 struct SetStandardHeap |
454 : public Dijkstra< Digraph, LengthMap, DefStandardHeapTraits<H, CR> > { |
453 : public Dijkstra< Digraph, LengthMap, SetStandardHeapTraits<H, CR> > { |
455 typedef Dijkstra< Digraph, LengthMap, DefStandardHeapTraits<H, CR> > |
454 typedef Dijkstra< Digraph, LengthMap, SetStandardHeapTraits<H, CR> > |
456 Create; |
455 Create; |
457 }; |
456 }; |
458 |
457 |
459 template <class T> |
458 template <class T> |
460 struct DefOperationTraitsTraits : public Traits { |
459 struct SetOperationTraitsTraits : public Traits { |
461 typedef T OperationTraits; |
460 typedef T OperationTraits; |
462 }; |
461 }; |
463 |
462 |
464 /// \brief \ref named-templ-param "Named parameter" for setting |
463 /// \brief \ref named-templ-param "Named parameter" for setting |
465 ///\ref OperationTraits type |
464 ///\ref OperationTraits type |
466 /// |
465 /// |
467 ///\ref named-templ-param "Named parameter" for setting |
466 ///\ref named-templ-param "Named parameter" for setting |
468 ///\ref OperationTraits type. |
467 ///\ref OperationTraits type. |
469 template <class T> |
468 template <class T> |
470 struct DefOperationTraits |
469 struct SetOperationTraits |
471 : public Dijkstra<Digraph, LengthMap, DefOperationTraitsTraits<T> > { |
470 : public Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> > { |
472 typedef Dijkstra<Digraph, LengthMap, DefOperationTraitsTraits<T> > |
471 typedef Dijkstra<Digraph, LengthMap, SetOperationTraitsTraits<T> > |
473 Create; |
472 Create; |
474 }; |
473 }; |
475 |
474 |
476 ///@} |
475 ///@} |
477 |
476 |
1197 Base::_source=s; |
1196 Base::_source=s; |
1198 return *this; |
1197 return *this; |
1199 } |
1198 } |
1200 |
1199 |
1201 template<class T> |
1200 template<class T> |
1202 struct DefPredMapBase : public Base { |
1201 struct SetPredMapBase : public Base { |
1203 typedef T PredMap; |
1202 typedef T PredMap; |
1204 static PredMap *createPredMap(const Digraph &) { return 0; }; |
1203 static PredMap *createPredMap(const Digraph &) { return 0; }; |
1205 DefPredMapBase(const TR &b) : TR(b) {} |
1204 SetPredMapBase(const TR &b) : TR(b) {} |
1206 }; |
1205 }; |
1207 ///\brief \ref named-templ-param "Named parameter" |
1206 ///\brief \ref named-templ-param "Named parameter" |
1208 ///for setting \ref PredMap object. |
1207 ///for setting \ref PredMap object. |
1209 /// |
1208 /// |
1210 ///\ref named-templ-param "Named parameter" |
1209 ///\ref named-templ-param "Named parameter" |
1211 ///for setting \ref PredMap object. |
1210 ///for setting \ref PredMap object. |
1212 template<class T> |
1211 template<class T> |
1213 DijkstraWizard<DefPredMapBase<T> > predMap(const T &t) |
1212 DijkstraWizard<SetPredMapBase<T> > predMap(const T &t) |
1214 { |
1213 { |
1215 Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1214 Base::_pred=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1216 return DijkstraWizard<DefPredMapBase<T> >(*this); |
1215 return DijkstraWizard<SetPredMapBase<T> >(*this); |
1217 } |
1216 } |
1218 |
1217 |
1219 template<class T> |
1218 template<class T> |
1220 struct DefProcessedMapBase : public Base { |
1219 struct SetProcessedMapBase : public Base { |
1221 typedef T ProcessedMap; |
1220 typedef T ProcessedMap; |
1222 static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1221 static ProcessedMap *createProcessedMap(const Digraph &) { return 0; }; |
1223 DefProcessedMapBase(const TR &b) : TR(b) {} |
1222 SetProcessedMapBase(const TR &b) : TR(b) {} |
1224 }; |
1223 }; |
1225 ///\brief \ref named-templ-param "Named parameter" |
1224 ///\brief \ref named-templ-param "Named parameter" |
1226 ///for setting \ref ProcessedMap object. |
1225 ///for setting \ref ProcessedMap object. |
1227 /// |
1226 /// |
1228 /// \ref named-templ-param "Named parameter" |
1227 /// \ref named-templ-param "Named parameter" |
1229 ///for setting \ref ProcessedMap object. |
1228 ///for setting \ref ProcessedMap object. |
1230 template<class T> |
1229 template<class T> |
1231 DijkstraWizard<DefProcessedMapBase<T> > processedMap(const T &t) |
1230 DijkstraWizard<SetProcessedMapBase<T> > processedMap(const T &t) |
1232 { |
1231 { |
1233 Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1232 Base::_processed=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1234 return DijkstraWizard<DefProcessedMapBase<T> >(*this); |
1233 return DijkstraWizard<SetProcessedMapBase<T> >(*this); |
1235 } |
1234 } |
1236 |
1235 |
1237 template<class T> |
1236 template<class T> |
1238 struct DefDistMapBase : public Base { |
1237 struct SetDistMapBase : public Base { |
1239 typedef T DistMap; |
1238 typedef T DistMap; |
1240 static DistMap *createDistMap(const Digraph &) { return 0; }; |
1239 static DistMap *createDistMap(const Digraph &) { return 0; }; |
1241 DefDistMapBase(const TR &b) : TR(b) {} |
1240 SetDistMapBase(const TR &b) : TR(b) {} |
1242 }; |
1241 }; |
1243 ///\brief \ref named-templ-param "Named parameter" |
1242 ///\brief \ref named-templ-param "Named parameter" |
1244 ///for setting \ref DistMap object. |
1243 ///for setting \ref DistMap object. |
1245 /// |
1244 /// |
1246 ///\ref named-templ-param "Named parameter" |
1245 ///\ref named-templ-param "Named parameter" |
1247 ///for setting \ref DistMap object. |
1246 ///for setting \ref DistMap object. |
1248 template<class T> |
1247 template<class T> |
1249 DijkstraWizard<DefDistMapBase<T> > distMap(const T &t) |
1248 DijkstraWizard<SetDistMapBase<T> > distMap(const T &t) |
1250 { |
1249 { |
1251 Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1250 Base::_dist=reinterpret_cast<void*>(const_cast<T*>(&t)); |
1252 return DijkstraWizard<DefDistMapBase<T> >(*this); |
1251 return DijkstraWizard<SetDistMapBase<T> >(*this); |
1253 } |
1252 } |
1254 |
1253 |
1255 }; |
1254 }; |
1256 |
1255 |
1257 ///Function type interface for Dijkstra algorithm. |
1256 ///Function type interface for Dijkstra algorithm. |