Commit 811cc97b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix index property python interface

This fixes the representation of property maps which don't have a
value type included in the value_types list, such as index properties.
parent 172e1326
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "graph_selectors.hh" #include "graph_selectors.hh"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/type_id.hpp>
// this file includes a simple python interface for the internally kept // this file includes a simple python interface for the internally kept
// graph. It defines a PythonVertex, PythonEdge and PythonIterator template // graph. It defines a PythonVertex, PythonEdge and PythonIterator template
...@@ -406,7 +407,13 @@ public: ...@@ -406,7 +407,13 @@ public:
std::string GetType() const std::string GetType() const
{ {
return type_names[mpl::find<value_types,value_type>::type::pos::value]; using python::detail::gcc_demangle;
if (is_same<typename mpl::find<value_types,value_type>::type,
typename mpl::end<value_types>::type>::value)
return gcc_demangle(typeid(value_type).name());
else
return type_names[mpl::find<value_types,
value_type>::type::pos::value];
} }
PropertyMap GetMap() const PropertyMap GetMap() const
......
...@@ -36,11 +36,20 @@ struct export_vertex_property_map ...@@ -36,11 +36,20 @@ struct export_vertex_property_map
template <class PropertyMap> template <class PropertyMap>
void operator()(PropertyMap) const void operator()(PropertyMap) const
{ {
using python::detail::gcc_demangle;
typedef PythonPropertyMap<PropertyMap> pmap_t; typedef PythonPropertyMap<PropertyMap> pmap_t;
string type_name = string type_name;
type_names[mpl::find<value_types, if (is_same<typename mpl::find<value_types,
typename pmap_t::value_type>::type::pos::value]; typename pmap_t::value_type>::type,
typename mpl::end<value_types>::type>::value)
type_name =
gcc_demangle(typeid(typename pmap_t::value_type).name());
else
type_name =
type_names[mpl::find<value_types,typename pmap_t::value_type>
::type::pos::value];
string class_name = _name + "<" + type_name + ">"; string class_name = _name + "<" + type_name + ">";
typedef typename mpl::if_< typedef typename mpl::if_<
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment