sl@0: //=======================================================================
sl@0: // Copyright 2002 Indiana University.
sl@0: // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
sl@0: //
sl@0: // Distributed under the Boost Software License, Version 1.0. (See
sl@0: // accompanying file LICENSE_1_0.txt or copy at
sl@0: // http://www.boost.org/LICENSE_1_0.txt)
sl@0: //=======================================================================
sl@0: /*
sl@0:  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
sl@0: */
sl@0: 
sl@0: #include <boost/config.hpp>
sl@0: #include <boost/concept_archetype.hpp>
sl@0: #include <boost/graph/dijkstra_shortest_paths.hpp>
sl@0: #include <boost/graph/graph_archetypes.hpp>
sl@0: #ifdef __SYMBIAN32__
sl@0: #include "std_log_result.h"
sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__
sl@0: #endif
sl@0: typedef boost::default_constructible_archetype<
sl@0:   boost::sgi_assignable_archetype<> > dist_value;
sl@0: 
sl@0: // So generate_infinity works...
sl@0: namespace std {
sl@0:   template <>
sl@0:   class numeric_limits<dist_value> {
sl@0:   public:
sl@0:     static dist_value max BOOST_PREVENT_MACRO_SUBSTITUTION () {
sl@0:       return boost::static_object<dist_value>::get(); 
sl@0:     }
sl@0:   };
sl@0: }
sl@0: 
sl@0: dist_value abs(const dist_value& x) { return x; }
sl@0: std::size_t abs(std::size_t x) { return x; }
sl@0: 
sl@0: int main()
sl@0: {
sl@0:   using namespace boost;
sl@0:   typedef default_constructible_archetype< 
sl@0:     sgi_assignable_archetype<
sl@0:     equality_comparable_archetype<> > > vertex_t;
sl@0:   {
sl@0:     typedef incidence_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag> IncidenceGraph;
sl@0:     typedef vertex_list_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag, IncidenceGraph> graph_t;
sl@0:     graph_t& g = static_object<graph_t>::get();
sl@0:     vertex_t s;
sl@0:     typedef graph_traits<graph_t>::edge_descriptor edge_t;
sl@0:     readable_property_map_archetype<edge_t, std::size_t> weight;
sl@0:     readable_property_map_archetype<vertex_t, int> index;
sl@0:     read_write_property_map_archetype<vertex_t, std::size_t> distance;
sl@0:    dijkstra_shortest_paths(g, s, 
sl@0:                             vertex_index_map(index).
sl@0:                             weight_map(weight).
sl@0:                             distance_map(distance));
sl@0:   }
sl@0:   {
sl@0:     typedef incidence_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag> IncidenceGraph;
sl@0:     typedef vertex_list_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag, IncidenceGraph> Graph;
sl@0:     vertex_t s;
sl@0:     typedef graph_traits<Graph>::edge_descriptor edge_t;
sl@0:     readable_property_map_archetype<edge_t, std::size_t> weight;
sl@0:     typedef property_graph_archetype<Graph, vertex_index_t, std::size_t> 
sl@0:       graph_t;
sl@0:     graph_t& g = static_object<graph_t>::get();
sl@0:     read_write_property_map_archetype<vertex_t, vertex_t> pred;
sl@0:     dijkstra_shortest_paths(g, s,
sl@0:                             predecessor_map(pred).
sl@0:                             weight_map(weight));
sl@0:   }
sl@0:   {
sl@0:     typedef incidence_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag> IncidenceGraph;
sl@0:     typedef vertex_list_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag, IncidenceGraph> Graph;
sl@0:     vertex_t s;
sl@0:     typedef property_graph_archetype<Graph, edge_weight_t, std::size_t> 
sl@0:       graph_t;
sl@0:     graph_t& g = static_object<graph_t>::get();
sl@0:     read_write_property_map_archetype<vertex_t, vertex_t> pred;
sl@0:     readable_property_map_archetype<vertex_t, int> index;
sl@0:     dijkstra_shortest_paths(g, s,
sl@0:                             predecessor_map(pred).
sl@0:                             vertex_index_map(index));
sl@0:   }
sl@0:   {
sl@0:     typedef incidence_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag> IncidenceGraph;
sl@0:     typedef vertex_list_graph_archetype<vertex_t, directed_tag, 
sl@0:       allow_parallel_edge_tag, IncidenceGraph> graph_t;
sl@0:     graph_t& g = static_object<graph_t>::get();
sl@0:     vertex_t s;
sl@0:     typedef graph_traits<graph_t>::edge_descriptor edge_t;
sl@0:     readable_property_map_archetype<edge_t, dist_value> weight;
sl@0:     readable_property_map_archetype<vertex_t, int> index;
sl@0:     read_write_property_map_archetype<vertex_t, color_value_archetype> color;
sl@0:     read_write_property_map_archetype<vertex_t, dist_value> distance;
sl@0:     typedef binary_function_archetype<dist_value, dist_value, dist_value> 
sl@0:       Combine;
sl@0:     Combine combine = static_object<Combine>::get();
sl@0:     typedef binary_predicate_archetype<dist_value, dist_value>
sl@0:       Compare;
sl@0:     Compare compare = static_object<Compare>::get();
sl@0:     dijkstra_visitor<> vis;
sl@0: 
sl@0:     dijkstra_shortest_paths(g, s, color_map(color).
sl@0:                             vertex_index_map(index).
sl@0:                             weight_map(weight).
sl@0:                             distance_map(distance).
sl@0:                             distance_combine(combine).
sl@0:                             distance_compare(compare).
sl@0:                             visitor(vis));
sl@0:   }
sl@0:   #ifdef __SYMBIAN32__
sl@0: 	std_log(LOG_FILENAME_LINE,"[End Test Case ]");
sl@0: 
sl@0: 	testResultXml("dijkstra_cc");
sl@0: 	close_log_file();
sl@0: #endif
sl@0:   return 0;
sl@0: }