BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/boost/graph/named_function_params.h
Go to the documentation of this file.
00001 //=======================================================================
00002 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
00003 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
00004 //
00005 // This file is part of the Boost Graph Library
00006 //
00007 // You should have received a copy of the License Agreement for the
00008 // Boost Graph Library along with the software; see the file LICENSE.
00009 // If not, contact Office of Research, University of Notre Dame, Notre
00010 // Dame, IN 46556.
00011 //
00012 // Permission to modify the code and to distribute modified code is
00013 // granted, provided the text of this NOTICE is retained, a notice that
00014 // the code was modified is included with the above COPYRIGHT NOTICE and
00015 // with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
00016 // file is distributed with the modified code.
00017 //
00018 // LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
00019 // By way of example, but not limitation, Licensor MAKES NO
00020 // REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
00021 // PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
00022 // OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
00023 // OR OTHER RIGHTS.
00024 
00025 //=======================================================================
00026 // Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
00027 //
00028 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
00029 // modify it under the terms of the GNU Lesser General Public License as
00030 // published by the Free Software Foundation; version 2.1 of the License.
00031 // See the file LICENSE.LGPL distributed with CGAL.
00032 //
00033 // Licensees holding a valid commercial license may use this file in
00034 // accordance with the commercial license agreement provided with the software.
00035 //
00036 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00037 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00038 //
00039 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/BGL/include/CGAL/boost/graph/named_function_params.h $
00040 // $Id: named_function_params.h 37284 2007-03-19 19:36:49Z afabri $
00041 // 
00042 //
00043 // Author(s)     : Andreas Fabri, Fernando Cacciola
00044 
00045 
00046 
00047 #ifndef CGAL_BOOST_GRAPH_NAMED_FUNCTION_PARAMS_H
00048 #define CGAL_BOOST_GRAPH_NAMED_FUNCTION_PARAMS_H
00049 
00050 #include <CGAL/basic.h>
00051 #include <boost/graph/properties.hpp>
00052 #include <boost/graph/named_function_params.hpp>
00053 
00054 CGAL_BEGIN_NAMESPACE
00055 
00056   enum vertex_is_fixed_t             { vertex_is_fixed             } ;  
00057   enum set_cache_policy_t            { set_cache_policy            } ;
00058   enum get_cost_policy_t             { get_cost_policy             } ;
00059   enum get_cost_policy_params_t      { get_cost_policy_params      } ;
00060   enum get_placement_policy_t        { get_placement_policy        } ;
00061   enum get_placement_policy_params_t { get_placement_policy_params } ;
00062   
00063   template <typename T, typename Tag, typename Base = boost::no_property>
00064   struct cgal_bgl_named_params : public Base
00065   {
00066     typedef cgal_bgl_named_params self;
00067     typedef Base next_type;
00068     typedef Tag tag_type;
00069     typedef T value_type;
00070 
00071     cgal_bgl_named_params() { }
00072 
00073     cgal_bgl_named_params(T v) : m_value(v) { }
00074     cgal_bgl_named_params(T v, const Base& b) : Base(b), m_value(v) { }
00075 
00076     T m_value;
00077 
00078     template <typename IndexMap>
00079     cgal_bgl_named_params<IndexMap, boost::vertex_index_t, self>
00080     vertex_index_map(const IndexMap& p) const 
00081     {
00082       typedef cgal_bgl_named_params<IndexMap, boost::vertex_index_t, self> Params;
00083       return Params(p, *this);
00084     }
00085     
00086     template <typename PointMap>
00087     cgal_bgl_named_params<PointMap, vertex_point_t, self>
00088     vertex_point_map(const PointMap& p) const 
00089     {
00090       typedef cgal_bgl_named_params<PointMap, vertex_point_t, self> Params;
00091       return Params(p, *this);
00092     }
00093     
00094     template <typename IsFixedMap>
00095     cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t, self>
00096     vertex_is_fixed_map(const IsFixedMap& p) const 
00097     {
00098       typedef cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t, self> Params;
00099       return Params(p, *this);
00100     }
00101     
00102     template <typename IndexMap>
00103     cgal_bgl_named_params<IndexMap, boost::edge_index_t, self>
00104     edge_index_map(const IndexMap& p) const 
00105     {
00106       typedef cgal_bgl_named_params<IndexMap, boost::edge_index_t, self> Params;
00107       return Params(p, *this);
00108     }
00109     
00110     template <typename IsBorderMap>
00111     cgal_bgl_named_params<IsBorderMap, edge_is_border_t, self>
00112     edge_is_border_map(const IsBorderMap& p) const 
00113     {
00114       typedef cgal_bgl_named_params<IsBorderMap, edge_is_border_t, self> Params;
00115       return Params(p, *this);
00116     }
00117 
00118     template <typename Visitor>
00119     cgal_bgl_named_params<Visitor, boost::graph_visitor_t, self>
00120     visitor(const Visitor& p) const 
00121     {
00122       typedef cgal_bgl_named_params<Visitor, boost::graph_visitor_t, self> Params;
00123       return Params(p, *this);
00124     }
00125     
00126     template <typename SetCache>
00127     cgal_bgl_named_params<SetCache, set_cache_policy_t, self>
00128     set_cache(const SetCache& p) const 
00129     {
00130       typedef cgal_bgl_named_params<SetCache, set_cache_policy_t, self> Params;
00131       return Params(p, *this);
00132     }
00133     
00134     template <typename GetCost>
00135     cgal_bgl_named_params<GetCost, get_cost_policy_t, self>
00136     get_cost(const GetCost& p) const 
00137     {
00138       typedef cgal_bgl_named_params<GetCost, get_cost_policy_t, self> Params;
00139       return Params(p, *this);
00140     }
00141     
00142     template <typename GetCostParams>
00143     cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t, self>
00144     get_cost_params(const GetCostParams& p) const 
00145     {
00146       typedef cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t, self> Params;
00147       return Params(p, *this);
00148     }
00149     
00150     template <typename GetPlacement>
00151     cgal_bgl_named_params<GetPlacement, get_placement_policy_t, self>
00152     get_placement(const GetPlacement& p) const 
00153     {
00154       typedef cgal_bgl_named_params<GetPlacement, get_placement_policy_t, self> Params;
00155       return Params(p, *this);
00156     }
00157     
00158     template <typename GetPlacementParams>
00159     cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t, self>
00160     get_placement_params(const GetPlacementParams& p) const 
00161     {
00162       typedef cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t, self> Params;
00163       return Params(p, *this);
00164     }
00165   };
00166 
00167   template <typename IndexMap>
00168   cgal_bgl_named_params<IndexMap, boost::vertex_index_t>
00169   vertex_index_map(IndexMap const& p) 
00170   {
00171     typedef cgal_bgl_named_params<IndexMap, boost::vertex_index_t> Params;
00172     return Params(p);
00173   }
00174   
00175   template <typename PointMap>
00176   cgal_bgl_named_params<PointMap, vertex_point_t>
00177   vertex_point_map(PointMap const& p) 
00178   {
00179     typedef cgal_bgl_named_params<PointMap, vertex_point_t> Params;
00180     return Params(p);
00181   }
00182 
00183   template <typename IsFixedMap>
00184   cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t>
00185   vertex_is_fixed_map(IsFixedMap const& p) 
00186   {
00187     typedef cgal_bgl_named_params<IsFixedMap, vertex_is_fixed_t> Params;
00188     return Params(p);
00189   }
00190   
00191   template <typename IndexMap>
00192   cgal_bgl_named_params<IndexMap, boost::edge_index_t>
00193   edge_index_map(IndexMap const& pmap) 
00194   {
00195     typedef cgal_bgl_named_params<IndexMap, boost::edge_index_t> Params;
00196     return Params(pmap);
00197   }
00198   
00199   template <typename IsBorderMap>
00200   cgal_bgl_named_params<IsBorderMap, edge_is_border_t>
00201   edge_is_border_map(IsBorderMap const& p) 
00202   {
00203     typedef cgal_bgl_named_params<IsBorderMap, edge_is_border_t> Params;
00204     return Params(p);
00205   }
00206   
00207   template <typename Visitor>
00208   cgal_bgl_named_params<Visitor, boost::graph_visitor_t>
00209   visitor(const Visitor& p) 
00210   {
00211     typedef cgal_bgl_named_params<Visitor, boost::graph_visitor_t> Params;
00212     return Params(p);
00213   }
00214 
00215   template <typename SetCache>
00216   cgal_bgl_named_params<SetCache, set_cache_policy_t>
00217   set_cache(const SetCache& p) 
00218   {
00219     typedef cgal_bgl_named_params<SetCache, set_cache_policy_t> Params;
00220     return Params(p);
00221   }
00222   
00223   template <typename GetCost>
00224   cgal_bgl_named_params<GetCost, get_cost_policy_t>
00225   get_cost(const GetCost& p)
00226   {
00227     typedef cgal_bgl_named_params<GetCost, get_cost_policy_t> Params;
00228      return Params(p);
00229   }
00230 
00231   template <typename GetCostParams>
00232   cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t>
00233   get_cost_params(const GetCostParams& p)
00234   {
00235     typedef cgal_bgl_named_params<GetCostParams, get_cost_policy_params_t> Params;
00236     return Params(p);
00237   }
00238   
00239   template <typename GetPlacement>
00240   cgal_bgl_named_params<GetPlacement, get_placement_policy_t>
00241   get_placement(const GetPlacement& p) 
00242   {
00243     typedef cgal_bgl_named_params<GetPlacement, get_placement_policy_t> Params;
00244     return Params(p);
00245   }
00246   
00247   template <typename GetPlacementParams>
00248   cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t>
00249   get_placement_params(const GetPlacementParams& p)
00250   {
00251     typedef cgal_bgl_named_params<GetPlacementParams, get_placement_policy_params_t> Params;
00252     return Params(p);
00253   }
00254   
00255 
00256   template <class Tag1, class Tag2, class T1, class Base>
00257   inline
00258   typename boost::property_value< cgal_bgl_named_params<T1,Tag1,Base>, Tag2>::type
00259   get_param(const cgal_bgl_named_params<T1,Tag1,Base>& p, Tag2 tag2)
00260   {
00261     enum { match = boost::detail::same_property<Tag1,Tag2>::value };
00262     typedef typename
00263       boost::property_value< cgal_bgl_named_params<T1,Tag1,Base>, Tag2>::type T2;
00264     T2* t2 = 0;
00265     typedef boost::detail::property_value_dispatch<match> Dispatcher;
00266     return Dispatcher::const_get_value(p, t2, tag2);
00267   }
00268 
00269 CGAL_END_NAMESPACE
00270 
00271 #endif // CGAL_BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines